The Guild LogoThe Guild Monogram

Search docs

Search icon

Products by The Guild

Products

Hive logoHive blurred logo

Hive

Schema Registry for your GraphQL Workflows

Envelop Logo

Envelop

Get Started

Plugin Hub > useOpenTelemetry

yarn add @envelop/opentelemetry

@envelop/opentelemetry#

This plugins integrates Open Telemetry tracing with your GraphQL execution. It also collects GraphQL execution errors and reports it as Exceptions.

You can use this plugin with any kind of Open Telemetry tracer, and integrate it to any tracing/metric platform that supports this standard.

Getting Started#

yarn add @envelop/opentelemetry

Usage Example#

By default, this plugin prints the collected telemetry to the console:

import { envelop } from '@envelop/core'; import { useOpenTelemetry } from '@envelop/opentelemetry'; const getEnveloped = envelop({ plugins: [ // ... other plugins ... useOpenTelemetry({ resolvers: true, // Tracks resolvers calls, and tracks resolvers thrown errors variables: true, // Includes the operation variables values as part of the metadata collected result: true, // Includes execution result object as part of the metadata collected }), ], });

If you wish to use custom tracer/exporter, create it and pass it. This example integrates Jaeger tracer:

import { envelop } from '@envelop/core'; import { useOpenTelemetry } from '@envelop/opentelemetry'; import { JaegerExporter } from '@opentelemetry/exporter-jaeger'; import { SimpleSpanProcessor, BasicTracerProvider } from '@opentelemetry/tracing'; const exporter = new JaegerExporter({ serviceName: 'my-service-name', }); const provider = new BasicTracerProvider(); provider.addSpanProcessor(new SimpleSpanProcessor(exporter)); provider.register(); const getEnveloped = envelop({ plugins: [ // ... other plugins ... useOpenTelemetry( { resolvers: true, // Tracks resolvers calls, and tracks resolvers thrown errors variables: true, // Includes the operation variables values as part of the metadata collected result: true, // Includes execution result object as part of the metadata collected }, provider ), ], });

Plugin Details