@tigorhutasuhut/telemetry-js - v0.7.3
    Preparing search index...

    Function instrument

    • Wrap a Cloudflare Worker handler with OpenTelemetry instrumentation.

      Each incoming fetch, scheduled, or queue event is traced as a span. Spans are flushed via ctx.waitUntil so they don't block the response.

      Type Parameters

      • Env = unknown

      Parameters

      • handler: ExportedHandler<Env>

        The original Cloudflare Worker ExportedHandler to instrument.

      • Optionalopts: InstrumentOptions

        SDK configuration options.

      Returns ExportedHandler<Env>

      A new ExportedHandler that traces every event.

      import { instrument } from "@tigorhutasuhut/telemetry-js";

      export default instrument({
      async fetch(request, env, ctx) {
      return new Response("Hello");
      },
      });