Closed devurandom closed 3 months ago
When using the middleware wrap-server-span
, the appropriate setting for create-span?
is dictated by the presence of the OpenTelemetry instrumentation agent:
create-span?
should be set to falsecreate-span?
should be set to trueWhen using the agent, it should be configured as described in the documentation. The operation and configuration of the agent is outside the scope of clj-otel
, as it is not part of the OpenTelemetry API. The agent is responsible for creating server spans for supported HTTP servers. As you have noted, part of the agent configuration specifies which request headers are captured as attributes on the server span. When using the agent, it creates the server span with the desired header attributes, clj-otel
has no control over this.
In your scenario, create-span?
is false and (for correct operation) the application is run with the agent. The agent will create server spans, and the agent configuration specifies which headers are added. clj-otel
has no influence on agent operation.
Currently
steffan-westcott.clj-otel.api.trace.http/wrap-server-span
only usescaptured-request-headers
whencreate-span?
is passed:It would be nice if
wrap-server-span
/steffan-westcott.clj-otel.api.trace.http/wrap-server-request-attrs
would capture the request headers either way. Maybe through some variant ofsteffan-westcott.clj-otel.api.trace.http/server-request-attrs
that does not set all attributes, but do only this last part of it:The alternative is setting the system property
otel.instrumentation.http.server.capture-request-headers
or environment variableOTEL_INSTRUMENTATION_HTTP_SERVER_CAPTURE_REQUEST_HEADERS
that the OpenTelemetry Java Agent understands: https://opentelemetry.io/docs/languages/java/automatic/configuration/#capturing-http-request-and-response-headers