Gauge has no members {

169 views
Skip to first unread message

Tommy Carman

unread,
Sep 15, 2017, 4:57:12 PM9/15/17
to promethe...@googlegroups.com
Hello, I'm trying to run the Gauge from python 3 like this:

g = Gauge(metric, "test", "tests")
g.labels('value0').set(serviceinforesult[item])

But intellisense says "Instance of Gauge has no 'labels' member".

So when I take the labels off and run it like this:

g = Gauge(metric, "test", "tests")
g.set(serviceinforesult[item])

it throws "AttributeError: '_LabelWrapper' object has no attribute 'set'"


What am I doing wrong?


-Tommy


This email and any files transmitted with it are confidential. If you have received this email in error please delete it immediately. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of DHI. Finally, this email and attachments have been scanned for viruses; however, DHI Computing Service accepts no liability for any damage caused by any virus transmitted by this email.

Conor Broderick

unread,
Sep 18, 2017, 6:17:50 AM9/18/17
to Tommy Carman, Prometheus Users
What version of the Python client are you using ? 
 
 g = Gauge(metric, "test", "tests")
 g.labels('value0').set(serviceinforesult[item])

I believe you need to pass in the 3rd argument to the Gauge constructor as a list:

 g = Gauge(metric, "test", ["tests"])
 g.labels('value0').set(serviceinforesult[item])


Assuming metric and serviceinforesult[item] are all valid, the above should work.






--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5e3e14e3-7a4a-53cf-37ce-93543d2fb5b4%40goldpointsystems.com.
For more options, visit https://groups.google.com/d/optout.



--

Tommy Carman

unread,
Sep 18, 2017, 11:07:47 AM9/18/17
to Conor Broderick, Prometheus Users

That did not help, I got the same error. I'm using Python 3.6. I have my code written the in the second form that I mentioned. I don't care about labeling at the moment, I'm just trying to get my data to write out with Gauge. I can provide more of my code if needed.

 g = Gauge(metric, "test", ["tests"])
 g.set(serviceinforesult[item])

it still throws "AttributeError: '_LabelWrapper' object has no attribute 'set'"

Conor Broderick

unread,
Sep 18, 2017, 1:09:01 PM9/18/17
to Tommy Carman, Prometheus Users
Try:

 g = Gauge(metric, "test")
 g.set(serviceinforesult[item])

See the docs on Gauges using the Python client for more info and examples.
--

Tommy Carman

unread,
Sep 18, 2017, 5:14:31 PM9/18/17
to Conor Broderick, Prometheus Users

Didn't work. Intellisense says "no value for argument 'labelvalues' in construct or call."

revel...@gmail.com

unread,
Feb 20, 2018, 11:22:56 AM2/20/18
to Prometheus Users
Did you ever solve this, I'm facing something that I believe to be the same issue...
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.



--
Conor Broderick

This email and any files transmitted with it are confidential. If you have received this email in error please delete it immediately. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of DHI. Finally, this email and attachments have been scanned for viruses; however, DHI Computing Service accepts no liability for any damage caused by any virus transmitted by this email.




--
Conor Broderick
Reply all
Reply to author
Forward
0 new messages