Effect CommunityEC
Effect Community•3y ago•
4 replies
Graeme

Troubleshooting Auto Instrumentations with @effect/opentelemetry

Hi, I'm trying to hook up auto instrumentations with @effect/opentelemetry (although I suspect individual instrumentations would have the same issue).

import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api';

diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);

import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
const autoInstrumentations = getNodeAutoInstrumentations();

import { NodeSdk } from '@effect/opentelemetry';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';

export const TracingLive = NodeSdk.layer(() => ({
  resource: { serviceName: 'foo', serviceVersion: '1.0' },
  instrumentations: autoInstrumentations,
  spanProcessor: new BatchSpanProcessor(
    new OTLPTraceExporter({
      url: 'http://localhost:4318/v1/traces',
    }),
  ),
}));

I provide TracingLive to my program, and can see the instrumentations logging that stuff is happening, but I don't see their spans in the output. I do see my
Effect.withSpan
spans, however. What am I missing this time? 🙂
Was this page helpful?