Docs
Launch GraphOS Studio

OpenTelemetry standard attributes

Attach standard attributes to router telemetry


OpenTelemetry semantic conventions define a set of standard attributes that can be attached to spans. These attributes are used to filter and group data in your application performance monitor (APM).

The attributes available depend on the service of the pipeline.

For example, set the standard attribute http.response.status_code on the router span:

router.yaml
telemetry:
instrumentation:
spans:
router:
attributes:
# Standard attributes
http.response.status_code: true

Attribute configuration reference

The 's request lifecycle has three major services:

  • Router service - Handles an incoming request before it is parsed. Works within a context of opaque bytes.
  • Supergraph service - Handles a request after it has been parsed and before it is sent to the . Works within a context.
  • Subgraph service - Handles a request after it has been sent to the subgraph. Works within a GraphQL context.

Each service supports a unique set of standard attributes.

Router

Standard attributes of the router service:

AttributeValuesDescription
error.typeDescribes a class of error the operation ended with
http.request.body.sizeThe size of the request payload body in bytes
http.request.methodHTTP request method
http.request.method.originalOriginal HTTP method sent by the client in the request line
http.response.body.sizeThe size of the response payload body in bytes
http.response.status_codeHTTP response status code
network.protocol.nameOSI application layer or non-OSI equivalent
network.protocol.versionVersion of the protocol specified in network.protocol.name
network.transportOSI transport layer
network.typeOSI network layer or non-OSI equivalent
user_agent.originalValue of the HTTP User-Agent header sent by the client
client.addressClient address - domain name if available without reverse DNS lookup, otherwise IP address or Unix domain socket name
client.portThe port of the original client behind all proxies, if known (e.g. from Forwarded or a similar header). Otherwise, the immediate client peer port
http.routeThe matched route (path template in the format used by the respective server framework)
network.local.addressLocal socket address. Useful in case of a multi-IP host
network.local.portLocal socket port. Useful in case of a multi-port host
network.peer.addressPeer address of the network connection - IP address or Unix domain socket name
network.peer.portPeer port number of the network connection
server.addressName of the local HTTP server that received the request
server.portPort of the local HTTP server that received the request
url.pathThe URI path component
url.queryThe URI query component
url.schemeThe scheme portion of the URL, such as "https" or "http"

NOTE

The http.request.header.<key> and http.response.header.<key> attributes are not available as standard attributes, but they can be configured using a custom attribute.

For example, to configure an attribute for x-my-header on router spans:

router.yaml
telemetry:
instrumentation:
spans:
router:
attributes:
"http.request.header.x-my-header":
request_header: "x-my-header"

Supergraph

Standard attributes of the supergraph service:

AttributeValuesDescription
graphql.operation.nameThe operation name from the graphql query
graphql.operation.typequery|mutation|subscriptionThe operation kind from the subgraph query
graphql.documentThe GraphQL query to the subgraph

Subgraph

Standard attributes of the subgraph service:

AttributeValuesDescription
subgraph.nameThe name of the subgraph
subgraph.graphql.operation.nameThe operation name from the subgraph query
subgraph.graphql.operation.typequery|mutation|subscriptionThe operation kind from the subgraph query
subgraph.graphql.documentThe GraphQL query to the subgraph
Previous
Selectors
Next
Standard instruments
Edit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company