---
title: OTLP API
description: Generated public TypeScript reference for @relkit/otlp.
search:
  exclude: true
sidebar:
  icon: braces
---

{/* Generated by apps/docs/scripts/generate.ts. Do not edit. */}

For configuration and examples, read [observability](/docs/modules/operations/observability).

## Public imports

- `@relkit/otlp` — 3 exports
- `@relkit/otlp/runtime` — 9 exports

## All exported APIs

Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API's inline sample, a maintained repository usage, or the shared module walkthrough.

| API                                                                                   | Kind  | Import from            | Example                                                                                                   |
| ------------------------------------------------------------------------------------- | ----- | ---------------------- | --------------------------------------------------------------------------------------------------------- |
| [createOtlpExporter](/docs/api/integrations/otlp#createotlpexporter)                  | Value | `@relkit/otlp/runtime` | [Module example](/docs/modules/operations/observability)                                                  |
| [createOtlpTransport](/docs/api/integrations/otlp#createotlptransport)                | Value | `@relkit/otlp/runtime` | [Module example](/docs/modules/operations/observability)                                                  |
| [createTelemetryExporter](/docs/api/integrations/otlp#createtelemetryexporter)        | Value | `@relkit/otlp/runtime` | [Module example](/docs/modules/operations/observability)                                                  |
| [otlp](/docs/api/integrations/otlp#otlp)                                              | Value | `@relkit/otlp`         | [Source example](https://github.com/rel-kit/relkit/blob/main/apps/docs/examples/landing/telemetry.ts#L13) |
| [OtlpExporter](/docs/api/integrations/otlp#otlpexporter-interface)                    | Type  | `@relkit/otlp/runtime` | [Module example](/docs/modules/operations/observability)                                                  |
| [OtlpExporterOptions](/docs/api/integrations/otlp#otlpexporteroptions-interface)      | Type  | `@relkit/otlp/runtime` | [Module example](/docs/modules/operations/observability)                                                  |
| [OtlpOptions](/docs/api/integrations/otlp#otlpoptions-interface)                      | Type  | `@relkit/otlp`         | [Module example](/docs/modules/operations/observability)                                                  |
| [OtlpSignal](/docs/api/integrations/otlp#otlpsignal-type-alias)                       | Type  | `@relkit/otlp/runtime` | [Module example](/docs/modules/operations/observability)                                                  |
| [OtlpTelemetryExporter](/docs/api/integrations/otlp#otlptelemetryexporter-type-alias) | Type  | `@relkit/otlp`         | [Module example](/docs/modules/operations/observability)                                                  |
| [OtlpTransport](/docs/api/integrations/otlp#otlptransport-interface)                  | Type  | `@relkit/otlp/runtime` | [Module example](/docs/modules/operations/observability)                                                  |
| [OtlpTransportOptions](/docs/api/integrations/otlp#otlptransportoptions-interface)    | Type  | `@relkit/otlp/runtime` | [Module example](/docs/modules/operations/observability)                                                  |
| [runtimeIntegration](/docs/api/integrations/otlp#runtimeintegration)                  | Value | `@relkit/otlp/runtime` | [Module example](/docs/modules/operations/observability)                                                  |

## `index.ts`

### "./otlp.js" (namespace export)

Re-exports all named exports from the "./otlp.js" module.

**Signature**

```ts
export * from "./otlp.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/index.ts#L1)

## `otlp.ts`

### OtlpOptions (interface)

**Signature**

```ts
export interface OtlpOptions {
  readonly endpoint: TextInput;
  readonly headers?: Readonly<Record<string, TextInput>>;
  readonly serviceName?: TextInput;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/otlp.ts#L13)

### OtlpTelemetryExporter (type alias)

**Signature**

```ts
type OtlpTelemetryExporter = TelemetryExporterDescriptor<"otlp", "otlp", OtlpOptions>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/otlp.ts#L19)

### otlp

Declares one statically loaded OTLP/HTTP telemetry exporter.

**Signature**

```ts
declare const otlp: (options: OtlpOptions) => OtlpTelemetryExporter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/otlp.ts#L22)

## `exporter-support.ts`

### combinedSignal

**Signature**

```ts
declare const combinedSignal: (first: AbortSignal, second: AbortSignal | undefined) => AbortSignal;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter-support.ts#L30)

### nonNegative

**Signature**

```ts
declare const nonNegative: (value: number, name: string) => number;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter-support.ts#L68)

### otlpPayload

**Signature**

```ts
declare const otlpPayload: (
  serviceName: string | undefined,
  records: readonly RedactedObservabilityRecord[],
  signal: OtlpSignal,
) => JsonValue;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter-support.ts#L5)

### otlpSignalFor

**Signature**

```ts
declare const otlpSignalFor: (record: RedactedObservabilityRecord) => OtlpSignal | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter-support.ts#L19)

### otlpUnitId

**Signature**

```ts
declare const otlpUnitId: (record: RedactedObservabilityRecord, sequence: number) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter-support.ts#L24)

### positive

**Signature**

```ts
declare const positive: (value: number, name: string) => number;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter-support.ts#L63)

### text

**Signature**

```ts
declare const text: (value: unknown, name: string) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter-support.ts#L49)

### textMap

**Signature**

```ts
declare const textMap: (value: unknown) => Readonly<Record<string, string>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter-support.ts#L55)

### within

**Signature**

```ts
declare const within: (operation: Promise<unknown>, timeoutMs: number) => Promise<boolean>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter-support.ts#L34)

## `exporter.ts`

### OtlpExporter (interface)

**Signature**

```ts
export interface OtlpExporter extends TelemetryExporterRuntime {
  readonly stats: () => TelemetryExporterRuntimeStats & {
    readonly exportedRecords: number;
    readonly retries: number;
  };
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter.ts#L32)

### OtlpExporterOptions (interface)

**Signature**

```ts
export interface OtlpExporterOptions {
  readonly transport: OtlpTransport;
  readonly serviceName?: string;
  readonly maxRecords?: number;
  readonly batchSize?: number;
  readonly maxRetries?: number;
  readonly retryDelayMs?: number;
  readonly signal?: AbortSignal;
  readonly delay?: (milliseconds: number) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter.ts#L21)

### createOtlpExporter

**Signature**

```ts
declare const createOtlpExporter: (options: OtlpExporterOptions) => OtlpExporter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter.ts#L39)

### createTelemetryExporter

**Signature**

```ts
declare const createTelemetryExporter: (
  context: TelemetryExporterFactoryContext,
) => Promise<TelemetryExporterRuntime>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/exporter.ts#L159)

## `index.ts`

### "./exporter.js" (namespace export)

Re-exports all named exports from the "./exporter.js" module.

**Signature**

```ts
export * from "./exporter.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/index.ts#L2)

### "./transport.js" (namespace export)

Re-exports all named exports from the "./transport.js" module.

**Signature**

```ts
export * from "./transport.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/index.ts#L1)

### runtimeIntegration

**Signature**

```ts
declare const runtimeIntegration: Readonly<{
  kind: "runtime-integration";
  integrationId: "otlp";
  registrations: ReadonlyArray<{ capability: string; adapterId: string; protocolVersion: number }>;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/index.ts#L4)

## `transport.ts`

### OtlpSignal (type alias)

**Signature**

```ts
type OtlpSignal = "logs" | "traces";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/transport.ts#L3)

### OtlpTransport (interface)

**Signature**

```ts
export interface OtlpTransport {
  readonly send: (signal: OtlpSignal, payload: JsonValue, abort?: AbortSignal) => Promise<void>;
  readonly flush: () => Promise<void>;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/transport.ts#L11)

### OtlpTransportOptions (interface)

**Signature**

```ts
export interface OtlpTransportOptions {
  readonly endpoint: string;
  readonly headers?: Readonly<Record<string, string>>;
  readonly fetch?: typeof globalThis.fetch;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/transport.ts#L5)

### createOtlpTransport

**Signature**

```ts
declare const createOtlpTransport: (options: OtlpTransportOptions) => OtlpTransport;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/otlp/src/runtime/transport.ts#L17)
