This is a tracing class:
import { ZipkinExporter } from '@opentelemetry/exporter-zipkin';
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
import { GraphQLInstrumentation } from '@opentelemetry/instrumentation-graphql';
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
import { NodeTracerProvider } from '@opentelemetry/node';
import { Resource } from '@opentelemetry/resources';
import { BatchSpanProcessor } from '@opentelemetry/tracing';
const register = () => {
registerInstrumentations({
instrumentations: [
new HttpInstrumentation(),
new ExpressInstrumentation(),
new GraphQLInstrumentation({
depth: 10,
allowValues: true,
mergeItems: true,
}),
],
});
const provider = new NodeTracerProvider({
resource: Resource.default().merge(
new Resource({
'service.name': 'survey-service',
}),
),
});
const zipkinExporter = new ZipkinExporter();
provider.addSpanProcessor(new BatchSpanProcessor(zipkinExporter));
provider.register();
};
register();
Using packages:
"@opentelemetry/exporter-zipkin": "^1.2.0",
"@opentelemetry/instrumentation": "^0.22.0",
"@opentelemetry/instrumentation-express": "^0.22.0",
"@opentelemetry/instrumentation-graphql": "^0.22.0",
"@opentelemetry/instrumentation-http": "^0.22.0",
"@opentelemetry/node": "^0.24.0",
"@opentelemetry/resources": "^1.2.0",
"@opentelemetry/tracing": "^0.24.0",
After open http://localhost:9411/zipkin/ and run application with GraphQL operations, there wasn’t any data in the dashboard.
It seems the telemetry didn’t send to Zipkin. Where is the problem?