/**
 * Hand-rolled OTLP/JSON decoder for the subset we need to ingest from
 * client-side tool execution.
 *
 * The full OTLP/JSON spec is defined in
 * https://opentelemetry.io/docs/specs/otlp/#otlphttp and the
 * opentelemetry-proto repo. We only consume `ResourceSpans` (for spans)
 * and `ResourceLogs` (for logs). The full message types are large and
 * include backwards-compat fields we never need; this walker reads the
 * fields we care about and ignores the rest.
 *
 * Using `@opentelemetry/otlp-transformer` would pull in the full proto
 * dependency tree (~hundreds of KB) for what amounts to a 100-line walker.
 */
import type { AnyExportedSpan, EntityType, ExportedLog, LogLevel } from '@mastra/core/observability';
/**
 * Decoded shape of one span pulled out of an OTLP/JSON ResourceSpans
 * payload. Just enough fields to construct an ExportedSpan and forward
 * it through the bus.
 */
export interface DecodedOtlpSpan {
    traceId: string;
    spanId: string;
    parentSpanId?: string;
    name: string;
    startTime: Date;
    endTime?: Date;
    attributes?: Record<string, unknown>;
    /** OTLP status code: 0 unset, 1 ok, 2 error */
    statusCode?: number;
    statusMessage?: string;
}
export interface DecodedOtlpLog {
    traceId: string;
    spanId?: string;
    timestamp: Date;
    /** OTLP severityText: "INFO", "WARN", etc. */
    severityText?: string;
    /** OTLP severityNumber: 1-24 */
    severityNumber?: number;
    body?: unknown;
    attributes?: Record<string, unknown>;
}
/**
 * Walk an OTLP/JSON ResourceSpans payload and return a flat list of
 * decoded spans. Returns an empty array (and never throws) if the
 * payload is malformed.
 */
export declare function decodeResourceSpans(payload: unknown): DecodedOtlpSpan[];
export declare function decodeResourceLogs(payload: unknown): DecodedOtlpLog[];
/**
 * Translate an OTLP severity (text or number) to a Mastra LogLevel.
 *
 * OTEL severity numbers per spec:
 *   1-4 trace, 5-8 debug, 9-12 info, 13-16 warn, 17-20 error, 21-24 fatal.
 */
export declare function otlpSeverityToLogLevel(text: string | undefined, num: number | undefined): LogLevel;
/**
 * Convert a decoded OTLP span into the Mastra ExportedSpan shape so it
 * can be emitted via the observability bus.
 *
 * All ingested spans use SpanType.GENERIC because we don't know what
 * the user instrumented inside their client tool. The original span
 * name and attributes are preserved.
 */
export declare function buildExportedSpan(decoded: DecodedOtlpSpan, options?: {
    entityType?: EntityType;
    entityName?: string;
    isInternal?: boolean;
}): AnyExportedSpan;
export declare function buildExportedLog(decoded: DecodedOtlpLog): ExportedLog;
//# sourceMappingURL=otlp.d.ts.map