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

how to add labels with pushgateway example? #99

Closed
yosefy opened this issue Sep 12, 2016 · 4 comments
Closed

how to add labels with pushgateway example? #99

yosefy opened this issue Sep 12, 2016 · 4 comments

Comments

@yosefy
Copy link

yosefy commented Sep 12, 2016

g.labels says:
object has no attribute 'labels'
thanks

@gbbirkisson
Copy link

Same problem with Counter

@gbbirkisson
Copy link

Ok, the documentation needs updating. I got labels working like this:

from prometheus_client import Counter
c = Counter('my_requests_total', 'HTTP Failures', labelnames=('method', 'endpoint'))
c.labels('get', '/').inc()

@yosefy
Copy link
Author

yosefy commented Sep 20, 2016

yes but how do we set the value of the metrics then?
without adding labels dir(g) gives
['class', 'delattr', 'dict', 'doc', 'format', 'getattribute', 'hash', 'init', 'module', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_reserved_labelnames', '_samples', '_type', '_value', 'collect', 'dec', 'inc', 'set', 'set_function', 'set_to_current_time', 'time', 'track_inprogress']

but after adding labelnames it becomes
['class', 'delattr', 'dict', 'doc', 'format', 'getattribute', 'hash', 'init', 'module', 'new', 'reduce', 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subclasshook', 'weakref', '_kwargs', '_labelnames', '_lock', '_metrics', '_name', '_samples', '_type', '_wrappedClass', 'collect', 'labels', 'remove']

and doesnt have set method anymore

@brian-brazil
Copy link
Contributor

Usage questions are best asked on https://groups.google.com/forum/#!aboutgroup/prometheus-users

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

No branches or pull requests

3 participants