DataDog / kong-plugin-ddtrace

Datadog APM Plugin for Kong Gateway
Apache License 2.0
15 stars 7 forks source link

Can't add custom span traces with dynamic values #21

Closed fsanchezgl closed 5 months ago

fsanchezgl commented 6 months ago

The configuration allows to add custom span tags, with static values. For reference, the JS DD-tracer plugin allows me add custom spans tags to tracer. I would like to include custom trace spans without modifying the provided DDtracer plugin

dgoffredo commented 6 months ago

Hi, Francisco. You refer to "custom trace spans," but based on your proposed feature, what you want are "custom span tags."

A span is a period of time over which an operation occurs (such as processing a request). A span can have zero or more tags, which are key/value pairs of strings.

A trace is a collection of spans that share the same trace ID, where the spans most likely form a tree due to the parent-child relationship that can exist between two spans.

Other Datadog tracers, such as Python's dd-trace-py, support a DD_TAGS environment variable that allows custom tags to be added to spans in the manner you've proposed. There is also DD_TRACE_HEADER_TAGS, allowing such tags to be deduced from incoming request headers.

I'll discuss with the team how best to support the feature you've requested. I suspect there's "the Kong way," and "the Datadog way," and perhaps "the NGINX way." People are on holiday this time of year, so likely we'll revisit this is January 2024.

Thanks for your contribution.

dmehala commented 5 months ago

Hi @fsanchezgl

Thank you for reporting this issue. I wanted to inform you that we recently merged the fix in https://github.com/DataDog/kong-plugin-ddtrace/pull/28. This solution should address the problem you raised, and it will be included in the upcoming release.