Skip to content

Docs: Mention that datadog metric tags replace default_tags #2990

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

Closed
1 task done
ecokes opened this issue Aug 23, 2023 · 9 comments · Fixed by #2997
Closed
1 task done

Docs: Mention that datadog metric tags replace default_tags #2990

ecokes opened this issue Aug 23, 2023 · 9 comments · Fixed by #2997
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation metrics

Comments

@ecokes
Copy link

ecokes commented Aug 23, 2023

What were you searching in the docs?

First off, I've been enjoying this library and I think the docs are pretty great overall.

I did have one point of confusion I wanted to clarify. I've been using the DatadogMetrics class, (using this section of the docs) to add tags to metrics. I was surprised to find that adding tags in the add_metric method like this:

metrics.add_metric(name="SuccessfulBooking", value=1, tag2="bar", tag3="baz")

results in any default tags that were added to the metrics class, like this:

metrics.set_default_tags(tag1="foo")

getting removed from the metric. I assumed that default tags and additional one off tags would be combined in that case, so that the metric would end up as:

{
    "m": "SuccessfulBooking",
    "v": 1,
    "e": 1692736997,
    "t": [
        "tag1:foo",
        "tag2:bar",
        "tag3:baz"
    ]
}

However, the metric instead comes out as:

{
    "m": "SuccessfulBooking",
    "v": 1,
    "e": 1692736997,
    "t": [
        "tag2:bar",
        "tag3:baz"
    ]
}

I assumed I had configured something wrong for awhile, until I found this section of the code. So it looks like that's the intended behavior, but it would be helpful to add a line in the docs identifying that default_tags and metric tags are one or the other, not additive.

Is this related to an existing documentation section?

https://docs.powertools.aws.dev/lambda/python/latest/core/metrics/datadog/#adding-tags

How can we improve?

Mention that metric tags overwrite default tags instead of being appended.

Got a suggestion in mind?

No response

Acknowledgment

  • I understand the final update might be different from my proposed suggestion, or refused.
@ecokes ecokes added documentation Improvements or additions to documentation triage Pending triage from maintainers labels Aug 23, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 23, 2023

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@ecokes ecokes changed the title Docs: TITLE Docs: Mention that datadog metric tags replace default_tags Aug 23, 2023
@heitorlessa
Copy link
Contributor

@leandrodamascena i thought they are additive too?

except when they're not unique (explicit override vs default)

@ecokes let's wait for Leandro. I suspect this is a bug in the example you provided but maybe Leandro or @roger-zhangg identified a problem I'm unaware

@heitorlessa
Copy link
Contributor

heitorlessa commented Aug 23, 2023 via email

@ecokes
Copy link
Author

ecokes commented Aug 23, 2023

@heitorlessa Thanks for taking a look, I was wondering if it might be a bug myself.

@heitorlessa heitorlessa added bug Something isn't working metrics and removed triage Pending triage from maintainers labels Aug 23, 2023
@leandrodamascena
Copy link
Contributor

Hello @ecokes! Thanks for reporting this. I'm working on submitting a fix for this.

We usually release new versions on Friday, but if it's too critical for you at this moment, we can release a patch release tomorrow. Please let me know what you prefer :)

Thanks

@ecokes
Copy link
Author

ecokes commented Aug 23, 2023

@leandrodamascena, Friday is fine with me, thanks for fixing it so quickly!

@leandrodamascena
Copy link
Contributor

Hei @ecokes! We fixed the problem in the PR #2997.

@leandrodamascena leandrodamascena moved this from Triage to Working on it in Powertools for AWS Lambda (Python) Aug 24, 2023
@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in Powertools for AWS Lambda (Python) Aug 24, 2023
@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot added the pending-release Fix or implementation already in dev waiting to be released label Aug 24, 2023
@github-actions
Copy link
Contributor

This is now released under 2.23.1 version!

@github-actions github-actions bot removed the pending-release Fix or implementation already in dev waiting to be released label Aug 25, 2023
@leandrodamascena leandrodamascena moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation metrics
Projects
Status: Shipped
Development

Successfully merging a pull request may close this issue.

3 participants