Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1937709

Summary: Prometheus dropping samples/s with timestamps arriving out of order.
Product: Red Hat Enterprise Linux 8 Reporter: Ashwini M. Khaire <akhaire>
Component: chronyAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED NOTABUG QA Contact: rhel-cs-infra-services-qe <rhel-cs-infra-services-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.2CC: alegrand, anpicker, dgrisonn, erooth, jreimann, lcosic, mlichvar, pescorza, surbania
Target Milestone: betaFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-09-22 15:01:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ashwini M. Khaire 2021-03-11 11:59:54 UTC
Description of problem:

Receiving the alert message as below in the OCP console :

~~~
Prometheus openshift-monitoring/prometheus-k8s-0 is dropping 35.74 samples/s with timestamps arriving out of order.
~~~

Version-Release number of selected component (if applicable):

OCP cluster version : 4.6.16

How reproducible:
N/A

Additional info:

- In the Prometheus pod logs below warnings are present :

~~~
2021-02-25T10:19:22.208961998Z level=warn ts=2021-02-25T10:19:22.208Z caller=scrape.go:1372 component="scrape manager" scrape_pool=openshift-multus/monitor-network/0 target=https://x.x.x.x:8443/metrics msg="Error on ingesting out-of-order samples" num_dropped=18

2021-02-25T10:19:26.183671522Z level=warn ts=2021-02-25T10:19:26.183Z caller=scrape.go:1372 component="scrape manager" scrape_pool=openshift-monitoring/node-exporter/0 target=https://x.x.x.x:9100/metrics msg="Error on ingesting out-of-order samples" num_dropped=1587
~~~

- Restarting Prometheus pods help, but after a couple of days the alerts came out again. 

- The Prometheus is not backed with any PV. Also, the time is in sync on all the OCP nodes.

Comment 2 Damien Grisonnet 2021-03-11 13:21:18 UTC
This bug is very similar to https://bugzilla.redhat.com/show_bug.cgi?id=1917009. The reporter mentioned that after some time the error logs stopped appearing. Maybe there is a time drift happening at some point and the error appears until it catches up.

Comment 4 Damien Grisonnet 2021-04-07 08:34:19 UTC
Hello Ashwini, could you perhaps try to follow this blog post which explains how to debug out-of-order samples https://www.robustperception.io/debugging-out-of-order-samples?

The most likely reason for this to be happening is that the time on your node jumped backward at some point. The most reasonable way to solve this is either to restart Prometheus to force a resync or wait for the system time to catch back up.

From the blog post:
```
A related potential cause is if the system time goes backwards on the machine running Prometheus. This would show up as widespread out-of-order for all targets that existed both before the time change and afterwards, affecting both scraped series and generated series like up. To check if this is the cause, evaluate timestamp(up) for some target the Prometheus is scraping and see if it is in the future. To fix this you can either wait for the system time to catch back up, or delete the "future" data from Prometheus.
```

Comment 6 Damien Grisonnet 2021-04-08 14:18:58 UTC
Since the errors are reappearing over time there might me something else happening. In order to find what, I will need more information.

Could you please provide me the following data:

1. The logs of the Prometheus instance where we can see the errors with the log level set to `debug`. https://docs.openshift.com/container-platform/4.7/monitoring/configuring-the-monitoring-stack.html#setting-log-levels-for-monitoring-components_configuring-the-monitoring-stack

2. The sos-report of the node where the problematic instance of Prometheus is running.

3. The sos-report of one of the node for which metrics are reported to arrive out-of-order in the Prometheus log. The node name should be visible in the Prometheus logs once you run it with the debug log level.

Comment 10 Miroslav Lichvar 2021-04-15 15:10:13 UTC
Any details on the NTP configuration, like what servers is the client using, how they are synchronized, are there any virtual machines involved, etc?

The "Forward time jump detected" message indicates that something else is messing with the clock, or the machine was suspended/resumed/migrated.

Are there any "System clock wrong by" messages?

Comment 16 Jens Reimann 2021-05-26 07:51:19 UTC
I am having the same problem, starting around OCP 4.6.x … it still drags on to OCP 4.7.x.

For me, I am running OCP inside of VMs, on top of RHEL 8.x. The hosts have a default configuration with Chrony, and the state looks good (to me):

~~~
Reference ID    : 81468422 (stratum2-1.NTP.TechFak.NET)
Stratum         : 3
Ref time (UTC)  : Wed May 26 07:41:30 2021
System time     : 0.000042926 seconds slow of NTP time
Last offset     : -0.000008695 seconds
RMS offset      : 0.000111053 seconds
Frequency       : 0.211 ppm fast
Residual freq   : +0.001 ppm
Skew            : 0.026 ppm
Root delay      : 0.031511676 seconds
Root dispersion : 0.002671151 seconds
Update interval : 1029.9 seconds
Leap status     : Normal
~~~

Doing a `dmesg | grep clock` turns up nothing like "clock wrong".

Comment 23 Miroslav Lichvar 2021-09-22 15:01:49 UTC
As this does not seem to be an issue in chrony, I'm closing the bug. Please reopen and/or reassign if you have new information.