Skip to content

Added default registry to write_to_file#39

Closed
barkerd427 wants to merge 1 commit into
prometheus:masterfrom
barkerd427:fix_write_to_file_default_registry
Closed

Added default registry to write_to_file#39
barkerd427 wants to merge 1 commit into
prometheus:masterfrom
barkerd427:fix_write_to_file_default_registry

Conversation

@barkerd427

Copy link
Copy Markdown

@brian-brazil: This is needed to use the default registry with the write_to_file function. I have tested this locally.

@brian-brazil

Copy link
Copy Markdown
Contributor

The push gateway is intended primarily for use by batch and other ephemeral jobs where a limited number of metrics are pushed, thus having all metrices being pushed is not a good default as it is not in line with the prometheus architecture and has pitfalls that aren't obvious to the casual user.

It's still possible for you to do this by hand though as REGISTRY is publically exposed.

@barkerd427

Copy link
Copy Markdown
Author

This is for the node_exporter. It looked like the push gateway was already taking the default registry if none was provided. I'm not familiar enough with python to get it directly. Could you show me and maybe I can add that back for the docs or write a blog post describing my use-case.

@brian-brazil

Copy link
Copy Markdown
Contributor

Hmm, that's a bad default. I should fix that.

The same applies to the textfile collector, but more so as if you've two jobs writing the standard exports to be read it'll break your metrics collection. These examples of how to use this in the README of this repository, but you definitely don't want to use the default registry with write_to_file.

@barkerd427

Copy link
Copy Markdown
Author

I see now. Thanks for the help.

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.

2 participants