Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit d63f353

Browse files
committed
metrics/prometheus: revert bad addition dto2 -> dto
1 parent 61ea1c1 commit d63f353

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

metrics/prometheus/prometheus.go

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
"github.com/prometheus/client_golang/prometheus"
1313

14-
dto2 "github.com/prometheus/client_model/go"
14+
dto "github.com/prometheus/client_model/go"
1515
)
1616

1717
var (
@@ -24,15 +24,15 @@ type gatherer struct {
2424
reg metrics.Registry
2525
}
2626

27-
func (g gatherer) Gather() ([]*dto2.MetricFamily, error) {
27+
func (g gatherer) Gather() ([]*dto.MetricFamily, error) {
2828
// Gather and pre-sort the metrics to avoid random listings
2929
var names []string
3030
g.reg.Each(func(name string, i interface{}) {
3131
names = append(names, name)
3232
})
3333
sort.Strings(names)
3434

35-
mfs := make([]*dto2.MetricFamily, 0, len(names))
35+
mfs := make([]*dto.MetricFamily, 0, len(names))
3636
for _, name := range names {
3737
mIntf := g.reg.Get(name)
3838
name := strings.Replace(name, "/", "_", -1)
@@ -41,45 +41,45 @@ func (g gatherer) Gather() ([]*dto2.MetricFamily, error) {
4141
case metrics.Counter:
4242
val := m.Snapshot().Count()
4343
valFloat := float64(val)
44-
mfs = append(mfs, &dto2.MetricFamily{
44+
mfs = append(mfs, &dto.MetricFamily{
4545
Name: &name,
46-
Type: dto2.MetricType_COUNTER.Enum(),
47-
Metric: []*dto2.Metric{{
48-
Counter: &dto2.Counter{
46+
Type: dto.MetricType_COUNTER.Enum(),
47+
Metric: []*dto.Metric{{
48+
Counter: &dto.Counter{
4949
Value: &valFloat,
5050
},
5151
}},
5252
})
5353
case metrics.CounterFloat64:
5454
val := m.Snapshot().Count()
55-
mfs = append(mfs, &dto2.MetricFamily{
55+
mfs = append(mfs, &dto.MetricFamily{
5656
Name: &name,
57-
Type: dto2.MetricType_COUNTER.Enum(),
58-
Metric: []*dto2.Metric{{
59-
Counter: &dto2.Counter{
57+
Type: dto.MetricType_COUNTER.Enum(),
58+
Metric: []*dto.Metric{{
59+
Counter: &dto.Counter{
6060
Value: &val,
6161
},
6262
}},
6363
})
6464
case metrics.Gauge:
6565
val := m.Snapshot().Value()
6666
valFloat := float64(val)
67-
mfs = append(mfs, &dto2.MetricFamily{
67+
mfs = append(mfs, &dto.MetricFamily{
6868
Name: &name,
69-
Type: dto2.MetricType_GAUGE.Enum(),
70-
Metric: []*dto2.Metric{{
71-
Gauge: &dto2.Gauge{
69+
Type: dto.MetricType_GAUGE.Enum(),
70+
Metric: []*dto.Metric{{
71+
Gauge: &dto.Gauge{
7272
Value: &valFloat,
7373
},
7474
}},
7575
})
7676
case metrics.GaugeFloat64:
7777
val := m.Snapshot().Value()
78-
mfs = append(mfs, &dto2.MetricFamily{
78+
mfs = append(mfs, &dto.MetricFamily{
7979
Name: &name,
80-
Type: dto2.MetricType_GAUGE.Enum(),
81-
Metric: []*dto2.Metric{{
82-
Gauge: &dto2.Gauge{
80+
Type: dto.MetricType_GAUGE.Enum(),
81+
Metric: []*dto.Metric{{
82+
Gauge: &dto.Gauge{
8383
Value: &val,
8484
},
8585
}},
@@ -92,21 +92,21 @@ func (g gatherer) Gather() ([]*dto2.MetricFamily, error) {
9292
sumFloat := float64(sum)
9393

9494
ps := snapshot.Percentiles(pv)
95-
qs := make([]*dto2.Quantile, len(pv))
95+
qs := make([]*dto.Quantile, len(pv))
9696
for i := range ps {
9797
v := pv[i]
9898
s := ps[i]
99-
qs[i] = &dto2.Quantile{
99+
qs[i] = &dto.Quantile{
100100
Quantile: &v,
101101
Value: &s,
102102
}
103103
}
104104

105-
mfs = append(mfs, &dto2.MetricFamily{
105+
mfs = append(mfs, &dto.MetricFamily{
106106
Name: &name,
107-
Type: dto2.MetricType_SUMMARY.Enum(),
108-
Metric: []*dto2.Metric{{
109-
Summary: &dto2.Summary{
107+
Type: dto.MetricType_SUMMARY.Enum(),
108+
Metric: []*dto.Metric{{
109+
Summary: &dto.Summary{
110110
SampleCount: &countUint,
111111
SampleSum: &sumFloat,
112112
Quantile: qs,
@@ -116,11 +116,11 @@ func (g gatherer) Gather() ([]*dto2.MetricFamily, error) {
116116
case metrics.Meter:
117117
val := m.Snapshot().Count()
118118
valFloat := float64(val)
119-
mfs = append(mfs, &dto2.MetricFamily{
119+
mfs = append(mfs, &dto.MetricFamily{
120120
Name: &name,
121-
Type: dto2.MetricType_GAUGE.Enum(),
122-
Metric: []*dto2.Metric{{
123-
Gauge: &dto2.Gauge{
121+
Type: dto.MetricType_GAUGE.Enum(),
122+
Metric: []*dto.Metric{{
123+
Gauge: &dto.Gauge{
124124
Value: &valFloat,
125125
},
126126
}},
@@ -133,21 +133,21 @@ func (g gatherer) Gather() ([]*dto2.MetricFamily, error) {
133133
sumFloat := float64(sum)
134134

135135
ps := snapshot.Percentiles(pv)
136-
qs := make([]*dto2.Quantile, len(pv))
136+
qs := make([]*dto.Quantile, len(pv))
137137
for i := range ps {
138138
v := pv[i]
139139
s := ps[i]
140-
qs[i] = &dto2.Quantile{
140+
qs[i] = &dto.Quantile{
141141
Quantile: &v,
142142
Value: &s,
143143
}
144144
}
145145

146-
mfs = append(mfs, &dto2.MetricFamily{
146+
mfs = append(mfs, &dto.MetricFamily{
147147
Name: &name,
148-
Type: dto2.MetricType_SUMMARY.Enum(),
149-
Metric: []*dto2.Metric{{
150-
Summary: &dto2.Summary{
148+
Type: dto.MetricType_SUMMARY.Enum(),
149+
Metric: []*dto.Metric{{
150+
Summary: &dto.Summary{
151151
SampleCount: &countUint,
152152
SampleSum: &sumFloat,
153153
Quantile: qs,
@@ -163,21 +163,21 @@ func (g gatherer) Gather() ([]*dto2.MetricFamily, error) {
163163
}
164164

165165
ps := snapshot.Percentiles(pvShortPercent)
166-
qs := make([]*dto2.Quantile, len(pv))
166+
qs := make([]*dto.Quantile, len(pv))
167167
for i := range pvShort {
168168
v := pv[i]
169169
s := ps[i]
170-
qs[i] = &dto2.Quantile{
170+
qs[i] = &dto.Quantile{
171171
Quantile: &v,
172172
Value: &s,
173173
}
174174
}
175175

176-
mfs = append(mfs, &dto2.MetricFamily{
176+
mfs = append(mfs, &dto.MetricFamily{
177177
Name: &name,
178-
Type: dto2.MetricType_SUMMARY.Enum(),
179-
Metric: []*dto2.Metric{{
180-
Summary: &dto2.Summary{
178+
Type: dto.MetricType_SUMMARY.Enum(),
179+
Metric: []*dto.Metric{{
180+
Summary: &dto.Summary{
181181
SampleCount: &count,
182182
// TODO: do we need to specify SampleSum here? and if so
183183
// what should that be?

0 commit comments

Comments
 (0)