prometheus-exporter-plugin-for-opensearch icon indicating copy to clipboard operation
prometheus-exporter-plugin-for-opensearch copied to clipboard

Snapshot (management) metrics

Open ginkel opened this issue 1 year ago • 6 comments

Hi there,

we were wondering whether it would make sense to extend the prometheus-exporter-plugin-for-opensearch in such a way that it exports additional metrics about which snapshots have been created, when the last snapshot has been created and so on. The main use-case would be to monitor whether backups are created in a regular fashion (using Snapshot Management), so that disruptions of the snapshot creation can be detected early on using alerts.

Do you think that would make a worthwhile addition to the plugin?

Thanks, Thilo

ginkel avatar Mar 30 '23 12:03 ginkel

Is this metric exposed by OpenSearch itself? If yes then adding it to Prom. exporter would be an easy task. Or are there at least some relevant metrics already exposed by OpenSearch?

lukas-vlcek avatar Mar 30 '23 15:03 lukas-vlcek

One could retrieve the registered repositories using a GetRepositoriesRequest and then obtain details about each snapshot using GetSnapshotsRequest. Exposing a time series per snapshot could be tricky (metrics inflation), so one could limit the number of observed snapshots to the n latest. If a snapshot has been created by a Snapshot Management Policy this is indicated using the sm_policy metadata attribute, which one could group the metrics by (to just expose the metrics of the last snapshot created by the policy).

In the REST API this maps to:

GET _snapshot

GET _snapshot/<repo_name>/_all

ginkel avatar Apr 03 '23 13:04 ginkel

Agreed, would be nice to have :)

sandervandegeijn avatar Sep 28 '23 20:09 sandervandegeijn

@lukas-vlcek I would like to take this up, we are implementing something similar in our forked repo, so we can contribute back the same. Please let me know if we still plan to add snapshot related metrics

patelsmit32123 avatar Aug 08 '24 20:08 patelsmit32123

@patelsmit32123 I would love to take a look at any PR :-)

lukas-vlcek avatar Aug 09 '24 08:08 lukas-vlcek

@lukas-vlcek PTAL at #295, I have tested them on our staging env, seems to be working fine.

patelsmit32123 avatar Aug 09 '24 09:08 patelsmit32123