Debian Codegraph @

prometheus/collectors/go_collector_go121_test.go

raw
1 // Copyright 2022 The Prometheus Authors
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13
14 //go:build go1.21 && !go1.22
15 // +build go1.21,!go1.22
16
17 package collectors
18
19 func withAllMetrics() []string {
20 return withBaseMetrics([]string{
21 "go_cgo_go_to_c_calls_calls_total",
22 "go_cpu_classes_gc_mark_assist_cpu_seconds_total",
23 "go_cpu_classes_gc_mark_dedicated_cpu_seconds_total",
24 "go_cpu_classes_gc_mark_idle_cpu_seconds_total",
25 "go_cpu_classes_gc_pause_cpu_seconds_total",
26 "go_cpu_classes_gc_total_cpu_seconds_total",
27 "go_cpu_classes_idle_cpu_seconds_total",
28 "go_cpu_classes_scavenge_assist_cpu_seconds_total",
29 "go_cpu_classes_scavenge_background_cpu_seconds_total",
30 "go_cpu_classes_scavenge_total_cpu_seconds_total",
31 "go_cpu_classes_total_cpu_seconds_total",
32 "go_cpu_classes_user_cpu_seconds_total",
33 "go_gc_cycles_automatic_gc_cycles_total",
34 "go_gc_cycles_forced_gc_cycles_total",
35 "go_gc_cycles_total_gc_cycles_total",
36 "go_gc_gogc_percent",
37 "go_gc_gomemlimit_bytes",
38 "go_gc_heap_allocs_by_size_bytes",
39 "go_gc_heap_allocs_bytes_total",
40 "go_gc_heap_allocs_objects_total",
41 "go_gc_heap_frees_by_size_bytes",
42 "go_gc_heap_frees_bytes_total",
43 "go_gc_heap_frees_objects_total",
44 "go_gc_heap_goal_bytes",
45 "go_gc_heap_live_bytes",
46 "go_gc_heap_objects_objects",
47 "go_gc_heap_tiny_allocs_objects_total",
48 "go_gc_limiter_last_enabled_gc_cycle",
49 "go_gc_pauses_seconds",
50 "go_gc_scan_globals_bytes",
51 "go_gc_scan_heap_bytes",
52 "go_gc_scan_stack_bytes",
53 "go_gc_scan_total_bytes",
54 "go_gc_stack_starting_size_bytes",
55 "go_godebug_non_default_behavior_execerrdot_events_total",
56 "go_godebug_non_default_behavior_gocachehash_events_total",
57 "go_godebug_non_default_behavior_gocachetest_events_total",
58 "go_godebug_non_default_behavior_gocacheverify_events_total",
59 "go_godebug_non_default_behavior_http2client_events_total",
60 "go_godebug_non_default_behavior_http2server_events_total",
61 "go_godebug_non_default_behavior_installgoroot_events_total",
62 "go_godebug_non_default_behavior_jstmpllitinterp_events_total",
63 "go_godebug_non_default_behavior_multipartmaxheaders_events_total",
64 "go_godebug_non_default_behavior_multipartmaxparts_events_total",
65 "go_godebug_non_default_behavior_multipathtcp_events_total",
66 "go_godebug_non_default_behavior_netedns0_events_total",
67 "go_godebug_non_default_behavior_panicnil_events_total",
68 "go_godebug_non_default_behavior_randautoseed_events_total",
69 "go_godebug_non_default_behavior_tarinsecurepath_events_total",
70 "go_godebug_non_default_behavior_tlsmaxrsasize_events_total",
71 "go_godebug_non_default_behavior_x509sha1_events_total",
72 "go_godebug_non_default_behavior_x509usefallbackroots_events_total",
73 "go_godebug_non_default_behavior_zipinsecurepath_events_total",
74 "go_memory_classes_heap_free_bytes",
75 "go_memory_classes_heap_objects_bytes",
76 "go_memory_classes_heap_released_bytes",
77 "go_memory_classes_heap_stacks_bytes",
78 "go_memory_classes_heap_unused_bytes",
79 "go_memory_classes_metadata_mcache_free_bytes",
80 "go_memory_classes_metadata_mcache_inuse_bytes",
81 "go_memory_classes_metadata_mspan_free_bytes",
82 "go_memory_classes_metadata_mspan_inuse_bytes",
83 "go_memory_classes_metadata_other_bytes",
84 "go_memory_classes_os_stacks_bytes",
85 "go_memory_classes_other_bytes",
86 "go_memory_classes_profiling_buckets_bytes",
87 "go_memory_classes_total_bytes",
88 "go_sched_gomaxprocs_threads",
89 "go_sched_goroutines_goroutines",
90 "go_sched_latencies_seconds",
91 "go_sync_mutex_wait_total_seconds_total",
92 })
93 }
94
95 func withGCMetrics() []string {
96 return withBaseMetrics([]string{
97 "go_gc_cycles_automatic_gc_cycles_total",
98 "go_gc_cycles_forced_gc_cycles_total",
99 "go_gc_cycles_total_gc_cycles_total",
100 "go_gc_gogc_percent",
101 "go_gc_gomemlimit_bytes",
102 "go_gc_heap_allocs_by_size_bytes",
103 "go_gc_heap_allocs_bytes_total",
104 "go_gc_heap_allocs_objects_total",
105 "go_gc_heap_frees_by_size_bytes",
106 "go_gc_heap_frees_bytes_total",
107 "go_gc_heap_frees_objects_total",
108 "go_gc_heap_goal_bytes",
109 "go_gc_heap_live_bytes",
110 "go_gc_heap_objects_objects",
111 "go_gc_heap_tiny_allocs_objects_total",
112 "go_gc_limiter_last_enabled_gc_cycle",
113 "go_gc_pauses_seconds",
114 "go_gc_scan_globals_bytes",
115 "go_gc_scan_heap_bytes",
116 "go_gc_scan_stack_bytes",
117 "go_gc_scan_total_bytes",
118 "go_gc_stack_starting_size_bytes",
119 })
120 }
121
122 func withMemoryMetrics() []string {
123 return withBaseMetrics([]string{
124 "go_memory_classes_heap_free_bytes",
125 "go_memory_classes_heap_objects_bytes",
126 "go_memory_classes_heap_released_bytes",
127 "go_memory_classes_heap_stacks_bytes",
128 "go_memory_classes_heap_unused_bytes",
129 "go_memory_classes_metadata_mcache_free_bytes",
130 "go_memory_classes_metadata_mcache_inuse_bytes",
131 "go_memory_classes_metadata_mspan_free_bytes",
132 "go_memory_classes_metadata_mspan_inuse_bytes",
133 "go_memory_classes_metadata_other_bytes",
134 "go_memory_classes_os_stacks_bytes",
135 "go_memory_classes_other_bytes",
136 "go_memory_classes_profiling_buckets_bytes",
137 "go_memory_classes_total_bytes",
138 })
139 }
140
141 func withSchedulerMetrics() []string {
142 return withBaseMetrics([]string{
143 "go_sched_gomaxprocs_threads",
144 "go_sched_goroutines_goroutines",
145 "go_sched_latencies_seconds",
146 })
147 }
148
149 func withDebugMetrics() []string {
150 return withBaseMetrics([]string{
151 "go_godebug_non_default_behavior_execerrdot_events_total",
152 "go_godebug_non_default_behavior_gocachehash_events_total",
153 "go_godebug_non_default_behavior_gocachetest_events_total",
154 "go_godebug_non_default_behavior_gocacheverify_events_total",
155 "go_godebug_non_default_behavior_http2client_events_total",
156 "go_godebug_non_default_behavior_http2server_events_total",
157 "go_godebug_non_default_behavior_installgoroot_events_total",
158 "go_godebug_non_default_behavior_jstmpllitinterp_events_total",
159 "go_godebug_non_default_behavior_multipartmaxheaders_events_total",
160 "go_godebug_non_default_behavior_multipartmaxparts_events_total",
161 "go_godebug_non_default_behavior_multipathtcp_events_total",
162 "go_godebug_non_default_behavior_netedns0_events_total",
163 "go_godebug_non_default_behavior_panicnil_events_total",
164 "go_godebug_non_default_behavior_randautoseed_events_total",
165 "go_godebug_non_default_behavior_tarinsecurepath_events_total",
166 "go_godebug_non_default_behavior_tlsmaxrsasize_events_total",
167 "go_godebug_non_default_behavior_x509sha1_events_total",
168 "go_godebug_non_default_behavior_x509usefallbackroots_events_total",
169 "go_godebug_non_default_behavior_zipinsecurepath_events_total",
170 })
171 }
172
173 var (
174 defaultRuntimeMetrics = []string{
175 "go_gc_gogc_percent",
176 "go_gc_gomemlimit_bytes",
177 "go_sched_gomaxprocs_threads",
178 }
179 onlyGCDefRuntimeMetrics = []string{
180 "go_gc_gogc_percent",
181 "go_gc_gomemlimit_bytes",
182 }
183 onlySchedDefRuntimeMetrics = []string{
184 "go_sched_gomaxprocs_threads",
185 }
186 )