# Interface: ITelemetry

Plugin-facing interface for OpenTelemetry instrumentation. Provides a thin abstraction over OpenTelemetry APIs for plugins.

## Methods[​](#methods "Direct link to Methods")

### emit()[​](#emit "Direct link to emit()")

```ts
emit(logRecord: LogRecord): void;

```

Emits a log record using the default logger. Respects the logs enabled/disabled config.

#### Parameters[​](#parameters "Direct link to Parameters")

| Parameter   | Type        | Description            |
| ----------- | ----------- | ---------------------- |
| `logRecord` | `LogRecord` | The log record to emit |

#### Returns[​](#returns "Direct link to Returns")

`void`

***

### getLogger()[​](#getlogger "Direct link to getLogger()")

```ts
getLogger(options?: InstrumentConfig): Logger;

```

Gets a logger for emitting log records.

#### Parameters[​](#parameters-1 "Direct link to Parameters")

| Parameter  | Type               | Description                       |
| ---------- | ------------------ | --------------------------------- |
| `options?` | `InstrumentConfig` | Instrument customization options. |

#### Returns[​](#returns-1 "Direct link to Returns")

`Logger`

***

### getMeter()[​](#getmeter "Direct link to getMeter()")

```ts
getMeter(options?: InstrumentConfig): Meter;

```

Gets a meter for recording metrics.

#### Parameters[​](#parameters-2 "Direct link to Parameters")

| Parameter  | Type               | Description                       |
| ---------- | ------------------ | --------------------------------- |
| `options?` | `InstrumentConfig` | Instrument customization options. |

#### Returns[​](#returns-2 "Direct link to Returns")

`Meter`

***

### getTracer()[​](#gettracer "Direct link to getTracer()")

```ts
getTracer(options?: InstrumentConfig): Tracer;

```

Gets a tracer for creating spans.

#### Parameters[​](#parameters-3 "Direct link to Parameters")

| Parameter  | Type               | Description                       |
| ---------- | ------------------ | --------------------------------- |
| `options?` | `InstrumentConfig` | Instrument customization options. |

#### Returns[​](#returns-3 "Direct link to Returns")

`Tracer`

***

### registerInstrumentations()[​](#registerinstrumentations "Direct link to registerInstrumentations()")

```ts
registerInstrumentations(instrumentations: Instrumentation<InstrumentationConfig>[]): void;

```

Register OpenTelemetry instrumentations. Can be called at any time, but recommended to call in plugin constructor.

#### Parameters[​](#parameters-4 "Direct link to Parameters")

| Parameter          | Type                                          | Description                                         |
| ------------------ | --------------------------------------------- | --------------------------------------------------- |
| `instrumentations` | `Instrumentation`<`InstrumentationConfig`>\[] | Array of OpenTelemetry instrumentations to register |

#### Returns[​](#returns-4 "Direct link to Returns")

`void`

***

### startActiveSpan()[​](#startactivespan "Direct link to startActiveSpan()")

```ts
startActiveSpan<T>(
   name: string, 
   options: SpanOptions, 
   fn: (span: Span) => Promise<T>, 
tracerOptions?: InstrumentConfig): Promise<T>;

```

Starts an active span and executes a callback function within its context. Respects the traces enabled/disabled config. When traces are disabled, executes the callback with a no-op span.

#### Type Parameters[​](#type-parameters "Direct link to Type Parameters")

| Type Parameter |
| -------------- |
| `T`            |

#### Parameters[​](#parameters-5 "Direct link to Parameters")

| Parameter        | Type                               | Description                                                   |
| ---------------- | ---------------------------------- | ------------------------------------------------------------- |
| `name`           | `string`                           | The name of the span                                          |
| `options`        | `SpanOptions`                      | Span options including attributes, kind, etc.                 |
| `fn`             | (`span`: `Span`) => `Promise`<`T`> | Callback function to execute within the span context          |
| `tracerOptions?` | `InstrumentConfig`                 | Optional tracer configuration (custom name, prefix inclusion) |

#### Returns[​](#returns-5 "Direct link to Returns")

`Promise`<`T`>

Promise resolving to the callback's return value
