Skip to content

feat: add tags to config#29

Merged
apiarian-datadog merged 5 commits intomainfrom
aleksandr.pasechnik/serverless-function-trace-tags
Jul 17, 2025
Merged

feat: add tags to config#29
apiarian-datadog merged 5 commits intomainfrom
aleksandr.pasechnik/serverless-function-trace-tags

Conversation

@apiarian-datadog
Copy link
Copy Markdown
Contributor

What does this PR do?

Adding function tags for traces processed by the the datadog-trace-agent.

Trace metrics don't have these tags yet (are they computed in the tracer for serverless-components?)

Motivation

This will allow the backend to index traces by these trace tags, enabling trace search queries like tag_name:value rather than @tag_name:value (the latter would search for span meta attributes instead).

Additional Notes

This has previously been implemented in the datadog-lambda-extension bottlecap agent and the serverless-init build of the datadog-agent.

Describe how to test/QA your changes

Added unit tests. Also deployed to a test app to confirm that these function trace tags are being added and result in searchable traces.

Copy link
Copy Markdown
Collaborator

@duncanpharvey duncanpharvey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up on @lucaspimentel's comment around comma and space separation - I think we should handle both cases. See below for an example implementation in the Node Tracer:

Convert space separation to comma separation: https://github.com/DataDog/dd-trace-js/blob/99e7bb4b0977de2daf85f0ddf9af5b3d420bb0db/packages/dd-trace/src/config.js#L827

Then parse comma separated tags: https://github.com/DataDog/dd-trace-js/blob/99e7bb4b0977de2daf85f0ddf9af5b3d420bb0db/packages/dd-trace/src/tagger.js#L26

Otherwise the comma separated tags work as expected DD_TAGS = "tagkey1:tagval1,tagkey2:tagval2" except in the case of filtering in the live trace view.

Screenshot 2025-07-16 at 1 40 08 PM Screenshot 2025-07-16 at 1 40 18 PM

@apiarian-datadog
Copy link
Copy Markdown
Contributor Author

thanks @duncanpharvey! the lack of tag query in the live view is expected since the tags aren't applied to the traces a that point in our backend systems.

i've added space-separated tag support as well.

@apiarian-datadog apiarian-datadog force-pushed the aleksandr.pasechnik/serverless-function-trace-tags branch from 0462c35 to e9d49db Compare July 17, 2025 01:31
@apiarian-datadog apiarian-datadog merged commit 6949dbc into main Jul 17, 2025
26 checks passed
@apiarian-datadog apiarian-datadog deleted the aleksandr.pasechnik/serverless-function-trace-tags branch July 17, 2025 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants