Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-17276

Use fixed rate instead of fixed delay in prometheus-exporter

Details

    Description

      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).

      It's result of using scheduler.scheduleWithFixedDelay 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.

      Attachments

        1. image-2024-05-06-18-10-30-739.png
          76 kB
          Rafał Harabień

        Issue Links

          Activity

            Commit 759b94fcae81ef00ed245142c0ef513814930ab4 in solr's branch refs/heads/main from Rafał Harabień
            [ https://gitbox.apache.org/repos/asf?p=solr.git;h=759b94fcae8 ]

            SOLR-17276: Prometheus Exporter: scrape metrics at fixed rate (#2442)

            jira-bot ASF subversion and git services added a comment - Commit 759b94fcae81ef00ed245142c0ef513814930ab4 in solr's branch refs/heads/main from Rafał Harabień [ https://gitbox.apache.org/repos/asf?p=solr.git;h=759b94fcae8 ] SOLR-17276 : Prometheus Exporter: scrape metrics at fixed rate (#2442)

            Commit 5fc16da9089eafc5e635d1f94de4317a4ad3ae38 in solr's branch refs/heads/branch_9x from Rafał Harabień
            [ https://gitbox.apache.org/repos/asf?p=solr.git;h=5fc16da9089 ]

            SOLR-17276: Prometheus Exporter: scrape metrics at fixed rate (#2442)

            (cherry picked from commit 759b94fcae81ef00ed245142c0ef513814930ab4)

            jira-bot ASF subversion and git services added a comment - Commit 5fc16da9089eafc5e635d1f94de4317a4ad3ae38 in solr's branch refs/heads/branch_9x from Rafał Harabień [ https://gitbox.apache.org/repos/asf?p=solr.git;h=5fc16da9089 ] SOLR-17276 : Prometheus Exporter: scrape metrics at fixed rate (#2442) (cherry picked from commit 759b94fcae81ef00ed245142c0ef513814930ab4)
            dsmiley David Smiley added a comment -

            Thanks for contributing Rafal!

            dsmiley David Smiley added a comment - Thanks for contributing Rafal!
            anshum Anshum Gupta added a comment -

            Closing after the 9.7.0 release

            anshum Anshum Gupta added a comment - Closing after the 9.7.0 release

            People

              Unassigned Unassigned
              rafalh Rafał Harabień
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h