MCPcopy
hub / github.com/grafana/tempo / updateSeries

Method updateSeries

modules/generator/registry/gauge.go:69–100  ·  view source on GitHub ↗
(lbls labels.Labels, value float64, operation string, updateIfAlreadyExist bool)

Source from the content-addressed store, hash-verified

67}
68
69func (g *gauge) updateSeries(lbls labels.Labels, value float64, operation string, updateIfAlreadyExist bool) {
70 hash := lbls.Hash()
71
72 g.seriesMtx.RLock()
73 s, ok := g.series[hash]
74 g.seriesMtx.RUnlock()
75
76 g.seriesDemand.Insert(hash)
77
78 if ok {
79 // target_info will always be 1 so if the series exists, we don't need to go through this loop
80 if !updateIfAlreadyExist {
81 return
82 }
83 g.updateSeriesValue(hash, s, value, operation)
84 return
85 }
86
87 g.seriesMtx.Lock()
88 defer g.seriesMtx.Unlock()
89
90 s, lbls, hash = resolveSeries(g.series, hash, lbls, g.lifecycler, 1)
91 if s != nil {
92 if !updateIfAlreadyExist {
93 return
94 }
95 g.updateSeriesValue(hash, s, value, operation)
96 return
97 }
98
99 g.series[hash] = g.newSeries(lbls, value)
100}
101
102func (g *gauge) newSeries(lbls labels.Labels, value float64) *gaugeSeries {
103 return &gaugeSeries{

Callers 3

SetMethod · 0.95
IncMethod · 0.95
SetForTargetInfoMethod · 0.95

Calls 5

updateSeriesValueMethod · 0.95
newSeriesMethod · 0.95
resolveSeriesFunction · 0.85
HashMethod · 0.80
InsertMethod · 0.80

Tested by

no test coverage detected