mirror of
https://github.com/prometheus/prometheus
synced 2026-04-20 22:41:05 +08:00
Rename created timestamp to start timestamp in proto (#18368)
Signed-off-by: Carrie Edwards <edwrdscarrie@gmail.com>
This commit is contained in:
@@ -76,9 +76,9 @@ type Parser interface {
|
||||
// retrieved (including the case where no exemplars exist at all).
|
||||
Exemplar(l *exemplar.Exemplar) bool
|
||||
|
||||
// StartTimestamp returns the created timestamp (in milliseconds) for the
|
||||
// StartTimestamp returns the start timestamp (in milliseconds) for the
|
||||
// current sample. It returns 0 if it is unknown e.g. if it wasn't set or
|
||||
// if the scrape protocol or metric type does not support created timestamps.
|
||||
// if the scrape protocol or metric type does not support start timestamps.
|
||||
StartTimestamp() int64
|
||||
|
||||
// Next advances the parser to the next sample.
|
||||
|
||||
@@ -773,7 +773,7 @@ help: "Test histogram 1"
|
||||
type: HISTOGRAM
|
||||
metric: <
|
||||
histogram: <
|
||||
created_timestamp: <
|
||||
start_timestamp: <
|
||||
seconds: 1
|
||||
nanos: 1
|
||||
>
|
||||
@@ -798,7 +798,7 @@ help: "Test histogram 2"
|
||||
type: HISTOGRAM
|
||||
metric: <
|
||||
histogram: <
|
||||
created_timestamp: <
|
||||
start_timestamp: <
|
||||
seconds: 1
|
||||
nanos: 1
|
||||
>
|
||||
@@ -851,7 +851,7 @@ help: "Test histogram 3"
|
||||
type: HISTOGRAM
|
||||
metric: <
|
||||
histogram: <
|
||||
created_timestamp: <
|
||||
start_timestamp: <
|
||||
seconds: 1
|
||||
nanos: 1
|
||||
>
|
||||
@@ -969,7 +969,7 @@ help: "Test histogram 1"
|
||||
type: HISTOGRAM
|
||||
metric: <
|
||||
histogram: <
|
||||
created_timestamp: <
|
||||
start_timestamp: <
|
||||
seconds: 1
|
||||
nanos: 1
|
||||
>
|
||||
@@ -1012,7 +1012,7 @@ help: "Test histogram 2"
|
||||
type: HISTOGRAM
|
||||
metric: <
|
||||
histogram: <
|
||||
created_timestamp: <
|
||||
start_timestamp: <
|
||||
seconds: 1
|
||||
nanos: 1
|
||||
>
|
||||
|
||||
@@ -102,7 +102,7 @@ type OpenMetricsParser struct {
|
||||
exemplarTs int64
|
||||
hasExemplarTs bool
|
||||
|
||||
// Created timestamp parsing state.
|
||||
// Start timestamp parsing state.
|
||||
st int64
|
||||
stHashSet uint64
|
||||
// ignoreExemplar instructs the parser to not overwrite exemplars (to keep them while peeking ahead).
|
||||
@@ -122,11 +122,11 @@ type openMetricsParserOptions struct {
|
||||
type OpenMetricsOption func(*openMetricsParserOptions)
|
||||
|
||||
// WithOMParserSTSeriesSkipped turns off exposing _created lines
|
||||
// as series, which makes those only used for parsing created timestamp
|
||||
// as series, which makes those only used for parsing start timestamp
|
||||
// for `StartTimestamp` method purposes.
|
||||
//
|
||||
// It's recommended to use this option to avoid using _created lines for other
|
||||
// purposes than created timestamp, but leave false by default for the
|
||||
// purposes than start timestamp, but leave false by default for the
|
||||
// best-effort compatibility.
|
||||
func WithOMParserSTSeriesSkipped() OpenMetricsOption {
|
||||
return func(o *openMetricsParserOptions) {
|
||||
@@ -285,7 +285,7 @@ func (p *OpenMetricsParser) Exemplar(e *exemplar.Exemplar) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// StartTimestamp returns the created timestamp for a current Metric if exists or nil.
|
||||
// StartTimestamp returns the start timestamp for a current Metric if exists or nil.
|
||||
// NOTE(Maniktherana): Might use additional CPU/mem resources due to deep copy of parser required for peeking given 1.0 OM specification on _created series.
|
||||
func (p *OpenMetricsParser) StartTimestamp() int64 {
|
||||
if !typeRequiresST(p.mtype) {
|
||||
|
||||
@@ -404,11 +404,11 @@ func (p *ProtobufParser) StartTimestamp() int64 {
|
||||
var st *types.Timestamp
|
||||
switch p.dec.GetType() {
|
||||
case dto.MetricType_COUNTER:
|
||||
st = p.dec.GetCounter().GetCreatedTimestamp()
|
||||
st = p.dec.GetCounter().GetStartTimestamp()
|
||||
case dto.MetricType_SUMMARY:
|
||||
st = p.dec.GetSummary().GetCreatedTimestamp()
|
||||
st = p.dec.GetSummary().GetStartTimestamp()
|
||||
case dto.MetricType_HISTOGRAM, dto.MetricType_GAUGE_HISTOGRAM:
|
||||
st = p.dec.GetHistogram().GetCreatedTimestamp()
|
||||
st = p.dec.GetHistogram().GetStartTimestamp()
|
||||
default:
|
||||
}
|
||||
if st == nil {
|
||||
|
||||
@@ -608,7 +608,7 @@ type: COUNTER
|
||||
metric: <
|
||||
counter: <
|
||||
value: 42
|
||||
created_timestamp: <
|
||||
start_timestamp: <
|
||||
seconds: 1625851153
|
||||
nanos: 146848499
|
||||
>
|
||||
@@ -623,7 +623,7 @@ metric: <
|
||||
summary: <
|
||||
sample_count: 42
|
||||
sample_sum: 1.234
|
||||
created_timestamp: <
|
||||
start_timestamp: <
|
||||
seconds: 1625851153
|
||||
nanos: 146848499
|
||||
>
|
||||
@@ -636,7 +636,7 @@ help: "A histogram with a created timestamp."
|
||||
type: HISTOGRAM
|
||||
metric: <
|
||||
histogram: <
|
||||
created_timestamp: <
|
||||
start_timestamp: <
|
||||
seconds: 1625851153
|
||||
nanos: 146848499
|
||||
>
|
||||
@@ -653,7 +653,7 @@ help: "A gauge histogram with a created timestamp."
|
||||
type: GAUGE_HISTOGRAM
|
||||
metric: <
|
||||
histogram: <
|
||||
created_timestamp: <
|
||||
start_timestamp: <
|
||||
seconds: 1625851153
|
||||
nanos: 146848499
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user