Hi <#C01HWQ1R0BC|> I'm running a NestJS applicati...
# support
u
Hi #C01HWQ1R0BC I'm running a NestJS application on Kubernetes with OpenTelemetry Operator. I'm using the Instrumentation CRD to inject the Node.js auto-instrumentation SDK, and traces are being collected successfully. However, I noticed that the root span of my HTTP requests does not include the
http.route
attribute. Other HTTP-related attributes like
http.target
are present, but
http.route
is always missing. Has anyone experienced a similar issue, or is there something additional I need to configure to get
http.route
on the root span when using auto-instrumentation with NestJS? Here is my Instrumentation CR
Copy code
apiVersion: <http://opentelemetry.io/v1alpha1|opentelemetry.io/v1alpha1>
kind: Instrumentation
metadata:
  name: backend-js-instrumentation
  namespace: backend
spec:
  exporter:
    endpoint: <http://alloy.observability.svc.cluster.local:4317>
  propagators:
    - tracecontext
    - baggage
  sampler:
    type: parentbased_traceidratio
    argument: "1.0"

  nodejs:
    env:
      - name: OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED
        value: "true"
      - name: OTEL_EXPORTER_OTLP_PROTOCOL
        value: "grpc"
      - name: OTEL_LOGS_EXPORTER
        value: "otlp"
      - name: OTEL_METRICS_EXPORTER
        value: "otlp"
      - name: OTEL_TRACES_EXPORTER
        value: "otlp"
      - name: OTEL_EXPORTER_OTLP_ENDPOINT
        value: "<http://alloy.observability.svc.cluster.local:4317>"
j
u
So I enabled OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED to temporarily enable all instrumentation.
j
I’m not entirely sure about nextjs. According to the nextjs documentation, next.route is the default span. https://nextjs.org/docs/app/guides/open-telemetry#default-spans-in-nextjs If next.route is properly instrumented, conversion is necessary. If not, a library might need to be added.
u
we’re not using Next.js—our app is built with Express + NestJS. Currently, the root SERVER span lacks the http.route attribute, while the Express spans have it.
h
The NestJS auto-instr adds that attribute, but only when emitting the NestJS span. You can also see it adds a common component attribute to its spans. I don't see that
component
attribute on my root span, so I'm guessing the root span is not created by the NestJs instrumentation.