Fix go_collector_latest_test Fail on go1.19 (#1136) · prometheus/client_golang@b785d0c (original) (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.19 && !go1.20

`

``

15

`+

// +build go1.19,!go1.20

`

``

16

+

``

17

`+

package collectors

`

``

18

+

``

19

`+

func withAllMetrics() []string {

`

``

20

`+

return withBaseMetrics([]string{

`

``

21

`+

"go_cgo_go_to_c_calls_calls_total",

`

``

22

`+

"go_gc_cycles_automatic_gc_cycles_total",

`

``

23

`+

"go_gc_cycles_forced_gc_cycles_total",

`

``

24

`+

"go_gc_cycles_total_gc_cycles_total",

`

``

25

`+

"go_gc_heap_allocs_by_size_bytes",

`

``

26

`+

"go_gc_heap_allocs_bytes_total",

`

``

27

`+

"go_gc_heap_allocs_objects_total",

`

``

28

`+

"go_gc_heap_frees_by_size_bytes",

`

``

29

`+

"go_gc_heap_frees_bytes_total",

`

``

30

`+

"go_gc_heap_frees_objects_total",

`

``

31

`+

"go_gc_heap_goal_bytes",

`

``

32

`+

"go_gc_heap_objects_objects",

`

``

33

`+

"go_gc_heap_tiny_allocs_objects_total",

`

``

34

`+

"go_gc_limiter_last_enabled_gc_cycle",

`

``

35

`+

"go_gc_pauses_seconds",

`

``

36

`+

"go_gc_stack_starting_size_bytes",

`

``

37

`+

"go_memory_classes_heap_free_bytes",

`

``

38

`+

"go_memory_classes_heap_objects_bytes",

`

``

39

`+

"go_memory_classes_heap_released_bytes",

`

``

40

`+

"go_memory_classes_heap_stacks_bytes",

`

``

41

`+

"go_memory_classes_heap_unused_bytes",

`

``

42

`+

"go_memory_classes_metadata_mcache_free_bytes",

`

``

43

`+

"go_memory_classes_metadata_mcache_inuse_bytes",

`

``

44

`+

"go_memory_classes_metadata_mspan_free_bytes",

`

``

45

`+

"go_memory_classes_metadata_mspan_inuse_bytes",

`

``

46

`+

"go_memory_classes_metadata_other_bytes",

`

``

47

`+

"go_memory_classes_os_stacks_bytes",

`

``

48

`+

"go_memory_classes_other_bytes",

`

``

49

`+

"go_memory_classes_profiling_buckets_bytes",

`

``

50

`+

"go_memory_classes_total_bytes",

`

``

51

`+

"go_sched_gomaxprocs_threads",

`

``

52

`+

"go_sched_goroutines_goroutines",

`

``

53

`+

"go_sched_latencies_seconds",

`

``

54

`+

})

`

``

55

`+

}

`

``

56

+

``

57

`+

func withGCMetrics() []string {

`

``

58

`+

return withBaseMetrics([]string{

`

``

59

`+

"go_gc_cycles_automatic_gc_cycles_total",

`

``

60

`+

"go_gc_cycles_forced_gc_cycles_total",

`

``

61

`+

"go_gc_cycles_total_gc_cycles_total",

`

``

62

`+

"go_gc_heap_allocs_by_size_bytes",

`

``

63

`+

"go_gc_heap_allocs_bytes_total",

`

``

64

`+

"go_gc_heap_allocs_objects_total",

`

``

65

`+

"go_gc_heap_frees_by_size_bytes",

`

``

66

`+

"go_gc_heap_frees_bytes_total",

`

``

67

`+

"go_gc_heap_frees_objects_total",

`

``

68

`+

"go_gc_heap_goal_bytes",

`

``

69

`+

"go_gc_heap_objects_objects",

`

``

70

`+

"go_gc_heap_tiny_allocs_objects_total",

`

``

71

`+

"go_gc_limiter_last_enabled_gc_cycle",

`

``

72

`+

"go_gc_pauses_seconds",

`

``

73

`+

"go_gc_stack_starting_size_bytes",

`

``

74

`+

})

`

``

75

`+

}

`

``

76

+

``

77

`+

func withMemoryMetrics() []string {

`

``

78

`+

return withBaseMetrics([]string{

`

``

79

`+

"go_memory_classes_heap_free_bytes",

`

``

80

`+

"go_memory_classes_heap_objects_bytes",

`

``

81

`+

"go_memory_classes_heap_released_bytes",

`

``

82

`+

"go_memory_classes_heap_stacks_bytes",

`

``

83

`+

"go_memory_classes_heap_unused_bytes",

`

``

84

`+

"go_memory_classes_metadata_mcache_free_bytes",

`

``

85

`+

"go_memory_classes_metadata_mcache_inuse_bytes",

`

``

86

`+

"go_memory_classes_metadata_mspan_free_bytes",

`

``

87

`+

"go_memory_classes_metadata_mspan_inuse_bytes",

`

``

88

`+

"go_memory_classes_metadata_other_bytes",

`

``

89

`+

"go_memory_classes_os_stacks_bytes",

`

``

90

`+

"go_memory_classes_other_bytes",

`

``

91

`+

"go_memory_classes_profiling_buckets_bytes",

`

``

92

`+

"go_memory_classes_total_bytes",

`

``

93

`+

})

`

``

94

`+

}

`

``

95

+

``

96

`+

func withSchedulerMetrics() []string {

`

``

97

`+

return []string{

`

``

98

`+

"go_gc_duration_seconds",

`

``

99

`+

"go_goroutines",

`

``

100

`+

"go_info",

`

``

101

`+

"go_memstats_last_gc_time_seconds",

`

``

102

`+

"go_sched_gomaxprocs_threads",

`

``

103

`+

"go_sched_goroutines_goroutines",

`

``

104

`+

"go_sched_latencies_seconds",

`

``

105

`+

"go_threads",

`

``

106

`+

}

`

``

107

`+

}

`