prometheus icon indicating copy to clipboard operation
prometheus copied to clipboard

created-timestamp-zero-ingestion spams logs with WARN on ongoing metrics

Open davhdavh opened this issue 1 year ago • 3 comments

What did you do?

Enabled created-timestamp-zero-ingestion feature. Related to #16951

WARNs for every single ongoing metric, every single time they are reported:

time=2025-12-03T09:51:41.654Z level=WARN source=combined_appender.go:158 msg="Error when appending CT from OTLP" component=web err="too old sample" series="{__name__=\"blabla\", client=\"blabla\", \"client_service.namespace\"=\"blabla\", connection_type=\"database\", failed=\"false\", le=\"0.1\", server=\"blabla\"}" created_timestamp=1764754661141 timestamp=1764755501143 sample_type=float

It seems to want to create the zero sample at created_timestamp=1764754661141, which is outside the outOfOrderTimeWindow setting and thus a WARN is given.

What did you expect to see?

AppendCTZeroSample is STILL called, either with the earliest possible time allowed by the outOfOrderTimeWindow setting (the assumption being that the metric is reported way too late) OR the sample timestamp (the assumption being that prometheus was down at the time of creation and this is the earliest time it could be reported). NOT recording a zero just because the timestamp is too old changes the semantics of the metric and thus makes it unreliable.

What did you see instead? Under which circumstances?

WARN every single time the metric is reported

System information

No response

Prometheus version

quay.io/prometheus/prometheus:v3.8.0

Prometheus configuration file

prometheus:
    prometheusSpec:
      enableOTLPReceiver: true
      otlp:
        promoteResourceAttributes:
          - service.instance.id
          - service.name
          - service.namespace
          - cloud.availability_zone
          - cloud.region
          - container.name
          - k8s.cluster.name
          - k8s.container.name
          - k8s.cronjob.name
          - k8s.daemonset.name
          - k8s.deployment.name
          - k8s.job.name
          - k8s.namespace.name
          - k8s.pod.name
          - k8s.replicaset.name
          - k8s.statefulset.name
        translationStrategy: NoUTF8EscapingWithSuffixes
        keepIdentifyingResourceAttributes: true
      tsdb:
        outOfOrderTimeWindow: 10m

Alertmanager version


Alertmanager configuration file


Logs


davhdavh avatar Dec 03 '25 10:12 davhdavh

@davhdavh can you assign it to me

shubhIam-dev avatar Dec 08 '25 04:12 shubhIam-dev

@shubhIam-dev do not have permissions for that

davhdavh avatar Dec 08 '25 13:12 davhdavh

Thanks for reporting this. We discussed at the bug-scrub, and agreed it seems to be a bug; normally the zero should go in in-order and Prometheus should not complain about it.

@shubhIam-dev thank you for your interest; can you please write a short description of how you might address this?

bboreham avatar Dec 09 '25 11:12 bboreham

@bboreham My current understanding is that the warning happens because Prometheus keeps trying to append the zero sample at the original created_timestamp, which falls outside the outOfOrderTimeWindow, so it fails every time and logs a WARN.

To address this, I would try to make sure the zero sample is still recorded using a valid timestamp — for example by clamping it to the earliest timestamp allowed by the out-of-order window, or by using the first observed sample timestamp instead. This way the metric semantics are preserved and the repeated warnings are avoided.

I’m still learning Prometheus internals, so I’d really appreciate any guidance on whether this approach makes sense or if there’s a preferred direction you’d recommend.

shubhIam-dev avatar Dec 15 '25 09:12 shubhIam-dev