Back to Node Newrelic

Segments and Spans

documentation/apollo-server/segments-and-spans.md

14.0.02.8 KB
Original Source

Segments and Spans

Segments and spans (when Distributed Tracing enabled) are captured for GraphQL operations, field resolution and additional work (when instrumented) that occurs as a part of field resolution such as making a query to a database.

Operation Segments/Spans

/GraphQL/operation/ApolloServer/[operation-type]/[operation-name]/[deepest-unique-path]

Operation segments/spans include the operation type, operation name and deepest unique path. These represent the individual duration and attributes of a specific invocation within a transaction or trace.

For more details on the parts, see the transactions page.

Attributes

NameDescriptionDefault
graphql.operation.typequery or mutationincluded
graphql.operation.nameName given to the operation or anonymousincluded
graphql.operation.queryThe original GraphQL query with arguments obfuscatedincluded

To exclude capture of the query attribute (or any attribute), the attribute name will need to be added to the 'attributes' exclude list or segment/span attributes exclude lists individually.

For more information on including/excluding attributes, please see the attributes documentation.

Field Resolve Segments/Spans

/GraphQL/resolve/ApolloServer/[path]

Resolve segments/spans leverage the resolution path of the individual field to best differentiate within a given trace or transaction. For example, libraries.books might be used instead of just books. These represent the individual duration and attributes of a specific field being resolved as a part of the GraphQL operation.

Attributes

NameDescriptionDefault
graphql.field.nameName of the resolved fieldincluded
graphql.field.returnTypeReturn type (Book!, [String], etc. ) of the resolved fieldincluded
graphql.field.parentTypeType of the parent of this field ([Book])included
graphql.field.pathFull resolve path of the field (libraries.books)included
graphql.field.argsArg passed to the GraphQL query or mutation for this resolver captured as key/value pairsexcluded

To include capture of args attributes, graphql.field.args.* (to capture all) will need to be added to the 'attributes' include list or segment/span attributes include lists individually.

For more information on including/excluding attributes, please see the attributes documentation.