-
Notifications
You must be signed in to change notification settings - Fork 814
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
[memcached] Additional stats metrics #2491
Conversation
Memcached CI is failing on a coverage issue, it's probably legitimate. https://travis-ci.org/DataDog/dd-agent/jobs/129498510 |
A few confirmations/nitpicks:
Looks good otherwise. For the feature flag question, I'd say that if it was possible to regroup the optional metrics by type, it would be then possible to hide each type behind one feature flag. But I don't know really know memcached, so it may not be the best idea. |
@degemer the reason I don't re-raise the exception for the optional metrics is precisely to avoid having the optional metrics trigger a failed service check if the default metrics succeed. It felt redundant. In principle, I think the right thing is probably to namespace the metrics, so I will make changes in that direction. We can then revisit and if we don't agree it's better, I'll revert. |
@degemer I'm actually having a bit of a hard-time deciding if I want to make some of those gauges into rates as well.... So I'll take a look at that as well. |
|
||
def _get_optional_metrics(self, client, tags, options=None): | ||
for arg, metrics_args in self.OPTIONAL_STATS.iteritems(): | ||
if not options or options.get(arg, False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be if options and options.get(arg, False)
? (default: no optional metrics ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@degemer Not really, I supposed that if you called the method without setting the options
dict, then you wanted all options
(otherwise you wouldn't call the _get_optional_metrics()
method). On the other hand if you do set the options
dict, then only collect what is set to True
there.
I enforce the logic you're thinking about in check()
where we only call _get_optional_metrics()
if options
are set in the YAML.
Let me know if you disagree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense, and the default of options
is {}
anyway, so 👍
LGTM apart from the small remarks. One question though: why didn't you enable |
@degemer because I forgot... lol |
Feel free to merge once the CI is 💚 |
[memcached] define optional_metrics paramenter in config file. [memcached] fixing up metric namespace - prepend with argument. [memcached] adding slabs optional metrics. [memcached] updating metric types, adding tests. [memcached] get coverage report for tests.
a802bdf
to
0674b1c
Compare
Why
This PR adds support for memcached "items" statistics as reported by
stats items
. It also attempts to simplify the inclusion of additional optional metrics. To do so, it introduces a map ofstats
arguments (ie. items) to a list of rate metrics, gauge metrics, and if needed a raw stat output handler.In the particular case of the items statistics, we need an output handler because we need to parse the raw key value (with form "items:<slab_id>:<metric_name>" to extract the
<slab_id>
and actual metric name. The actual value remains untouched - no need to operate over it. We can then use theslab_id
to tag the relevant metrics. All handlers are expected to return a tuple of metric_name, tags, and actual value.Enabling optional metrics requires configuring the
optional_metrics
flag in the memcached yaml.Open Questions
<stats_arg>
.<metric_name>
- yes? no?Reference
https://github.com/memcached/memcached/blob/master/doc/protocol.txt