@open-multi-agent/otel 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +144 -0
- package/dist/exporter.d.ts +84 -0
- package/dist/exporter.d.ts.map +1 -0
- package/dist/exporter.js +321 -0
- package/dist/exporter.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/mapping.d.ts +25 -0
- package/dist/mapping.d.ts.map +1 -0
- package/dist/mapping.js +198 -0
- package/dist/mapping.js.map +1 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) open-multi-agent contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# `@open-multi-agent/otel`
|
|
2
|
+
|
|
3
|
+
Optional OpenTelemetry adapter for `@open-multi-agent/core` TraceRecord v2.
|
|
4
|
+
It converts OBS-2 `TraceExporter` batches into spans on a tracer you explicitly
|
|
5
|
+
provide. The package never reads, registers, or replaces the global
|
|
6
|
+
`TracerProvider`.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @open-multi-agent/core@^1.11.0 @open-multi-agent/otel@^0.1.0
|
|
10
|
+
# Install and configure the OpenTelemetry SDK/exporter chosen by your application.
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Core `1.11.0` is the first release containing the public TraceRecord v2,
|
|
14
|
+
sink/exporter, and TraceStore APIs required by this package. Core `1.10.0` is
|
|
15
|
+
not compatible.
|
|
16
|
+
|
|
17
|
+
## Use an application-owned provider
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { OpenMultiAgent } from '@open-multi-agent/core'
|
|
21
|
+
import { createOtelTraceSink } from '@open-multi-agent/otel'
|
|
22
|
+
|
|
23
|
+
// `provider` is configured by the application with its SDK and exporter.
|
|
24
|
+
const sink = createOtelTraceSink({
|
|
25
|
+
tracerProvider: provider,
|
|
26
|
+
metadata: {
|
|
27
|
+
environment: 'production',
|
|
28
|
+
release: '2026.07.15',
|
|
29
|
+
tenantId: 'opaque-tenant-id',
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const oma = new OpenMultiAgent({ observability: { sinks: [sink] } })
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Pass exactly one of `tracer` or `tracerProvider`. Passing neither is a clear
|
|
37
|
+
configuration error: this package does not fall back to `trace.getTracer()` or
|
|
38
|
+
any global provider.
|
|
39
|
+
|
|
40
|
+
## Lifecycle and ownership
|
|
41
|
+
|
|
42
|
+
The caller owns the tracer/provider in every mode.
|
|
43
|
+
|
|
44
|
+
- `sink.forceFlush()` first flushes the OMA batching queue, then delegates to
|
|
45
|
+
`provider.forceFlush()` when a provider was supplied and implements it.
|
|
46
|
+
- With a direct `tracer`, there is no provider lifecycle to delegate to, so the
|
|
47
|
+
adapter phase is a successful no-op.
|
|
48
|
+
- `sink.shutdown()` does **not** shut down a caller-owned provider by default.
|
|
49
|
+
Set `shutdownOnShutdown: true` only when this adapter is the component that
|
|
50
|
+
owns the provider lifecycle.
|
|
51
|
+
- Completed OTel `Span` objects are released immediately. Lightweight contexts
|
|
52
|
+
remain only until their OMA root closes; the 256 most recent root contexts
|
|
53
|
+
are retained so a same-process checkpoint restore can resolve its continuation
|
|
54
|
+
link. Shutdown ends any still-open span as incomplete and clears all adapter
|
|
55
|
+
state.
|
|
56
|
+
- Provider rejection or timeout becomes the OBS-2 exporter result and sink
|
|
57
|
+
diagnostics/stats; it never changes an Agent, Task, or Run result.
|
|
58
|
+
|
|
59
|
+
Use a `BatchingTraceSink` directly via `createOtelTraceExporter()` when the
|
|
60
|
+
application owns batching configuration itself.
|
|
61
|
+
|
|
62
|
+
For a complete no-network example with the official `InMemorySpanExporter`, see
|
|
63
|
+
[`otel-provider.ts`](../core/examples/integrations/observability-v2/otel-provider.ts).
|
|
64
|
+
|
|
65
|
+
### Process lifecycle
|
|
66
|
+
|
|
67
|
+
- **Serverless/FaaS:** call `sink.forceFlush()` with a short invocation budget;
|
|
68
|
+
do not shut down a warm shared sink/provider per invocation.
|
|
69
|
+
- **CLI:** run, force-flush the sink, shut down the sink, then shut down the
|
|
70
|
+
application-owned provider before natural process exit.
|
|
71
|
+
- **Long-lived server:** stop intake and await in-flight work before the sink
|
|
72
|
+
cutoff; then force-flush/shut down the sink and finally shut down the provider.
|
|
73
|
+
|
|
74
|
+
This package and core register no process signal handlers. The application owns
|
|
75
|
+
that integration. Keep `shutdownOnShutdown` at its default `false` when the
|
|
76
|
+
provider is shared with other instrumentation; set it to `true` only when this
|
|
77
|
+
adapter is the provider owner.
|
|
78
|
+
|
|
79
|
+
## Mapping
|
|
80
|
+
|
|
81
|
+
The adapter creates one OTel span for each OMA `span_start`/`span_end` pair.
|
|
82
|
+
An end record that arrives without a start creates a marked incomplete span so
|
|
83
|
+
the self-contained OBS-2 end snapshot remains observable. Duplicates and
|
|
84
|
+
orphan events are ignored with payload-free diagnostics.
|
|
85
|
+
|
|
86
|
+
| OMA operation | OTel representation |
|
|
87
|
+
|---|---|
|
|
88
|
+
| root run | `oma.run` span (`INTERNAL`) |
|
|
89
|
+
| coordinator decomposition/synthesis | OMA plan/agent/callback span, original name retained |
|
|
90
|
+
| task, agent attempt, consensus, checkpoint | `INTERNAL` span, original name retained |
|
|
91
|
+
| LLM | `CLIENT` span with compatible `gen_ai.*` attributes |
|
|
92
|
+
| tool / delegation | `INTERNAL` span; delegated task relation is an OTel link |
|
|
93
|
+
| retry / consensus verdict / stream chunks | `oma.*` events |
|
|
94
|
+
| DAG / restore / synthesis consumption | OTel links with `oma.link.relation` and explicit resolution metadata |
|
|
95
|
+
|
|
96
|
+
When the referenced span was observed by the same adapter, the OTel link uses
|
|
97
|
+
that span's actual SDK-generated `SpanContext`, so backends can resolve it to the
|
|
98
|
+
exported span. This covers DAG dependencies, delegation, synthesis consumption,
|
|
99
|
+
and same-process checkpoint restore. Every link also records
|
|
100
|
+
`oma.link.resolved`, `oma.link.target.trace_id`, and
|
|
101
|
+
`oma.link.target.span_id`; the target IDs are the stable OMA identifiers.
|
|
102
|
+
|
|
103
|
+
After a process restart, the adapter has no access to the previous provider's
|
|
104
|
+
SDK-generated context because checkpoints intentionally contain only OMA IDs.
|
|
105
|
+
Such a `continued_from` link remains a valid remote OTel link using the OMA IDs,
|
|
106
|
+
`TraceFlags.NONE`, and `oma.link.resolved = false`. Use its target attributes
|
|
107
|
+
for correlation; a backend cannot be expected to navigate it to the previously
|
|
108
|
+
exported OTel span.
|
|
109
|
+
|
|
110
|
+
Stable correlation attributes include `oma.schema.version = 2`,
|
|
111
|
+
`oma.run.id`, `oma.run.attempt`, `oma.trace.id`, `oma.span.id`,
|
|
112
|
+
`oma.record.id`, `oma.record.sequence`, and `oma.otel.mapping.version`.
|
|
113
|
+
`oma.otel.gen_ai_semconv.version` records the current compatible GenAI mapping:
|
|
114
|
+
`1.43.0-development`. `oma.*` remains the stable OMA contract; the GenAI
|
|
115
|
+
attributes are a compatibility surface and can evolve with OpenTelemetry.
|
|
116
|
+
|
|
117
|
+
`ok`, `cancelled`, `rejected`, and `skipped` map to OTel `Unset`; `error`,
|
|
118
|
+
`timeout`, and `budget_exhausted` map to `Error`. The source OMA status is
|
|
119
|
+
always retained as `oma.status`.
|
|
120
|
+
|
|
121
|
+
The adapter maps model/provider, input/output/cache/reasoning token counts,
|
|
122
|
+
tool name/error facts, cost metadata, retry fields, and TTFT. It emits no
|
|
123
|
+
metrics, so no OMA high-cardinality values become metric labels.
|
|
124
|
+
|
|
125
|
+
## Privacy
|
|
126
|
+
|
|
127
|
+
Prompt, completion, tool arguments/results, raw payloads, credentials, and
|
|
128
|
+
reasoning/chain-of-thought content are filtered by default. The adapter uses an
|
|
129
|
+
explicit low-sensitivity `oma.*` allowlist rather than forwarding arbitrary
|
|
130
|
+
record attributes. This includes `<thinking>` and provider reasoning content.
|
|
131
|
+
Token counts remain eligible for
|
|
132
|
+
export. `contentCapture` is a reserved type-level extension point whose only
|
|
133
|
+
accepted value is `mode: 'disabled'`; there is intentionally no content-capture
|
|
134
|
+
switch in this release. Applications that need such a feature must add an
|
|
135
|
+
explicit, separately reviewed capture policy upstream of the adapter.
|
|
136
|
+
|
|
137
|
+
## OTLP convenience decision
|
|
138
|
+
|
|
139
|
+
This initial release deliberately has no `/otlp-http` convenience subpath.
|
|
140
|
+
The application chooses and configures its own OpenTelemetry SDK and OTLP (or
|
|
141
|
+
other) exporter, keeping this package's runtime surface to the OTel API and
|
|
142
|
+
avoiding eager OTLP imports, global-provider configuration, and a second
|
|
143
|
+
SDK/exporter version matrix. An explicit convenience subpath can be added later
|
|
144
|
+
without changing the root import.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Tracer, TracerProvider } from '@opentelemetry/api';
|
|
2
|
+
import { type BatchingTraceSinkOptions, type ExportResult, type TraceExporter, type TraceRecord, type TraceSink } from '@open-multi-agent/core';
|
|
3
|
+
export type OTelDiagnosticCode = 'span_start_failed' | 'duplicate_span_start' | 'orphan_event' | 'span_event_failed' | 'duplicate_span_end' | 'incomplete_span' | 'span_end_failed' | 'force_flush_failed' | 'force_flush_timeout' | 'shutdown_skipped' | 'shutdown_failed' | 'shutdown_timeout';
|
|
4
|
+
export interface OTelDiagnostic {
|
|
5
|
+
readonly code: OTelDiagnosticCode;
|
|
6
|
+
readonly message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface OTelTracerProvider extends TracerProvider {
|
|
9
|
+
forceFlush?(): Promise<void>;
|
|
10
|
+
shutdown?(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export interface OTelTraceExporterOptions {
|
|
13
|
+
/** Use an application-owned tracer directly. It is never globally registered or shut down. */
|
|
14
|
+
readonly tracer?: Tracer;
|
|
15
|
+
/**
|
|
16
|
+
* Use an application-owned provider to create the adapter tracer. Its
|
|
17
|
+
* forceFlush is delegated when available; shutdown remains opt-in.
|
|
18
|
+
*/
|
|
19
|
+
readonly tracerProvider?: OTelTracerProvider;
|
|
20
|
+
readonly instrumentationName?: string;
|
|
21
|
+
readonly instrumentationVersion?: string;
|
|
22
|
+
/** Optional low-sensitivity metadata, added only when callers provide it. */
|
|
23
|
+
readonly metadata?: OTelMetadata;
|
|
24
|
+
/**
|
|
25
|
+
* Reserved for a separately reviewed future capture policy. This release only
|
|
26
|
+
* accepts the disabled value and never exports content-bearing fields.
|
|
27
|
+
*/
|
|
28
|
+
readonly contentCapture?: OTelContentCaptureExtension;
|
|
29
|
+
/** Opt in to calling shutdown on the supplied provider. Defaults to false. */
|
|
30
|
+
readonly shutdownOnShutdown?: boolean;
|
|
31
|
+
/** Receives payload-free adapter diagnostics. */
|
|
32
|
+
readonly onDiagnostic?: (diagnostic: OTelDiagnostic) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface OTelMetadata {
|
|
35
|
+
readonly environment?: string;
|
|
36
|
+
readonly release?: string;
|
|
37
|
+
readonly tenantId?: string;
|
|
38
|
+
readonly requestId?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface OTelContentCaptureExtension {
|
|
41
|
+
readonly mode?: 'disabled';
|
|
42
|
+
}
|
|
43
|
+
export interface OTelTraceSinkOptions extends OTelTraceExporterOptions {
|
|
44
|
+
readonly batching?: BatchingTraceSinkOptions;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Adapts OMA TraceRecord v2 to an application-owned OpenTelemetry tracer.
|
|
48
|
+
* It deliberately does not configure or replace OpenTelemetry's global provider.
|
|
49
|
+
*/
|
|
50
|
+
export declare class OTelTraceExporter implements TraceExporter {
|
|
51
|
+
private readonly options;
|
|
52
|
+
private readonly tracer;
|
|
53
|
+
private readonly provider?;
|
|
54
|
+
private readonly openSpans;
|
|
55
|
+
private readonly spanContexts;
|
|
56
|
+
private readonly traceSpanKeys;
|
|
57
|
+
private readonly recentRootContexts;
|
|
58
|
+
private readonly shutdownOnShutdown;
|
|
59
|
+
private readonly metadata;
|
|
60
|
+
constructor(options: OTelTraceExporterOptions);
|
|
61
|
+
export(records: readonly TraceRecord[], _signal: AbortSignal): Promise<ExportResult>;
|
|
62
|
+
forceFlush(signal: AbortSignal): Promise<ExportResult>;
|
|
63
|
+
shutdown(signal: AbortSignal): Promise<ExportResult>;
|
|
64
|
+
private accept;
|
|
65
|
+
private start;
|
|
66
|
+
private event;
|
|
67
|
+
private end;
|
|
68
|
+
private createSpan;
|
|
69
|
+
private safeEventAttributes;
|
|
70
|
+
private addEndLinks;
|
|
71
|
+
private mapLink;
|
|
72
|
+
private registerSpanContext;
|
|
73
|
+
private rememberRootContext;
|
|
74
|
+
private finalizeTrace;
|
|
75
|
+
private finalizeAllOpenSpans;
|
|
76
|
+
private finalizeIncompleteSpan;
|
|
77
|
+
private delegateLifecycle;
|
|
78
|
+
private diagnostic;
|
|
79
|
+
}
|
|
80
|
+
/** Build an OBS-2 TraceSink around the OTel adapter without adding OTel to core. */
|
|
81
|
+
export declare function createOtelTraceSink(options: OTelTraceSinkOptions): TraceSink;
|
|
82
|
+
/** Convenience factory for callers that want to provide the adapter to their own BatchingTraceSink. */
|
|
83
|
+
export declare function createOtelTraceExporter(options: OTelTraceExporterOptions): OTelTraceExporter;
|
|
84
|
+
//# sourceMappingURL=exporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../src/exporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAIV,MAAM,EACN,cAAc,EACf,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAKjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,wBAAwB,CAAA;AAW/B,MAAM,MAAM,kBAAkB,GAC1B,mBAAmB,GACnB,sBAAsB,GACtB,cAAc,GACd,mBAAmB,GACnB,oBAAoB,GACpB,iBAAiB,GACjB,iBAAiB,GACjB,oBAAoB,GACpB,qBAAqB,GACrB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,CAAA;AAEtB,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IA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';
|
|
3
|
+
import { baseAttributes, mapLink, mapOmaAttributes, mapSpanKind, mapStatus, spanAttributes, } from './mapping.js';
|
|
4
|
+
import { PACKAGE_VERSION } from './version.js';
|
|
5
|
+
const MAX_RECENT_ROOT_CONTEXTS = 256;
|
|
6
|
+
function spanKey(traceId, spanId) {
|
|
7
|
+
return `${traceId}/${spanId}`;
|
|
8
|
+
}
|
|
9
|
+
function linkKey(link) {
|
|
10
|
+
return `${link.traceId}/${link.spanId}/${link.relation}`;
|
|
11
|
+
}
|
|
12
|
+
function lifecycleResult(status, code) {
|
|
13
|
+
return { status, exported: 0, ...(code ? { code } : {}) };
|
|
14
|
+
}
|
|
15
|
+
const ACCEPT_FAILURES = {
|
|
16
|
+
span_start: {
|
|
17
|
+
diagnostic: 'span_start_failed',
|
|
18
|
+
message: 'The OpenTelemetry tracer rejected an OMA span_start record.',
|
|
19
|
+
code: 'OTEL_SPAN_START_FAILED',
|
|
20
|
+
},
|
|
21
|
+
span_event: {
|
|
22
|
+
diagnostic: 'span_event_failed',
|
|
23
|
+
message: 'The OpenTelemetry tracer rejected an OMA span_event record.',
|
|
24
|
+
code: 'OTEL_SPAN_EVENT_FAILED',
|
|
25
|
+
},
|
|
26
|
+
span_end: {
|
|
27
|
+
diagnostic: 'span_end_failed',
|
|
28
|
+
message: 'The OpenTelemetry tracer rejected an OMA span_end record.',
|
|
29
|
+
code: 'OTEL_SPAN_END_FAILED',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Adapts OMA TraceRecord v2 to an application-owned OpenTelemetry tracer.
|
|
34
|
+
* It deliberately does not configure or replace OpenTelemetry's global provider.
|
|
35
|
+
*/
|
|
36
|
+
export class OTelTraceExporter {
|
|
37
|
+
options;
|
|
38
|
+
tracer;
|
|
39
|
+
provider;
|
|
40
|
+
openSpans = new Map();
|
|
41
|
+
spanContexts = new Map();
|
|
42
|
+
traceSpanKeys = new Map();
|
|
43
|
+
recentRootContexts = new Map();
|
|
44
|
+
shutdownOnShutdown;
|
|
45
|
+
metadata;
|
|
46
|
+
constructor(options) {
|
|
47
|
+
this.options = options;
|
|
48
|
+
if ((options.tracer === undefined) === (options.tracerProvider === undefined)) {
|
|
49
|
+
throw new TypeError('Provide exactly one of tracer or tracerProvider; global OpenTelemetry state is never used.');
|
|
50
|
+
}
|
|
51
|
+
if (options.contentCapture?.mode !== undefined && options.contentCapture.mode !== 'disabled') {
|
|
52
|
+
throw new TypeError('Content capture is not implemented by @open-multi-agent/otel.');
|
|
53
|
+
}
|
|
54
|
+
this.provider = options.tracerProvider;
|
|
55
|
+
this.tracer = options.tracer ?? options.tracerProvider.getTracer(options.instrumentationName ?? '@open-multi-agent/otel', options.instrumentationVersion ?? PACKAGE_VERSION);
|
|
56
|
+
this.shutdownOnShutdown = options.shutdownOnShutdown ?? false;
|
|
57
|
+
this.metadata = {
|
|
58
|
+
...(options.metadata?.environment ? {
|
|
59
|
+
'oma.environment': options.metadata.environment,
|
|
60
|
+
'deployment.environment.name': options.metadata.environment,
|
|
61
|
+
} : {}),
|
|
62
|
+
...(options.metadata?.release ? {
|
|
63
|
+
'oma.release': options.metadata.release,
|
|
64
|
+
'service.version': options.metadata.release,
|
|
65
|
+
} : {}),
|
|
66
|
+
...(options.metadata?.tenantId ? { 'oma.tenant.id': options.metadata.tenantId } : {}),
|
|
67
|
+
...(options.metadata?.requestId ? { 'oma.request.id': options.metadata.requestId } : {}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export(records, _signal) {
|
|
71
|
+
let exported = 0;
|
|
72
|
+
for (const record of records) {
|
|
73
|
+
try {
|
|
74
|
+
this.accept(record);
|
|
75
|
+
exported++;
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
const failure = ACCEPT_FAILURES[record.recordType];
|
|
79
|
+
this.diagnostic(failure.diagnostic, failure.message);
|
|
80
|
+
return Promise.resolve({ status: 'failure', exported, code: failure.code });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return Promise.resolve({ status: 'success', exported });
|
|
84
|
+
}
|
|
85
|
+
async forceFlush(signal) {
|
|
86
|
+
if (!this.provider?.forceFlush)
|
|
87
|
+
return lifecycleResult('success');
|
|
88
|
+
return this.delegateLifecycle(this.provider.forceFlush.bind(this.provider), signal, 'force_flush');
|
|
89
|
+
}
|
|
90
|
+
async shutdown(signal) {
|
|
91
|
+
this.finalizeAllOpenSpans(Date.now());
|
|
92
|
+
this.spanContexts.clear();
|
|
93
|
+
this.traceSpanKeys.clear();
|
|
94
|
+
this.recentRootContexts.clear();
|
|
95
|
+
if (!this.shutdownOnShutdown || !this.provider?.shutdown) {
|
|
96
|
+
this.diagnostic('shutdown_skipped', 'Provider shutdown was skipped because the adapter does not own the provider.');
|
|
97
|
+
return lifecycleResult('success');
|
|
98
|
+
}
|
|
99
|
+
return this.delegateLifecycle(this.provider.shutdown.bind(this.provider), signal, 'shutdown');
|
|
100
|
+
}
|
|
101
|
+
accept(record) {
|
|
102
|
+
if (record.recordType === 'span_start') {
|
|
103
|
+
this.start(record);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (record.recordType === 'span_event') {
|
|
107
|
+
this.event(record);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
this.end(record);
|
|
111
|
+
}
|
|
112
|
+
start(record) {
|
|
113
|
+
const key = spanKey(record.traceId, record.spanId);
|
|
114
|
+
if (this.openSpans.has(key) || this.spanContexts.has(key) || this.recentRootContexts.has(key)) {
|
|
115
|
+
this.diagnostic('duplicate_span_start', 'Duplicate OMA span_start record ignored.');
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const span = this.createSpan(record);
|
|
119
|
+
this.registerSpanContext(record.traceId, key, span.spanContext());
|
|
120
|
+
this.openSpans.set(key, {
|
|
121
|
+
span,
|
|
122
|
+
startUnixMs: record.startUnixMs,
|
|
123
|
+
linkKeys: new Set(record.links?.map(linkKey)),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
event(record) {
|
|
127
|
+
const entry = this.openSpans.get(spanKey(record.traceId, record.spanId));
|
|
128
|
+
if (!entry) {
|
|
129
|
+
this.diagnostic('orphan_event', 'OMA span_event arrived without an open OTel span and was ignored.');
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const attributes = {
|
|
133
|
+
...baseAttributes(record),
|
|
134
|
+
...this.metadata,
|
|
135
|
+
...this.safeEventAttributes(record),
|
|
136
|
+
'oma.event.name': record.name,
|
|
137
|
+
};
|
|
138
|
+
entry.span.addEvent(`oma.${record.name}`, attributes, record.timestampUnixMs);
|
|
139
|
+
if (record.name === 'first_chunk') {
|
|
140
|
+
const ttftSeconds = Math.max(0, record.timestampUnixMs - entry.startUnixMs) / 1_000;
|
|
141
|
+
entry.span.setAttribute('gen_ai.response.time_to_first_chunk', ttftSeconds);
|
|
142
|
+
entry.span.setAttribute('oma.ttft.ms', ttftSeconds * 1_000);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
end(record) {
|
|
146
|
+
const key = spanKey(record.traceId, record.spanId);
|
|
147
|
+
let entry = this.openSpans.get(key);
|
|
148
|
+
if (!entry && (this.spanContexts.has(key) || this.recentRootContexts.has(key))) {
|
|
149
|
+
this.diagnostic('duplicate_span_end', 'Duplicate OMA span_end record ignored.');
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (!entry) {
|
|
153
|
+
this.diagnostic('incomplete_span', 'OMA span_end arrived without span_start; a synthetic OTel span was created.');
|
|
154
|
+
const span = this.createSpan(record, true);
|
|
155
|
+
this.registerSpanContext(record.traceId, key, span.spanContext());
|
|
156
|
+
entry = {
|
|
157
|
+
span,
|
|
158
|
+
startUnixMs: record.startUnixMs,
|
|
159
|
+
linkKeys: new Set(record.links?.map(linkKey)),
|
|
160
|
+
};
|
|
161
|
+
this.openSpans.set(key, entry);
|
|
162
|
+
}
|
|
163
|
+
entry.span.setAttributes({
|
|
164
|
+
...spanAttributes(record),
|
|
165
|
+
...this.metadata,
|
|
166
|
+
'oma.status': record.status.code,
|
|
167
|
+
});
|
|
168
|
+
this.addEndLinks(entry, record.links);
|
|
169
|
+
entry.span.setStatus(mapStatus(record.status));
|
|
170
|
+
if (record.error) {
|
|
171
|
+
const errorAttributes = {
|
|
172
|
+
'error.type': record.error.code ?? record.error.kind,
|
|
173
|
+
'oma.error.kind': record.error.kind,
|
|
174
|
+
...(record.error.code ? { 'oma.error.code': record.error.code } : {}),
|
|
175
|
+
...(record.error.name ? { 'oma.error.name': record.error.name } : {}),
|
|
176
|
+
...(record.error.retryable !== undefined ? { 'oma.error.retryable': record.error.retryable } : {}),
|
|
177
|
+
...(record.error.httpStatus !== undefined ? { 'oma.error.http_status': record.error.httpStatus } : {}),
|
|
178
|
+
...(record.error.provider ? { 'oma.error.provider': record.error.provider } : {}),
|
|
179
|
+
...(record.error.attempt !== undefined ? { 'oma.error.attempt': record.error.attempt } : {}),
|
|
180
|
+
};
|
|
181
|
+
entry.span.setAttributes(errorAttributes);
|
|
182
|
+
entry.span.addEvent('exception', errorAttributes, record.endUnixMs);
|
|
183
|
+
}
|
|
184
|
+
entry.span.end(record.endUnixMs);
|
|
185
|
+
this.openSpans.delete(key);
|
|
186
|
+
if (record.kind === 'run') {
|
|
187
|
+
const rootContext = this.spanContexts.get(key);
|
|
188
|
+
if (rootContext)
|
|
189
|
+
this.rememberRootContext(key, rootContext);
|
|
190
|
+
this.finalizeTrace(record.traceId, record.endUnixMs);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
createSpan(record, incomplete = false) {
|
|
194
|
+
const parent = record.parentSpanId
|
|
195
|
+
? this.spanContexts.get(spanKey(record.traceId, record.parentSpanId))
|
|
196
|
+
: undefined;
|
|
197
|
+
// Root spans must not parent under whatever application span happens to be
|
|
198
|
+
// active at export time; batching makes that ambient context arbitrary.
|
|
199
|
+
const parentContext = parent ? trace.setSpanContext(ROOT_CONTEXT, parent) : ROOT_CONTEXT;
|
|
200
|
+
const attributes = {
|
|
201
|
+
...spanAttributes(record),
|
|
202
|
+
...this.metadata,
|
|
203
|
+
...(incomplete ? { 'oma.record.incomplete': true } : {}),
|
|
204
|
+
};
|
|
205
|
+
const span = this.tracer.startSpan(record.name, {
|
|
206
|
+
kind: mapSpanKind(record.kind),
|
|
207
|
+
attributes,
|
|
208
|
+
links: record.links?.map((link) => this.mapLink(link)),
|
|
209
|
+
startTime: record.startUnixMs,
|
|
210
|
+
}, parentContext);
|
|
211
|
+
return span;
|
|
212
|
+
}
|
|
213
|
+
safeEventAttributes(record) {
|
|
214
|
+
return mapOmaAttributes(record.attributes);
|
|
215
|
+
}
|
|
216
|
+
addEndLinks(entry, links) {
|
|
217
|
+
for (const link of links ?? []) {
|
|
218
|
+
const key = linkKey(link);
|
|
219
|
+
if (entry.linkKeys.has(key))
|
|
220
|
+
continue;
|
|
221
|
+
entry.span.addLink(this.mapLink(link));
|
|
222
|
+
entry.linkKeys.add(key);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
mapLink(link) {
|
|
226
|
+
const key = spanKey(link.traceId, link.spanId);
|
|
227
|
+
return mapLink(link, this.spanContexts.get(key) ?? this.recentRootContexts.get(key));
|
|
228
|
+
}
|
|
229
|
+
registerSpanContext(traceId, key, spanContext) {
|
|
230
|
+
this.spanContexts.set(key, spanContext);
|
|
231
|
+
let keys = this.traceSpanKeys.get(traceId);
|
|
232
|
+
if (!keys) {
|
|
233
|
+
keys = new Set();
|
|
234
|
+
this.traceSpanKeys.set(traceId, keys);
|
|
235
|
+
}
|
|
236
|
+
keys.add(key);
|
|
237
|
+
}
|
|
238
|
+
rememberRootContext(key, spanContext) {
|
|
239
|
+
this.recentRootContexts.delete(key);
|
|
240
|
+
this.recentRootContexts.set(key, spanContext);
|
|
241
|
+
while (this.recentRootContexts.size > MAX_RECENT_ROOT_CONTEXTS) {
|
|
242
|
+
const oldest = this.recentRootContexts.keys().next().value;
|
|
243
|
+
if (oldest === undefined)
|
|
244
|
+
break;
|
|
245
|
+
this.recentRootContexts.delete(oldest);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
finalizeTrace(traceId, endUnixMs) {
|
|
249
|
+
const keys = this.traceSpanKeys.get(traceId);
|
|
250
|
+
if (!keys)
|
|
251
|
+
return;
|
|
252
|
+
for (const key of keys) {
|
|
253
|
+
const entry = this.openSpans.get(key);
|
|
254
|
+
if (entry)
|
|
255
|
+
this.finalizeIncompleteSpan(key, entry, endUnixMs);
|
|
256
|
+
this.spanContexts.delete(key);
|
|
257
|
+
}
|
|
258
|
+
this.traceSpanKeys.delete(traceId);
|
|
259
|
+
}
|
|
260
|
+
finalizeAllOpenSpans(endUnixMs) {
|
|
261
|
+
for (const [key, entry] of this.openSpans) {
|
|
262
|
+
this.finalizeIncompleteSpan(key, entry, endUnixMs);
|
|
263
|
+
}
|
|
264
|
+
this.openSpans.clear();
|
|
265
|
+
}
|
|
266
|
+
finalizeIncompleteSpan(key, entry, endUnixMs) {
|
|
267
|
+
this.diagnostic('incomplete_span', 'OMA trace closed without span_end; the open OTel span was ended as incomplete.');
|
|
268
|
+
try {
|
|
269
|
+
entry.span.setAttribute('oma.record.incomplete', true);
|
|
270
|
+
entry.span.setStatus({ code: SpanStatusCode.UNSET });
|
|
271
|
+
entry.span.end(endUnixMs);
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
this.diagnostic('span_end_failed', 'The OpenTelemetry tracer rejected cleanup of an incomplete OMA span.');
|
|
275
|
+
}
|
|
276
|
+
finally {
|
|
277
|
+
this.openSpans.delete(key);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
async delegateLifecycle(action, signal, operation) {
|
|
281
|
+
if (signal.aborted) {
|
|
282
|
+
this.diagnostic(`${operation}_timeout`, `OpenTelemetry ${operation} timed out.`);
|
|
283
|
+
return lifecycleResult('failure', `OTEL_${operation.toUpperCase()}_TIMEOUT`);
|
|
284
|
+
}
|
|
285
|
+
const actionResult = Promise.resolve().then(action).then(() => ({ kind: 'success' }), () => ({ kind: 'failure' }));
|
|
286
|
+
let removeAbortListener;
|
|
287
|
+
const timeout = new Promise((resolve) => {
|
|
288
|
+
const onAbort = () => resolve({ kind: 'timeout' });
|
|
289
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
290
|
+
removeAbortListener = () => signal.removeEventListener('abort', onAbort);
|
|
291
|
+
});
|
|
292
|
+
const outcome = await Promise.race([actionResult, timeout]);
|
|
293
|
+
removeAbortListener?.();
|
|
294
|
+
if (outcome.kind === 'success')
|
|
295
|
+
return lifecycleResult('success');
|
|
296
|
+
if (outcome.kind === 'timeout') {
|
|
297
|
+
this.diagnostic(`${operation}_timeout`, `OpenTelemetry ${operation} timed out.`);
|
|
298
|
+
return lifecycleResult('failure', `OTEL_${operation.toUpperCase()}_TIMEOUT`);
|
|
299
|
+
}
|
|
300
|
+
this.diagnostic(`${operation}_failed`, `OpenTelemetry ${operation} failed.`);
|
|
301
|
+
return lifecycleResult('failure', `OTEL_${operation.toUpperCase()}_FAILED`);
|
|
302
|
+
}
|
|
303
|
+
diagnostic(code, message) {
|
|
304
|
+
try {
|
|
305
|
+
this.options.onDiagnostic?.({ code, message });
|
|
306
|
+
}
|
|
307
|
+
catch {
|
|
308
|
+
// Diagnostics are best effort and must never alter OMA execution.
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/** Build an OBS-2 TraceSink around the OTel adapter without adding OTel to core. */
|
|
313
|
+
export function createOtelTraceSink(options) {
|
|
314
|
+
const { batching, ...exporterOptions } = options;
|
|
315
|
+
return new BatchingTraceSink(new OTelTraceExporter(exporterOptions), batching);
|
|
316
|
+
}
|
|
317
|
+
/** Convenience factory for callers that want to provide the adapter to their own BatchingTraceSink. */
|
|
318
|
+
export function createOtelTraceExporter(options) {
|
|
319
|
+
return new OTelTraceExporter(options);
|
|
320
|
+
}
|
|
321
|
+
//# sourceMappingURL=exporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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OTEL_GENAI_SEMCONV_VERSION, addGenAiAttributes, isSafeOmaAttribute, mapLink, mapOmaAttributes, mapSpanKind, mapStatus, } from './mapping.js';
|
|
2
|
+
export { createOtelTraceExporter, createOtelTraceSink, OTelTraceExporter, } from './exporter.js';
|
|
3
|
+
export type { OTelDiagnostic, OTelDiagnosticCode, OTelContentCaptureExtension, OTelMetadata, OTelTraceExporterOptions, OTelTraceSinkOptions, OTelTracerProvider, } from './exporter.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,SAAS,GACV,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,eAAe,CAAA;AACtB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,YAAY,EACZ,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,eAAe,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { OMA_OTEL_MAPPING_VERSION, OMA_SCHEMA_VERSION, OTEL_GENAI_SEMCONV_VERSION, addGenAiAttributes, isSafeOmaAttribute, mapLink, mapOmaAttributes, mapSpanKind, mapStatus, } from './mapping.js';
|
|
2
|
+
export { createOtelTraceExporter, createOtelTraceSink, OTelTraceExporter, } from './exporter.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,SAAS,GACV,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SpanKind as OTelSpanKind } from '@opentelemetry/api';
|
|
2
|
+
import type { Attributes, Link, SpanContext, SpanStatus } from '@opentelemetry/api';
|
|
3
|
+
import type { RunStatus, SpanEndRecord, SpanKind, SpanStartRecord, TraceAttributeValue, TraceLink, TraceRecordBase } from '@open-multi-agent/core';
|
|
4
|
+
/** Version of OMA's stable TraceRecord-to-OTel mapping. */
|
|
5
|
+
export declare const OMA_OTEL_MAPPING_VERSION = "1.0.0";
|
|
6
|
+
/**
|
|
7
|
+
* The GenAI conventions are development-status and deliberately remain a
|
|
8
|
+
* compatibility mapping rather than part of OMA's stable public schema.
|
|
9
|
+
*/
|
|
10
|
+
export declare const OTEL_GENAI_SEMCONV_VERSION = "1.43.0-development";
|
|
11
|
+
export declare const OMA_SCHEMA_VERSION = 2;
|
|
12
|
+
/** OMA content is never exported by this package; only an explicit safe metadata allowlist crosses the boundary. */
|
|
13
|
+
export declare function isSafeOmaAttribute(key: string): boolean;
|
|
14
|
+
export declare function mapOmaAttributes(attributes: Readonly<Record<string, TraceAttributeValue>>): Attributes;
|
|
15
|
+
/** Add a bounded compatibility subset of the current GenAI semantic conventions. */
|
|
16
|
+
export declare function addGenAiAttributes(kind: SpanKind, attributes: Attributes): void;
|
|
17
|
+
export declare function mapSpanKind(kind: SpanKind): OTelSpanKind;
|
|
18
|
+
/** Keep successful OMA instrumentation spans Unset, per the OTel Trace API guidance. */
|
|
19
|
+
export declare function mapStatus(status: RunStatus): SpanStatus;
|
|
20
|
+
export declare function mapLink(link: TraceLink, resolvedContext?: SpanContext): Link;
|
|
21
|
+
export declare function baseAttributes(record: TraceRecordBase & {
|
|
22
|
+
readonly recordType: string;
|
|
23
|
+
}): Attributes;
|
|
24
|
+
export declare function spanAttributes(record: SpanStartRecord | SpanEndRecord): Attributes;
|
|
25
|
+
//# sourceMappingURL=mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../src/mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,IAAI,YAAY,EAGzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAEV,UAAU,EACV,IAAI,EACJ,WAAW,EACX,UAAU,EACX,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,SAAS,EACT,eAAe,EAChB,MAAM,wBAAwB,CAAA;AAE/B,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,UAAU,CAAA;AAE/C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,uBAAuB,CAAA;AAE9D,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAuDnC,oHAAoH;AACpH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKvD;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,GACxD,UAAU,CAMZ;AAkBD,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CA8B/E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,YAAY,CAExD;AAED,wFAAwF;AACxF,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAgBvD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAkB5E;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAcpG;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,aAAa,GAAG,UAAU,CAQlF"}
|
package/dist/mapping.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { SpanKind as OTelSpanKind, SpanStatusCode, TraceFlags, } from '@opentelemetry/api';
|
|
2
|
+
/** Version of OMA's stable TraceRecord-to-OTel mapping. */
|
|
3
|
+
export const OMA_OTEL_MAPPING_VERSION = '1.0.0';
|
|
4
|
+
/**
|
|
5
|
+
* The GenAI conventions are development-status and deliberately remain a
|
|
6
|
+
* compatibility mapping rather than part of OMA's stable public schema.
|
|
7
|
+
*/
|
|
8
|
+
export const OTEL_GENAI_SEMCONV_VERSION = '1.43.0-development';
|
|
9
|
+
export const OMA_SCHEMA_VERSION = 2;
|
|
10
|
+
const CONTENT_ATTRIBUTE = /(^|[._-])(prompt|completion|content|message|messages|argument|arguments|result|results|reasoning|thinking|payload)($|[._-])/i;
|
|
11
|
+
const SECRET_ATTRIBUTE = /(^|[._-])(authorization|cookie|set_cookie|api[_-]?key|password|passwd|secret|access[_-]?token|refresh[_-]?token|private[_-]?key)($|[._-])/i;
|
|
12
|
+
const SAFE_OMA_ATTRIBUTES = new Set([
|
|
13
|
+
'oma.agent.attempt',
|
|
14
|
+
'oma.agent.name',
|
|
15
|
+
'oma.agent.tool_calls',
|
|
16
|
+
'oma.agent.turns',
|
|
17
|
+
'oma.approval.approved',
|
|
18
|
+
'oma.callback.name',
|
|
19
|
+
'oma.checkpoint.mode',
|
|
20
|
+
'oma.consensus.accepted',
|
|
21
|
+
'oma.consensus.round',
|
|
22
|
+
'oma.consensus.rounds',
|
|
23
|
+
'oma.consensus.scope',
|
|
24
|
+
'oma.consensus.verdict',
|
|
25
|
+
'oma.cost.amount',
|
|
26
|
+
'oma.cost.currency',
|
|
27
|
+
'oma.cost.price_version',
|
|
28
|
+
'oma.cost.source',
|
|
29
|
+
'oma.environment',
|
|
30
|
+
'oma.llm.model',
|
|
31
|
+
'oma.llm.provider',
|
|
32
|
+
'oma.llm.response_model',
|
|
33
|
+
'oma.llm.turn',
|
|
34
|
+
'oma.model',
|
|
35
|
+
'oma.phase',
|
|
36
|
+
'oma.plan.approved',
|
|
37
|
+
'oma.plan.task_count',
|
|
38
|
+
'oma.provider',
|
|
39
|
+
'oma.release',
|
|
40
|
+
'oma.request.id',
|
|
41
|
+
'oma.retry.attempt',
|
|
42
|
+
'oma.retry.delay_ms',
|
|
43
|
+
'oma.retry.max_attempts',
|
|
44
|
+
'oma.status',
|
|
45
|
+
'oma.stream.type',
|
|
46
|
+
'oma.task.id',
|
|
47
|
+
'oma.task.retries',
|
|
48
|
+
'oma.tenant.id',
|
|
49
|
+
'oma.tool.is_error',
|
|
50
|
+
'oma.tool.name',
|
|
51
|
+
'oma.ttft.ms',
|
|
52
|
+
]);
|
|
53
|
+
function toAttributeValue(value) {
|
|
54
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean')
|
|
55
|
+
return value;
|
|
56
|
+
return [...value];
|
|
57
|
+
}
|
|
58
|
+
function isTokenUsageAttribute(key) {
|
|
59
|
+
return key.startsWith('oma.usage.') && (key.endsWith('_tokens') || key.endsWith('.tokens'));
|
|
60
|
+
}
|
|
61
|
+
/** OMA content is never exported by this package; only an explicit safe metadata allowlist crosses the boundary. */
|
|
62
|
+
export function isSafeOmaAttribute(key) {
|
|
63
|
+
if (!key.startsWith('oma.'))
|
|
64
|
+
return false;
|
|
65
|
+
if (isTokenUsageAttribute(key))
|
|
66
|
+
return true;
|
|
67
|
+
if (CONTENT_ATTRIBUTE.test(key) || SECRET_ATTRIBUTE.test(key))
|
|
68
|
+
return false;
|
|
69
|
+
return SAFE_OMA_ATTRIBUTES.has(key);
|
|
70
|
+
}
|
|
71
|
+
export function mapOmaAttributes(attributes) {
|
|
72
|
+
const mapped = {};
|
|
73
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
74
|
+
if (isSafeOmaAttribute(key))
|
|
75
|
+
mapped[key] = toAttributeValue(value);
|
|
76
|
+
}
|
|
77
|
+
return mapped;
|
|
78
|
+
}
|
|
79
|
+
function readNumber(attributes, ...keys) {
|
|
80
|
+
for (const key of keys) {
|
|
81
|
+
const value = attributes[key];
|
|
82
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
83
|
+
return value;
|
|
84
|
+
}
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
function readString(attributes, ...keys) {
|
|
88
|
+
for (const key of keys) {
|
|
89
|
+
const value = attributes[key];
|
|
90
|
+
if (typeof value === 'string' && value.length > 0)
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
/** Add a bounded compatibility subset of the current GenAI semantic conventions. */
|
|
96
|
+
export function addGenAiAttributes(kind, attributes) {
|
|
97
|
+
if (kind === 'llm')
|
|
98
|
+
attributes['gen_ai.operation.name'] = 'chat';
|
|
99
|
+
if (kind === 'agent')
|
|
100
|
+
attributes['gen_ai.operation.name'] = 'invoke_agent';
|
|
101
|
+
if (kind === 'tool')
|
|
102
|
+
attributes['gen_ai.operation.name'] = 'execute_tool';
|
|
103
|
+
const provider = readString(attributes, 'oma.llm.provider', 'oma.provider', 'oma.error.provider');
|
|
104
|
+
if (provider !== undefined)
|
|
105
|
+
attributes['gen_ai.provider.name'] = provider;
|
|
106
|
+
const model = readString(attributes, 'oma.llm.model', 'oma.model');
|
|
107
|
+
if (model !== undefined)
|
|
108
|
+
attributes['gen_ai.request.model'] = model;
|
|
109
|
+
const responseModel = readString(attributes, 'oma.llm.response_model', 'oma.response.model');
|
|
110
|
+
if (responseModel !== undefined)
|
|
111
|
+
attributes['gen_ai.response.model'] = responseModel;
|
|
112
|
+
const inputTokens = readNumber(attributes, 'oma.usage.input_tokens');
|
|
113
|
+
if (inputTokens !== undefined)
|
|
114
|
+
attributes['gen_ai.usage.input_tokens'] = inputTokens;
|
|
115
|
+
const outputTokens = readNumber(attributes, 'oma.usage.output_tokens');
|
|
116
|
+
if (outputTokens !== undefined)
|
|
117
|
+
attributes['gen_ai.usage.output_tokens'] = outputTokens;
|
|
118
|
+
const cacheRead = readNumber(attributes, 'oma.usage.cache_read_input_tokens', 'oma.usage.cache_read.input_tokens');
|
|
119
|
+
if (cacheRead !== undefined)
|
|
120
|
+
attributes['gen_ai.usage.cache_read.input_tokens'] = cacheRead;
|
|
121
|
+
const cacheCreation = readNumber(attributes, 'oma.usage.cache_creation_input_tokens', 'oma.usage.cache_creation.input_tokens');
|
|
122
|
+
if (cacheCreation !== undefined)
|
|
123
|
+
attributes['gen_ai.usage.cache_creation.input_tokens'] = cacheCreation;
|
|
124
|
+
const reasoningTokens = readNumber(attributes, 'oma.usage.reasoning_output_tokens', 'oma.usage.reasoning.output_tokens');
|
|
125
|
+
if (reasoningTokens !== undefined)
|
|
126
|
+
attributes['gen_ai.usage.reasoning.output_tokens'] = reasoningTokens;
|
|
127
|
+
const toolName = readString(attributes, 'oma.tool.name');
|
|
128
|
+
if (toolName !== undefined && kind === 'tool')
|
|
129
|
+
attributes['gen_ai.tool.name'] = toolName;
|
|
130
|
+
const ttftMs = readNumber(attributes, 'oma.ttft.ms');
|
|
131
|
+
if (ttftMs !== undefined)
|
|
132
|
+
attributes['gen_ai.response.time_to_first_chunk'] = ttftMs / 1_000;
|
|
133
|
+
}
|
|
134
|
+
export function mapSpanKind(kind) {
|
|
135
|
+
return kind === 'llm' ? OTelSpanKind.CLIENT : OTelSpanKind.INTERNAL;
|
|
136
|
+
}
|
|
137
|
+
/** Keep successful OMA instrumentation spans Unset, per the OTel Trace API guidance. */
|
|
138
|
+
export function mapStatus(status) {
|
|
139
|
+
switch (status.code) {
|
|
140
|
+
case 'error':
|
|
141
|
+
case 'timeout':
|
|
142
|
+
case 'budget_exhausted':
|
|
143
|
+
return {
|
|
144
|
+
code: SpanStatusCode.ERROR,
|
|
145
|
+
...(status.message ? { message: 'oma.' + status.code } : {}),
|
|
146
|
+
};
|
|
147
|
+
case 'ok':
|
|
148
|
+
case 'cancelled':
|
|
149
|
+
case 'rejected':
|
|
150
|
+
case 'skipped':
|
|
151
|
+
return { code: SpanStatusCode.UNSET };
|
|
152
|
+
}
|
|
153
|
+
return { code: SpanStatusCode.UNSET };
|
|
154
|
+
}
|
|
155
|
+
export function mapLink(link, resolvedContext) {
|
|
156
|
+
const resolved = resolvedContext !== undefined;
|
|
157
|
+
const context = resolvedContext ?? {
|
|
158
|
+
traceId: link.traceId,
|
|
159
|
+
spanId: link.spanId,
|
|
160
|
+
traceFlags: TraceFlags.NONE,
|
|
161
|
+
isRemote: true,
|
|
162
|
+
};
|
|
163
|
+
return {
|
|
164
|
+
context,
|
|
165
|
+
attributes: {
|
|
166
|
+
'oma.link.relation': link.relation,
|
|
167
|
+
'oma.link.resolved': resolved,
|
|
168
|
+
'oma.link.target.trace_id': link.traceId,
|
|
169
|
+
'oma.link.target.span_id': link.spanId,
|
|
170
|
+
...mapOmaAttributes(link.attributes ?? {}),
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export function baseAttributes(record) {
|
|
175
|
+
return {
|
|
176
|
+
'oma.schema.version': OMA_SCHEMA_VERSION,
|
|
177
|
+
'oma.otel.mapping.version': OMA_OTEL_MAPPING_VERSION,
|
|
178
|
+
'oma.otel.gen_ai_semconv.version': OTEL_GENAI_SEMCONV_VERSION,
|
|
179
|
+
'oma.record.id': record.recordId,
|
|
180
|
+
'oma.record.sequence': record.sequence,
|
|
181
|
+
'oma.record.type': record.recordType,
|
|
182
|
+
'oma.run.id': record.runId,
|
|
183
|
+
'oma.run.attempt': record.attempt,
|
|
184
|
+
'oma.trace.id': record.traceId,
|
|
185
|
+
'oma.span.id': record.spanId,
|
|
186
|
+
...(record.parentSpanId ? { 'oma.parent_span.id': record.parentSpanId } : {}),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export function spanAttributes(record) {
|
|
190
|
+
const attributes = {
|
|
191
|
+
...baseAttributes(record),
|
|
192
|
+
'oma.span.kind': record.kind,
|
|
193
|
+
...mapOmaAttributes(record.attributes),
|
|
194
|
+
};
|
|
195
|
+
addGenAiAttributes(record.kind, attributes);
|
|
196
|
+
return attributes;
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapping.js","sourceRoot":"","sources":["../src/mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,IAAI,YAAY,EACxB,cAAc,EACd,UAAU,GACX,MAAM,oBAAoB,CAAA;AAkB3B,2DAA2D;AAC3D,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAO,CAAA;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAAoB,CAAA;AAE9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAEnC,MAAM,iBAAiB,GAAG,8HAA8H,CAAA;AACxJ,MAAM,gBAAgB,GAAG,4IAA4I,CAAA;AACrK,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,mBAAmB;IACnB,gBAAgB;IAChB,sBAAsB;IACtB,iBAAiB;IACjB,uBAAuB;IACvB,mBAAmB;IACnB,qBAAqB;IACrB,wBAAwB;IACxB,qBAAqB;IACrB,sBAAsB;IACtB,qBAAqB;IACrB,uBAAuB;IACvB,iBAAiB;IACjB,mBAAmB;IACnB,wBAAwB;IACxB,iBAAiB;IACjB,iBAAiB;IACjB,eAAe;IACf,kBAAkB;IAClB,wBAAwB;IACxB,cAAc;IACd,WAAW;IACX,WAAW;IACX,mBAAmB;IACnB,qBAAqB;IACrB,cAAc;IACd,aAAa;IACb,gBAAgB;IAChB,mBAAmB;IACnB,oBAAoB;IACpB,wBAAwB;IACxB,YAAY;IACZ,iBAAiB;IACjB,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AI,CAAC,OAAO;YACxC,yBAAyB,EAAE,IAAI,CAAC,MAAM;YACtC,GAAG,gBAAgB,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC;SAC3C;KACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAyD;IACtF,OAAO;QACL,oBAAoB,EAAE,kBAAkB;QACxC,0BAA0B,EAAE,wBAAwB;QACpD,iCAAiC,EAAE,0BAA0B;QAC7D,eAAe,EAAE,MAAM,CAAC,QAAQ;QAChC,qBAAqB,EAAE,MAAM,CAAC,QAAQ;QACtC,iBAAiB,EAAE,MAAM,CAAC,UAAU;QACpC,YAAY,EAAE,MAAM,CAAC,KAAK;QAC1B,iBAAiB,EAAE,MAAM,CAAC,OAAO;QACjC,cAAc,EAAE,MAAM,CAAC,OAAO;QAC9B,aAAa,EAAE,MAAM,CAAC,MAAM;QAC5B,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9E,CAAA;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,MAAuC;IACpE,MAAM,UAAU,GAAe;QAC7B,GAAG,cAAc,CAAC,MAAM,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC,IAAI;QAC5B,GAAG,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC;KACvC,CAAA;IACD,kBAAkB,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IAC3C,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The published package version, used as the default tracer
|
|
3
|
+
* instrumentationVersion. A guard test asserts it matches package.json, so
|
|
4
|
+
* bumping the package without bumping this constant fails CI.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PACKAGE_VERSION = "0.1.0";
|
|
7
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,eAAe,UAAU,CAAA"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The published package version, used as the default tracer
|
|
3
|
+
* instrumentationVersion. A guard test asserts it matches package.json, so
|
|
4
|
+
* bumping the package without bumping this constant fails CI.
|
|
5
|
+
*/
|
|
6
|
+
export const PACKAGE_VERSION = '0.1.0';
|
|
7
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,OAAO,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@open-multi-agent/otel",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Optional OpenTelemetry adapter for @open-multi-agent/core TraceRecord v2.",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"README.md",
|
|
8
|
+
"LICENSE"
|
|
9
|
+
],
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "dist/index.js",
|
|
15
|
+
"types": "dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"test:watch": "vitest",
|
|
27
|
+
"lint": "tsc --noEmit -p tsconfig.lint.json",
|
|
28
|
+
"prepublishOnly": "npm run build"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"open-telemetry",
|
|
32
|
+
"opentelemetry",
|
|
33
|
+
"observability",
|
|
34
|
+
"multi-agent",
|
|
35
|
+
"llm"
|
|
36
|
+
],
|
|
37
|
+
"author": {
|
|
38
|
+
"name": "open-multi-agent",
|
|
39
|
+
"url": "https://github.com/open-multi-agent"
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/open-multi-agent/open-multi-agent.git",
|
|
45
|
+
"directory": "packages/otel"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/open-multi-agent/open-multi-agent#readme",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/open-multi-agent/open-multi-agent/issues"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18.0.0"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@open-multi-agent/core": "^1.11.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"@opentelemetry/api": "^1.9.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@opentelemetry/api": "^1.9.0",
|
|
62
|
+
"@opentelemetry/sdk-trace-base": "^2.9.0",
|
|
63
|
+
"@types/node": "^22.0.0",
|
|
64
|
+
"typescript": "^5.6.0",
|
|
65
|
+
"vitest": "^2.1.0"
|
|
66
|
+
}
|
|
67
|
+
}
|