GraphQL Debugger Collector
The Collector is an Express App that listens for the traces propagated from the GraphQL API and stores them in a database. It contains endpoints that ingest the schema, traces and spans.
Installation
npm install @graphql-debugger/collector-proxy
Usage
import { Adapter } from "@graphql-debugger/adapter-__YOUR_ADAPTER__";
import { DebuggerClient } from "@graphql-debugger/client";
import { start } from "@graphql-debugger/collector-proxy";
const adapter = new Adapter(); // Your adapter
const client = new DebuggerClient({ adapter });
const { server } = await start({
port: 4318,
client,
});
Endpoints
Schema Endpoint
/v1/schema
Trace Schema will hash and send the schema on startup to the collector. You can also send the schema manually using the endpoint, or the Client. Without a schema, debugger cannot visualize the traces and any exported traces wont be shown in the UI.
Traces Endpoint
/v1/traces
This is a Open Telemetry compatible endpoint that accepts traces in the OTLP HTTP format. This means you can send any traces from any Open Telemetry compatible client to the collector and it will be stored in the database, however, if the traces dont come from GraphQL Debugger, they wont be visualized in the UI.
Each GraphQL Debugger trace attaches a
schemaHash
attribute that reconciles the trace with the schema. ThatschemaHash
is picked up in the traces endpoint and used to associate the trace with the schema.