Skip to content

Commit 31697c9

Browse files
committed
cleaner syntax.
Signed-off-by: Bartlomiej Plotka <[email protected]>
1 parent de13093 commit 31697c9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

metrics/cache/cache.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ func (c *CachedTGatherer) InsertInPlace(entry Metric) error {
190190
if !ok {
191191
mf = &family{
192192
MetricFamily: &dto.MetricFamily{
193-
Name: proto.String(""),
194-
Help: proto.String(""),
193+
Name: new(string),
194+
Help: new(string),
195195
},
196196
metricsByHash: map[uint64]*metric{},
197197
}
@@ -215,8 +215,8 @@ func (c *CachedTGatherer) InsertInPlace(entry Metric) error {
215215
}
216216
for j := range entry.LabelNames {
217217
p := &dto.LabelPair{
218-
Name: proto.String(""),
219-
Value: proto.String(""),
218+
Name: new(string),
219+
Value: new(string),
220220
}
221221
*p.Name = entry.LabelNames[j]
222222
*p.Value = entry.LabelValues[j]
@@ -234,7 +234,7 @@ func (c *CachedTGatherer) InsertInPlace(entry Metric) error {
234234
case prometheus.CounterValue:
235235
v := m.Counter
236236
if v == nil {
237-
v = &dto.Counter{Value: proto.Float64(0)}
237+
v = &dto.Counter{Value: new(float64)}
238238
}
239239
*v.Value = entry.Value
240240
m.Counter = v
@@ -243,7 +243,7 @@ func (c *CachedTGatherer) InsertInPlace(entry Metric) error {
243243
case prometheus.GaugeValue:
244244
v := m.Gauge
245245
if v == nil {
246-
v = &dto.Gauge{Value: proto.Float64(0)}
246+
v = &dto.Gauge{Value: new(float64)}
247247
}
248248
*v.Value = entry.Value
249249
m.Counter = nil
@@ -252,7 +252,7 @@ func (c *CachedTGatherer) InsertInPlace(entry Metric) error {
252252
case prometheus.UntypedValue:
253253
v := m.Untyped
254254
if v == nil {
255-
v = &dto.Untyped{Value: proto.Float64(0)}
255+
v = &dto.Untyped{Value: new(float64)}
256256
}
257257
*v.Value = entry.Value
258258
m.Counter = nil

0 commit comments

Comments
 (0)