mirror of
https://github.com/prometheus/prometheus.git
synced 2025-07-03 11:03:25 +00:00
textparse: Optimize CreatedTimestamp; It returns int64 value now. (#16072)
..instead of *int64. This is as an optimization and ease of use. We already accepted in many places (proto histograms, PRW) that CT (or any timestamp really) 0 means not set. Signed-off-by: bwplotka <bwplotka@gmail.com>
This commit is contained in:
parent
71cb219eb6
commit
dc85d677d8
11 changed files with 180 additions and 107 deletions
|
@ -83,7 +83,7 @@ type NHCBParser struct {
|
|||
fhNHCB *histogram.FloatHistogram
|
||||
lsetNHCB labels.Labels
|
||||
exemplars []exemplar.Exemplar
|
||||
ctNHCB *int64
|
||||
ctNHCB int64
|
||||
metricStringNHCB string
|
||||
|
||||
// Collates values from the classic histogram series to build
|
||||
|
@ -92,7 +92,7 @@ type NHCBParser struct {
|
|||
tempNHCB convertnhcb.TempHistogram
|
||||
tempExemplars []exemplar.Exemplar
|
||||
tempExemplarCount int
|
||||
tempCT *int64
|
||||
tempCT int64
|
||||
|
||||
// Remembers the last base histogram metric name (assuming it's
|
||||
// a classic histogram) so we can tell if the next float series
|
||||
|
@ -160,7 +160,7 @@ func (p *NHCBParser) Exemplar(ex *exemplar.Exemplar) bool {
|
|||
return p.parser.Exemplar(ex)
|
||||
}
|
||||
|
||||
func (p *NHCBParser) CreatedTimestamp() *int64 {
|
||||
func (p *NHCBParser) CreatedTimestamp() int64 {
|
||||
switch p.state {
|
||||
case stateStart:
|
||||
if p.entry == EntrySeries || p.entry == EntryHistogram {
|
||||
|
@ -171,7 +171,7 @@ func (p *NHCBParser) CreatedTimestamp() *int64 {
|
|||
case stateEmitting:
|
||||
return p.ctNHCB
|
||||
}
|
||||
return nil
|
||||
return 0
|
||||
}
|
||||
|
||||
func (p *NHCBParser) Next() (Entry, error) {
|
||||
|
@ -375,6 +375,6 @@ func (p *NHCBParser) processNHCB() bool {
|
|||
}
|
||||
p.tempNHCB.Reset()
|
||||
p.tempExemplarCount = 0
|
||||
p.tempCT = nil
|
||||
p.tempCT = 0
|
||||
return err == nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue