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

WIP: add labeling support for exported scrape jobs #370

Closed
wants to merge 1 commit into from

Conversation

anarcat
Copy link

@anarcat anarcat commented Sep 20, 2019

Pull Request (PR) description

The previous work to collect scrape jobs (#304) was a good start, but
it really becomes powerful when you can select certain labels to apply
on the exporters.

For example, I use this to export the node roles' in the prometheus
metrics, which allows me to regroup results by role instead of by node:

    scrape_job_labels => {
      'classes' => join(lookup('classes', Data, 'first', []), ',')
    },

This is WIP because it probably needs docs strings and tests, although I'm not sure about the latter.

The previous work to collect scrape jobs (voxpupuli#304) was a good start, but
it really becomes powerful when you can select certain labels to apply
on the exporters.

For example, I use this to export the node roles' in the prometheus
metrics, which allows me to regroup results by role instead of by node.
@anarcat anarcat changed the title add labeling support for exported scrape jobs WIP: add labeling support for exported scrape jobs Sep 20, 2019
@@ -103,6 +103,7 @@
Boolean $export_scrape_job = false,
Stdlib::Port $scrape_port = 9117,
String[1] $scrape_job_name = 'apache',
Optional[Hash] $scrape_job_labels = {},
Copy link
Member

Choose a reason for hiding this comment

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

any chance to enforce the type in the hash? Also it doesn't need to be optional, if the default is an empty hash.

Copy link
Author

Choose a reason for hiding this comment

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

i guess it's something like label = { foo: bar, ...}, so how is that expressed in a type?

@bastelfreak bastelfreak added enhancement New feature or request needs-work not ready to merge just yet labels Sep 23, 2019
@pccibot
Copy link

pccibot commented Sep 23, 2019

Dear @anarcat, thanks for the PR!

This is pccibot, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase?

You can find my sourcecode at voxpupuli/vox-pupuli-tasks

1 similar comment
@pccibot
Copy link

pccibot commented Sep 23, 2019

Dear @anarcat, thanks for the PR!

This is pccibot, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase?

You can find my sourcecode at voxpupuli/vox-pupuli-tasks

@alexjfisher
Copy link
Member

@anarcat Hi! Only just spotted this PR. Sorry!! I implemented something very almost identical in #388
I think the only difference is scrape_job_labels defaults to {alias => $scrape_host} instead of being merged with {alias => $scrape_host}.

Many thanks for #304 and apologies for not checking through existing PRs before starting my own.

@anarcat anarcat deleted the scrape-labels branch November 22, 2019 20:52
@anarcat
Copy link
Author

anarcat commented Nov 22, 2019

@alexjfisher i reviewed your changes and i must say: no apologies necessary! :) your patchset looks better than mine and the interface is otherwise identical, which is great.

so no harm done, and thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-work not ready to merge just yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants