Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Get explodes when underlying metric is composite #83

Open
Bachmann1234 opened this issue Feb 28, 2015 · 4 comments
Open

Get explodes when underlying metric is composite #83

Bachmann1234 opened this issue Feb 28, 2015 · 4 comments
Assignees

Comments

@Bachmann1234
Copy link
Contributor

Howdy!

So when I make call to get

b = self.conn.get('SuperSecret-metric-name')

I get the following exception

'The server sent me something that is not a Gauge nor a Counter.'

What is going on is the metric being returned is a composite metric.

In fact with this commit I get something that works

Bachmann1234@e35bcd4

Now, normally I would just make a PR about this and call it a day. But, I do not wanna do that here. Because this would make the get method return an object in some cases and a dict in other cases. Which seems bad.

I saw that basic composite support was added in #79

You chose not to make an object. Was this just the easiest thing at the time? In short... would it be a problem if I made a composite object and had get return that?

If I do that could I change get_composite to return the object instead of the raw response dict?

Also, where can I read more about these? My initial poking around did not find too much detail.

@Bachmann1234
Copy link
Contributor Author

@jderrett
Copy link
Contributor

@Bachmann1234 sorry I haven't had a chance to move forward on this. To answer your question, yes, #79 was to get the easiest thing done which is why I did not pollute the get() method (yet). I think if get returned a composite object that would be great, but I agree it shouldn't return the raw dict. Hopefully we'll have some bandwidth to devote to this soon. Thanks!

@drio
Copy link
Contributor

drio commented Apr 23, 2015

You bring a good point @Bachmann1234, thanks.

Composite metrics are a little bit peculiar and I would advice modeling them with basic data structures. Is there any particular pain we would fix if we model composite responses with objects ?

@Bachmann1234
Copy link
Contributor Author

@drio nah. If using the dict is better for you go ahead. I was raising it for consistency reasons. Either having all dicts or all objects.

I was mostly playing around our metrics trying to make a report back when I was playing in this area of the library. Nothing mission critical.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants