Skip to content

Client gen template uses incorrect OTel semconv attr http.route #1540

@sahidvelji

Description

@sahidvelji

semconv.HTTPRouteKey.String({{ quote $op.Spec.Path }}),

Both the generated server and client code use the http.route attribute. However, the generated client code incorrectly uses the OTel attribute http.route. This attribute is meant to be used only in server-side metrics and spans. The corresponding client attribute should be used instead, which is url.template.

So, the referenced line of code should instead be:

- semconv.HTTPRouteKey.String({{ quote $op.Spec.Path }}),
+ semconv.URLTemplateKey.String({{ quote $op.Spec.Path }}),

See the following:

Note: it looks like the url.template attribute was added after the client code referenced was written. So, while it may have potentially made sense to use http.route at the time, we should update it to reflect the current OpenTelemetry semantic conventions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: genGenerator issuesbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions