Skip to content

Default otel_span_attrs can't be overriden #100

@zguydev

Description

@zguydev

Describe the bug

The bug is that the default span attrs can't be overriden after they are set.

My case was that I wanted to unset the default nginx span attrs, because they are outdated with modern semconv, which now uses other attr names.
F.e., instead of http.flavor the network.protocol.name should be used, or instead of http.user_agent the user_agent.original should be used and so on.

But after I set the attrs to an empty string (which is the only way to expect the behaviour of unsetting an attr) by using otel_span_attr http.flavor "";, it just adds it as another attr, as seen in Grafana:
Image

To reproduce

Steps to reproduce the behavior:

  1. Deploy default nginx using Docker image nginx:1.28.0-alpine-otel with mounted /etc/nginx/conf.d/otel.conf:
# /etc/nginx/conf.d/otel.conf
otel_exporter {
    endpoint  ${X_OTEL_EXPORTER_ENDPOINT};
}

otel_service_name  nginx;

otel_span_attr  http.flavor "";

otel_trace  on;
  1. Deploy Grafana with Tempo or any other tracing dashboard.
  2. View traces in Grafana, there would be 2 entries of the http.flavor attr.

Expected behavior

It is expected so the http.flavor attr is removed from the span attrs, or so there is at least another way to do so to have full control of the attrs that are set.

Your environment

Docker image: nginx:1.28.0-alpine-otel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions