Setu-TS
    Preparing search index...

    Class NoopTelemetryService

    A telemetry service that does nothing — used when no exporter is configured.

    withSpan still runs the callback and returns its value, but all span operations are no-ops.

    0.2.0

    Implements

    Index
    • Creates a span, runs the callback, and ends the span.

      The span is guaranteed to be ended exactly once, even if the callback throws. The callback receives an ISpan that it can attach attributes to.

      Type Parameters

      • T

        The return type of the callback

      Parameters

      • _name: string
      • fn: (span: ISpan) => Promise<T>

        Callback receiving the span; its return value is forwarded

      • Optional_options: SpanOptions

      Returns Promise<T>

      The value returned by fn

      const telemetry = ctx.services.get<ITelemetryService>(CAPABILITIES.TELEMETRY);
      const result = await telemetry.withSpan('create-order', async (span) => {
      span.setAttribute('order.id', orderId);
      return await orderService.create(orderId);
      });