Skip to content

CT, OM: no exemplars on first scrape for created timestamp compatible open metrics #15137

@krajorama

Description

@krajorama

What did you do?

CNCF slack discussion: https://cloud-native.slack.com/archives/C02KR205UMU/p1728397164955929

Expect exemplars for counters/histograms/summaries on first scrape when --enable-feature=exemplar-storage,created-timestamp-zero-ingestion.

I was adding a unit test for NHCB (#14978) and noticed that after calling OpenMetricsParser.CreatedTimestamp , the parser doesn't return exemplars.

This is because when the parser first encounter a metric, it will peek ahead to get the created timestamp here: Next. However Next starts by clearing any exemplars already processed on the series line .

To reproduce the issue, flip the order of exemplars and ct in the test framework:

for e := (exemplar.Exemplar{}); p.Exemplar(&e); {

What did you expect to see?

Expect exemplars for counters/histograms/summaries on first scrape when --enable-feature=exemplar-storage,created-timestamp-zero-ingestion.

What did you see instead? Under which circumstances?

Unit test simulating the first scrape fails. To reproduce the issue, flip the order of exemplars and ct in the test framework:

for e := (exemplar.Exemplar{}); p.Exemplar(&e); {

System information

No response

Prometheus version

No response

Prometheus configuration file

N/A

Alertmanager version

No response

Alertmanager configuration file

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions