Skip to content

opentelemetry: use attributes from semconv registry #3769

Open
@guppy0130

Description

@guppy0130

Feature Request Type

  • Core functionality
  • Alteration (enhancement/optimization) of existing feature(s)
  • New behavior

Description

This blob:

self._operation_name = self.execution_context.operation_name
span_name = (
f"GraphQL Query: {self._operation_name}"
if self._operation_name
else "GraphQL Query"
)
self._span_holder[LifecycleStep.OPERATION] = self._tracer.start_span(
span_name, kind=SpanKind.SERVER
)
self._span_holder[LifecycleStep.OPERATION].set_attribute("component", "graphql")
if self.execution_context.query:
self._span_holder[LifecycleStep.OPERATION].set_attribute(
"query", self.execution_context.query
)

should probably use graphql.document, graphql.operation.name, and graphql.operation.type, as suggested by upstream: https://opentelemetry.io/docs/specs/semconv/attributes-registry/graphql/

it also appears component has been deprecated: open-telemetry/opentelemetry-specification#271

need to know:

  • if a PR from the community to implement this is desirable (happy to do this if so)
  • if the span names need to be unique (i.e., is the operation name in both the span name and graphql.operation.name?)

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