Skip to content

fix(tracing): omit http.route span attribute when route has no paths#14852

Open
officialasishkumar wants to merge 1 commit intoKong:masterfrom
officialasishkumar:fix/tracing-omit-empty-http-route
Open

fix(tracing): omit http.route span attribute when route has no paths#14852
officialasishkumar wants to merge 1 commit intoKong:masterfrom
officialasishkumar:fix/tracing-omit-empty-http-route

Conversation

@officialasishkumar
Copy link
Copy Markdown

Summary

Per the OpenTelemetry semantic conventions, the http.route attribute must not be set on the span when the route is not known. Previously, Kong emitted an empty string as the value of http.route when the matched route had no paths defined (e.g., host-only routes), violating the specification.

This change makes http.route only be set when the route has an actual path value. When no path is available, the attribute is omitted entirely.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/developer.konghq.com - N/A (internal behavioral fix to match existing OTel spec)

Issue reference

Fix #14845

Per the OpenTelemetry semantic conventions, the `http.route` attribute
must not be set on the span when the route is not known. Previously,
Kong emitted an empty string as the value of `http.route` when the
matched route had no paths defined, violating the specification.

Only set the `http.route` attribute when the route has an actual path
value, and add a regression test to verify the attribute is omitted
for host-only routes.

Fix Kong#14845

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kong should not emit an empty string as value of http.route

2 participants