-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[nginx] Better process status output for good metric names #1053
Conversation
38c6734
to
e987823
Compare
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.
Can you please explain further exactly what metrics are are being deprecated/removed? Are you saying metrics were previously being sent with tags inside them?
nginx/datadog_checks/nginx/nginx.py
Outdated
metric_name = '%s.%s' % (metric_base, key) | ||
output.extend(cls._flatten_json(metric_name, parsed[key], tags)) | ||
output = [] | ||
output.extend(cls._flatten_json(metric_base, parsed, tags)) |
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.
You can just put return cls._flatten_json(metric_base, parsed, tags)
.
if key in TAGGED_KEYS: | ||
metric_name = '%s.%s' % (metric_base, TAGGED_KEYS[key]) | ||
for tag_val, data in val2.iteritems(): | ||
tag = '%s:%s' % (TAGGED_KEYS[key], tag_val) |
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.
I'd say instead tags.append('%s:%s' % (TAGGED_KEYS[key], tag_val))
.
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.
After seeing the tests fail miserably, I remembered why it was like this. I can't append to the tags
list because I am in a for loop, and tags
is a reference to the list. So I have to do like this to avoid having the tags of a metric being sent with the metrics of all the subsequent loops.
metric_name = '%s.%s' % (metric_base, TAGGED_KEYS[key]) | ||
for tag_val, data in val2.iteritems(): | ||
tag = '%s:%s' % (TAGGED_KEYS[key], tag_val) | ||
output.extend(cls._flatten_json(metric_name, data, tags + [tag])) |
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.
Based on the above change, just pass tags
.
e987823
to
c20156e
Compare
The metrics that are deprecated are the metrics prefixed with e.g. there was a metric for I hope I am being clear. |
c20156e
to
09b5267
Compare
Thanks for explaining! |
What does this PR do?
With this PR, the output of the status page is better processed so that
streams
andslabs
metrics are correctly named and tagged. Also update themetadata.csv
file to add all the missing metrics.Motivation
What inspired you to submit this pull request?
Testing Guidelines
An overview on testing
is available in our contribution guidelines.
Versioning
manifest.json
datadog_checks/{integration}/__init__.py
CHANGELOG.md
. Please useUnreleased
as the date in the titlefor the new section.
Additional Notes
This is a major version change and is breaking for orgs that use the badly named metrics in dashboards or monitor since the names will change with this PR and the old names won't be sent anymore. We need to notify them.