-
Notifications
You must be signed in to change notification settings - Fork 45
Metric Tags with Multiple Values when Tag Keys match Function Tags #550
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
Comments
Hey @jodylent, thanks for the detailed report. You've got a super interesting use case and we'll be happy to explore solutions with you. From the information you have shared, this is my understanding of how your metrics are being submitted and processed. In your lambda function you are calling Ideally, I think the best solution here is to use configuration options that already exist, rather than creating new ones. The tagging behavior as you've described it is not a bug, but is by design. Therefore, we need to find a solution that will ignore/remove specific tag values from your custom metrics. Exclude tags from UI: From the Metrics Summary page, when you click on any of the metrics you need to amend, you'll see a list at the bottom of all the tags available. If you click "Manage Tags", you'll see the following dialog. ![]() From here, try excluding the tags you do not want. I do not think this will backfill your metrics, but will drop the unwanted tags going forward. The drawback with this configuration method is it requires an all or nothing approach to tags. It does not allow you to drop tag values but instead drops an entire tag set (including all of its values). |
Removed the More Context
Possible Solutions
|
@jodylent could you try this with |
Same experiment, same result. I think this is a feature, rather than a bug, as purple4reina suggested
My conclusion is that if one needs control over the exact Tags on a given set of Metric points from a Function, one needs to send them directly, rather than use the wrapper or the extension. Assuming we agree, we can close this issue (though it might be worthwhile to note the edge case in docs... somewhere?) |
Hey @jodylent two new ideas for you. First and maybe easiest, instead of using the If you'd prefer to keep the metric aggregation and not have to add the new dependency to your function, I believe you should be able to edit the tags list on the aggregator directly. Manually create your own import time
from datadog_lambda.thread_stats_writer import ThreadStatsWriter
stats = ThreadStatsWriter()
stats.thread_stats.constant_tags.clear()
def handler(event, context):
stats.distribution('rey.kittens', 1, tags['color:purple'], timestamp=time.time()) As you're testing these things, let me know how they work out for you and what you ultimately decide to go for. We'd love to be able to help other customers facing this same situation. |
Hey @jodylent, hope these solutions worked out for you. Would love to hear which you chose and how it's going for you. I'm closing this issue for now, but you're more than welcome to reopen it. |
Context
We have a small number of Lambda Functions whose purpose is to instrument third-party applications, sending metrics to Datadog on their behalf. Some of these applications do not have DD integrations, while others do not support custom metrics.
These Functions are tagged in AWS with their own metadata, e.g.
team
,business_unit
, etc. They are not intended to emit that metadata as part of the metrics they produce -- e.g. a Function instrumenting ServiceX would be expected to produce metrics whose tags correspond only to ServiceX.In practice, we see that any AWS Tags on a Function show up as tags on timestamped custom metrics emitted via the Datadog Lambda Layer's
extension_thread_stats
, aThreadStatsWriter
instantiated here.extension_thread_stats
linked above. (Details of the emit/flush code paths for which happen to be in Lossiness submitting timestamped custom metrics #514)Expected Behavior
foo=bar
andbaz=quux
Actual Behavior
foo=bar
andbaz=quux
baz=custom_val
as abovebaz=custom_val,quux
A detailed example follows in the reproduction below
Steps to Reproduce the Problem
For the sake of clarity, I've sanitized out the business logic, and used a simple test:
test_tag_key=from_tags
test_tag_key
with the valuefrom_code
test_tag_key
, to establish that something injects the Function Tag's valuetags=["test_tag_key:from_code", ...]
Function Handler (collapsed)
Specifications
arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Python310:104
)arn:aws:lambda:us-east-1:464622532012:layer:Datadog-Extension:67
)Stacktrace
If only.
The text was updated successfully, but these errors were encountered: