forked from prometheus/snmp_exporter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
compact_vendor.patch
53 lines (50 loc) · 1.46 KB
/
compact_vendor.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--- ./vendor/github.com/prometheus/common/expfmt/text_create.go.orig Fri Apr 1 18:24:35 2022
+++ ./vendor/github.com/prometheus/common/expfmt/text_create.go Fri Apr 1 18:25:40 2022
@@ -91,9 +91,10 @@
}
var n int
+ metricType := in.GetType()
// Comments, first HELP, then TYPE.
- if in.Help != nil {
+ if len(*in.Help) > 0 {
n, err = w.WriteString("# HELP ")
written += n
if err != nil {
@@ -119,7 +120,7 @@
if err != nil {
return
}
- }
+
n, err = w.WriteString("# TYPE ")
written += n
if err != nil {
@@ -130,7 +131,6 @@
if err != nil {
return
}
- metricType := in.GetType()
switch metricType {
case dto.MetricType_COUNTER:
n, err = w.WriteString(" counter\n")
@@ -149,6 +149,7 @@
if err != nil {
return
}
+ }
// Finally the samples, one line for each.
for _, metric := range in.Metric {
--- ./vendor/github.com/prometheus/client_golang/prometheus/registry.go.orig Sun May 1 21:53:07 2022
+++ ./vendor/github.com/prometheus/client_golang/prometheus/registry.go Sun May 1 22:52:44 2022
@@ -601,10 +601,7 @@
metricFamily, ok := metricFamiliesByName[desc.fqName]
if ok { // Existing name.
if metricFamily.GetHelp() != desc.help {
- return fmt.Errorf(
- "collected metric %s %s has help %q but should have %q",
- desc.fqName, dtoMetric, desc.help, metricFamily.GetHelp(),
- )
+ metricFamily.Help = proto.String(desc.help)
}
// TODO(beorn7): Simplify switch once Desc has type.
switch metricFamily.GetType() {