Skip to main content

Function: getTracer()

@arolariu/website


@arolariu/website / instrumentation.server / getTracer

Function: getTracer()

getTracer(name?): Tracer

Defined in: instrumentation.server.ts:909

Get a tracer instance for creating spans.

Tracers are used to create spans that represent units of work or operations. Each tracer is identified by a name, typically matching the service or library name.

Parameters

name?

string = "arolariu-website"

Tracer name, typically the service or library name. Defaults to "arolariu-website"

Returns

Tracer

Tracer instance for creating spans

Remarks

  • Tracer names should follow semantic conventions
  • Use the same tracer name consistently within a module or service
  • Tracer instances are cached by the OpenTelemetry API

Example

const tracer = getTracer('my-service');
const span = tracer.startSpan('operation.name');
// ... do work
span.end();

See

https://opentelemetry.io/docs/specs/otel/trace/api/#tracer

// was this page useful?