/** * Hand-rolled in-memory OTLP/JSON collector for client-side tool * observability. * * The full OTEL JS stack (`@opentelemetry/sdk-trace-base` + * `@opentelemetry/sdk-logs` + `@opentelemetry/otlp-transformer`) would * add ~100KB gzipped to the bundle for what amounts to a tree of nested * span timers and a flat array of log records. Mastra users running * sophisticated browser OTEL setups can plug their own collector * implementation in via `ClientOptions.observability.collectorFactory`; * this is the simple default. * * Output is OTLP/JSON conforming to the public spec at * https://opentelemetry.io/docs/specs/otlp/. Only the fields the server * proxy in `@mastra/observability` actually reads are populated. */ import type { ObservabilityCollector, ObservabilityCollectorFactory } from './types.js'; /** * Default factory used when the user opts into the * `@mastra/client-js/observability` subpath. */ export declare const createObservabilityCollector: ObservabilityCollectorFactory; /** * Returns the collector active inside the currently-running client * tool's `execute` function, or `undefined` when no collector is in * scope (e.g. when running outside a client tool, or when the user has * not opted into the `@mastra/client-js/observability` subpath). * * This accessor is browser-safe and best-effort. Prefer the `observe` * object passed to `clientTool.execute(args, { observe })`; it is * scoped to the current tool invocation and does not rely on ambient * async context. * * ```ts * import { getCurrentObservabilityCollector } from '@mastra/client-js/observability'; * * execute: async input => { * const collector = getCurrentObservabilityCollector(); * collector?.log('info', 'starting work'); * const result = await collector?.span('http GET /users', () => fetch(...)); * } * ``` */ export declare function getCurrentObservabilityCollector(): ObservabilityCollector | undefined; //# sourceMappingURL=collector.d.ts.map