Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instrumented collectors #169

Merged

Conversation

stefanotorresi
Copy link
Member

@stefanotorresi stefanotorresi commented Jul 10, 2020

This PR adds instrumentation to the exporter itself by introducing a new interface for the existing collectors, called InstrumentableCollector, and wrapping these in a new InstrumentedCollector concrete implementation, which adds the following two metrics to each collector, using a constant label (i.e. a label that never changes in a time series):

# HELP ha_cluster_scrape_duration_seconds Duration of a collector scrape.
# TYPE ha_cluster_scrape_duration_seconds gauge
ha_cluster_scrape_duration_seconds{collector="foo"} 1.234
# HELP ha_cluster_scrape_success Whether a collector succeeded.
# TYPE ha_cluster_scrape_success gauge
ha_cluster_scrape_success{collector="foo"} 1

These metrics take inspiration from node_exporter.

Some significant refactoring was contextually performed to the main run() function, to add some test coverage to it.

Closes #159

Copy link
Member

@diegoakechi diegoakechi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @stefanotorresi !!

@stefanotorresi stefanotorresi merged commit 0af48bf into ClusterLabs:master Jul 13, 2020
@stefanotorresi stefanotorresi deleted the feature/instrumented-collectors branch July 13, 2020 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement per-collector scrape_success metrics.
2 participants