Rafał Harabień created SOLR-17276:
-------------------------------------

             Summary: Use fixed rate instead of fixed delay in 
prometheus-exporter
                 Key: SOLR-17276
                 URL: https://issues.apache.org/jira/browse/SOLR-17276
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
          Components: contrib - prometheus-exporter
            Reporter: Rafał Harabień
         Attachments: image-2024-05-06-18-10-30-739.png

Prometheus-exporter is supposed to read metrics from Solr servers every 60 
seconds (scrape interval can be changed using --scrape-interval argument). But 
the truth is it does it every 60+X seconds where X is the time needed to read 
metrics from all Solr servers. In my case X is 1-2 s. If Prometheus scrapes the 
exporter every 60 seconds it can lead to duplicated samples (e.g. metrics will 
stay the same for 2 minutes).

!image-2024-05-06-18-10-30-739.png!

It's result of using 
[scheduler.scheduleWithFixedDelay|https://github.com/apache/solr/blob/2bb2ada0a372f4d101b78df8d43e0fc44c8edbf3/solr/prometheus-exporter/src/java/org/apache/solr/prometheus/collector/SchedulerMetricsCollector.java#L77]
 instead of 
scheduler.scheduleAtFixedRate.

Note: function scheduled with scheduleAtFixedRate can still be started late if 
previous execution has not finished. There is no risk of overlapping executions.

I am going to prepare a PR.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to