otel_graphql 0.2.0 copy "otel_graphql: ^0.2.0" to clipboard
otel_graphql: ^0.2.0 copied to clipboard

OpenTelemetry instrumentation for the `gql_link` chain behind `package:graphql` and `graphql_flutter`. A Link emitting one span per operation with `graphql.*` semconv attributes.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

0.2.0 - 2026-08-10 #

Changed #

  • Semantic conventions updated to the current OTel registry: deprecated attribute keys are no longer emitted (db.system -> db.system.name, db.operation -> db.operation.name, rpc.system -> rpc.system.name, with rpc.service folded into a fully-qualified rpc.method).
  • Adopted the upstream API's Graphql semconv enum (and GraphqlOperationType values); the package-local GraphqlSemantics enum is deleted. Emitted keys are unchanged (graphql.operation.type, graphql.operation.name, graphql.document — they match the registry exactly).
  • README made vendor-neutral (no backend product names).
  • Dependency floors raised to dartastic_opentelemetry ^1.1.0-beta.12 and dartastic_opentelemetry_api ^1.0.0-rc.1. The previous floors declared compatibility with API versions that predate the semconv enums this package uses and could not actually resolve-and-compile.
  • repository URL corrected to the canonical Dartastic org casing so pub.dev repository verification succeeds.

Added #

  • OTelGraphqlLink — a gql_link Link that emits one span per GraphQL operation. Sets graphql.operation.type, graphql.operation.name, and optionally graphql.document (off by default — documents can leak schema and variable shapes). Span name follows the proposed OTel GraphQL semconv pattern (<type> <name>, e.g. query GetUser).
  • Span lifecycle tracks the Link's response stream — query / mutation spans end right after the response, subscription spans end when the consumer cancels or the server closes.
  • GraphQL errors inside a response flip span status to Error but the stream keeps flowing — partial failures still surface the rest of the data path.
  • Transport errors from downstream links flow through recordException + setStatus(Error) in OTel-spec order, with error.type set from the exception's runtime class.
  • GraphQL variables are never captured — deliberately no option for it (variables routinely carry PII and secrets); documented in the README and API docs. graphql.document capture remains opt-in and off by default.
  • Depends on gql_link + gql_exec (the lightweight abstractions), so the package works for both package:graphql and package:graphql_flutter users.
  • 6 unit tests cover query / mutation / anonymous / GraphQL-error / transport-error / recordDocument paths.
  • example/main.dart — minimal runnable link chain (in-memory terminating link, no server needed).
0
likes
160
points
82
downloads

Documentation

API reference

Publisher

verified publisherdartastic.io

Weekly Downloads

OpenTelemetry instrumentation for the `gql_link` chain behind `package:graphql` and `graphql_flutter`. A Link emitting one span per operation with `graphql.*` semconv attributes.

Homepage
Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

dartastic_opentelemetry, dartastic_opentelemetry_api, gql, gql_exec, gql_link

More

Packages that depend on otel_graphql