@sammorrowdrums/mcpi-telemetry 0.85.0-bootstrap.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 +464 -0
- package/dist/index.d.ts +194 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/memory.d.ts +26 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +154 -0
- package/dist/memory.js.map +1 -0
- package/dist/noop.d.ts +4 -0
- package/dist/noop.d.ts.map +1 -0
- package/dist/noop.js +18 -0
- package/dist/noop.js.map +1 -0
- package/dist/testing/conformance.d.ts +4 -0
- package/dist/testing/conformance.d.ts.map +1 -0
- package/dist/testing/conformance.js +294 -0
- package/dist/testing/conformance.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +2 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/types.d.ts +16 -0
- package/dist/testing/types.d.ts.map +1 -0
- package/dist/testing/types.js +2 -0
- package/dist/testing/types.js.map +1 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Mario Zechner
|
|
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,464 @@
|
|
|
1
|
+
# @sammorrowdrums/mcpi-telemetry
|
|
2
|
+
|
|
3
|
+
Vendor-neutral telemetry contracts and typed schema utilities for mcpi packages.
|
|
4
|
+
|
|
5
|
+
This package provides:
|
|
6
|
+
|
|
7
|
+
- an explicit, callback-based `TelemetryContext` / `TelemetrySpan` contract;
|
|
8
|
+
- a shared `NOOP_TELEMETRY_CONTEXT`;
|
|
9
|
+
- a reference `InMemoryTelemetryContext` implementation;
|
|
10
|
+
- serializable schema definitions with inferred TypeScript types;
|
|
11
|
+
- no exporter, global current-span state, or dependency on a telemetry backend.
|
|
12
|
+
|
|
13
|
+
Applications can use the in-memory reference or provide an adapter for OpenTelemetry, Sentry, logs, or another backend. mcpi packages pass telemetry contexts explicitly and define their domain schemas separately.
|
|
14
|
+
|
|
15
|
+
## Table of Contents
|
|
16
|
+
|
|
17
|
+
- [Installation](#installation)
|
|
18
|
+
- [Telemetry Concepts](#telemetry-concepts)
|
|
19
|
+
- [Core Context API](#core-context-api)
|
|
20
|
+
- [Adapter Contract](#adapter-contract)
|
|
21
|
+
- [No-op Context](#no-op-context)
|
|
22
|
+
- [In-Memory Reference Adapter](#in-memory-reference-adapter)
|
|
23
|
+
- [Adapter Conformance](#adapter-conformance)
|
|
24
|
+
- [Typed Schemas](#typed-schemas)
|
|
25
|
+
- [Start and Completion Attributes](#start-and-completion-attributes)
|
|
26
|
+
- [Schema Metadata](#schema-metadata)
|
|
27
|
+
- [mcpi Package Integration](#mcpi-package-integration)
|
|
28
|
+
- [Security and Portability](#security-and-portability)
|
|
29
|
+
- [API Reference](#api-reference)
|
|
30
|
+
- [Development](#development)
|
|
31
|
+
- [License](#license)
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install @sammorrowdrums/mcpi-telemetry
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Telemetry Concepts
|
|
40
|
+
|
|
41
|
+
Telemetry describes what a program did while it was running. This package models that work using spans, attributes, events, statuses, and explicit context:
|
|
42
|
+
|
|
43
|
+
| Concept | Plain-language meaning |
|
|
44
|
+
|---|---|
|
|
45
|
+
| **Span** | A timed record of one operation, such as loading an account or making an AI request. It begins before the work and ends when the work finishes. |
|
|
46
|
+
| **Parent and child spans** | Operations can contain smaller operations. A request span might contain a cache lookup and a database query. Together they form a tree showing where time was spent. |
|
|
47
|
+
| **Attribute** | A named fact attached to a span, such as `provider: "openai"`, `cache.hit: true`, or `item_count: 12`. Attributes describe the operation and its result. |
|
|
48
|
+
| **Event** | A named occurrence at a point during a span, such as `retry.scheduled` or `cache.lookup`. Events have no duration and may carry their own attributes. |
|
|
49
|
+
| **Status** | The operation's outcome: `ok` or `error`. An error status may include an error name and message. |
|
|
50
|
+
| **Context** | A handle identifying where new work belongs in the span tree. Starting a span from a context makes it a child of that context. |
|
|
51
|
+
|
|
52
|
+
For example, loading an account could produce this telemetry:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
example.account.load span
|
|
56
|
+
├─ attributes: account.id=123, found=true facts about the span
|
|
57
|
+
├─ event: example.cache.lookup occurrence during the span
|
|
58
|
+
│ └─ attribute: cache.hit=false fact about the event
|
|
59
|
+
└─ status: ok final outcome
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
A span is diagnostic data, not business state. Recording it must not change whether the account load runs, succeeds, fails, or is persisted. An adapter translates these generic concepts into the corresponding concepts used by OpenTelemetry, Sentry, logs, or another backend.
|
|
63
|
+
|
|
64
|
+
## Core Context API
|
|
65
|
+
|
|
66
|
+
A `TelemetryContext` starts a span around a callback. The callback receives a `TelemetrySpan`, which is also the explicit parent context for child spans.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import {
|
|
70
|
+
NOOP_TELEMETRY_CONTEXT,
|
|
71
|
+
type TelemetryContext,
|
|
72
|
+
} from '@sammorrowdrums/mcpi-telemetry';
|
|
73
|
+
|
|
74
|
+
async function loadAccount(
|
|
75
|
+
accountId: string,
|
|
76
|
+
telemetryContext: TelemetryContext = NOOP_TELEMETRY_CONTEXT,
|
|
77
|
+
) {
|
|
78
|
+
return telemetryContext.startSpan(
|
|
79
|
+
{
|
|
80
|
+
name: 'example.account.load',
|
|
81
|
+
attributes: { 'example.account.id': accountId },
|
|
82
|
+
},
|
|
83
|
+
async (span) => {
|
|
84
|
+
const account = await readAccount(accountId);
|
|
85
|
+
span.setAttributes({ 'example.account.found': account !== undefined });
|
|
86
|
+
return account;
|
|
87
|
+
},
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Pass the callback span to lower-level work to create explicit nesting:
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
return telemetryContext.startSpan({ name: 'example.parent' }, async (parentSpan) => {
|
|
96
|
+
return parentSpan.startSpan({ name: 'example.child' }, async (childSpan) => {
|
|
97
|
+
childSpan.addEvent('example.cache.lookup', { 'example.cache.hit': true });
|
|
98
|
+
return performWork();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
There is no public `end()` method. `startSpan()` owns settlement and keeps the span open until the callback's value or promise settles. For an expected failure represented by a normal return value, set the status explicitly:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
return telemetryContext.startSpan({ name: 'example.save' }, async (span) => {
|
|
107
|
+
const result = await save();
|
|
108
|
+
if (!result.ok) {
|
|
109
|
+
span.setStatus({
|
|
110
|
+
status: 'error',
|
|
111
|
+
error: { name: 'SaveError', message: result.reason },
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Adapter Contract
|
|
119
|
+
|
|
120
|
+
An adapter implements `TelemetryContext` and bridges the generic API to its backend. It must:
|
|
121
|
+
|
|
122
|
+
- create a child span and invoke the callback synchronously, exactly once;
|
|
123
|
+
- preserve the callback's returned value and rejection value, returning a promise rejected with the same value after a synchronous throw;
|
|
124
|
+
- keep the native span open until a returned promise settles;
|
|
125
|
+
- treat normal completion as `ok` and throws/rejections as errors unless an explicit status was set;
|
|
126
|
+
- make repeated `setStatus()` calls last-write-wins;
|
|
127
|
+
- merge `setAttributes()` calls, with later defined values replacing earlier values and `undefined` ignored;
|
|
128
|
+
- make recording methods synchronous, passive, and non-throwing;
|
|
129
|
+
- ignore calls made after settlement;
|
|
130
|
+
- ignore a failed recording call atomically, suppress backend failures, and still execute the business callback exactly once.
|
|
131
|
+
|
|
132
|
+
Adapters may activate backend-native ambient context internally for automatic instrumentation, but mcpi code always propagates the parent through `TelemetryContext` arguments. Exporter buffering, flushing, sampling, backend IDs, and backend-specific context objects belong to the adapter. Use the [adapter conformance suite](#adapter-conformance) to check these observable semantics.
|
|
133
|
+
|
|
134
|
+
## No-op Context
|
|
135
|
+
|
|
136
|
+
Use `NOOP_TELEMETRY_CONTEXT` when telemetry is optional:
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
import { NOOP_TELEMETRY_CONTEXT } from '@sammorrowdrums/mcpi-telemetry';
|
|
140
|
+
|
|
141
|
+
const result = await NOOP_TELEMETRY_CONTEXT.startSpan(
|
|
142
|
+
{ name: 'example.operation' },
|
|
143
|
+
() => runOperation(),
|
|
144
|
+
);
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The no-op context:
|
|
148
|
+
|
|
149
|
+
- invokes callbacks synchronously;
|
|
150
|
+
- preserves returned values and asynchronous rejections, and converts a synchronous throw to a promise rejected with the same value;
|
|
151
|
+
- uses one shared frozen inert span, including for nested spans;
|
|
152
|
+
- does not inspect or retain names, attributes, events, or statuses.
|
|
153
|
+
|
|
154
|
+
## In-Memory Reference Adapter
|
|
155
|
+
|
|
156
|
+
`InMemoryTelemetryContext` is the backend-neutral reference implementation. It is useful for tests, local diagnostics, and applications that intentionally want process-local capture without an exporter:
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
import { InMemoryTelemetryContext } from '@sammorrowdrums/mcpi-telemetry';
|
|
160
|
+
|
|
161
|
+
const telemetry = new InMemoryTelemetryContext();
|
|
162
|
+
|
|
163
|
+
await telemetry.startSpan(
|
|
164
|
+
{ name: 'example.operation', attributes: { input: 'demo' } },
|
|
165
|
+
async (span) => {
|
|
166
|
+
span.addEvent('example.started');
|
|
167
|
+
span.setAttributes({ output_count: 3 });
|
|
168
|
+
},
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
console.log(telemetry.getSpans());
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`getSpans()` returns detached snapshots in span-start order. Each `RecordedTelemetrySpan` contains a deterministic numeric ID, parent ID, merged attributes, ordered events, final status, settlement state, and deterministic end sequence. It records no timestamps.
|
|
175
|
+
|
|
176
|
+
The adapter is safe to use as an ordinary `TelemetryContext`, but storage is unbounded and process-local. Create a fresh instance to isolate tests or recording scopes, and do not capture sensitive attributes unless the caller's data policy allows them.
|
|
177
|
+
|
|
178
|
+
## Adapter Conformance
|
|
179
|
+
|
|
180
|
+
`@sammorrowdrums/mcpi-telemetry/testing` exports a runner-independent conformance suite modeled as grouped cases. A fixture supplies a fresh context and converts its backend's finished spans into normalized `RecordedTelemetrySpan` snapshots:
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
import {
|
|
184
|
+
createTelemetryAdapterConformance,
|
|
185
|
+
type TelemetryAdapterFixture,
|
|
186
|
+
} from '@sammorrowdrums/mcpi-telemetry/testing';
|
|
187
|
+
import { describe, it } from 'vitest';
|
|
188
|
+
|
|
189
|
+
const conformance = createTelemetryAdapterConformance(async () => {
|
|
190
|
+
const adapter = createMyTelemetryAdapter();
|
|
191
|
+
return {
|
|
192
|
+
context: adapter.context,
|
|
193
|
+
getSpans: async () => adapter.normalizedSpans(),
|
|
194
|
+
async [Symbol.asyncDispose]() {
|
|
195
|
+
await adapter.close();
|
|
196
|
+
},
|
|
197
|
+
} satisfies TelemetryAdapterFixture;
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
for (const group of new Set(conformance.map((testCase) => testCase.group))) {
|
|
201
|
+
describe(group, () => {
|
|
202
|
+
for (const testCase of conformance.filter((candidate) => candidate.group === group)) {
|
|
203
|
+
it(testCase.name, () => testCase.run());
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The suite checks synchronous single admission, result and rejection identity, automatic and explicit status, attribute merging, event ordering, inert post-settlement calls, nested and concurrent parentage, and suppression of unreadable telemetry payload failures. `getSpans()` may flush an asynchronous exporter before returning. The testing subpath uses Node's assertion APIs; the root telemetry package remains runtime-neutral.
|
|
210
|
+
|
|
211
|
+
## Typed Schemas
|
|
212
|
+
|
|
213
|
+
The low-level span API intentionally accepts open names and attribute bags so adapters remain generic. Domain packages can define closed, serializable schemas and infer exact TypeScript types from them.
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import {
|
|
217
|
+
createTypedSpanStarter,
|
|
218
|
+
defineTelemetrySchema,
|
|
219
|
+
} from '@sammorrowdrums/mcpi-telemetry';
|
|
220
|
+
|
|
221
|
+
export const EXAMPLE_TELEMETRY_SCHEMA = defineTelemetrySchema({
|
|
222
|
+
version: 1,
|
|
223
|
+
spans: {
|
|
224
|
+
'example.read': {
|
|
225
|
+
description: 'Read one resource',
|
|
226
|
+
parents: { kind: 'any' },
|
|
227
|
+
startAttributes: {
|
|
228
|
+
'example.resource': {
|
|
229
|
+
type: 'string',
|
|
230
|
+
required: true,
|
|
231
|
+
values: ['account', 'project'],
|
|
232
|
+
description: 'Resource kind',
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
endAttributes: {
|
|
236
|
+
'example.item_count': {
|
|
237
|
+
type: 'number',
|
|
238
|
+
description: 'Number of returned items',
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
events: {
|
|
242
|
+
'example.cache': {
|
|
243
|
+
description: 'Cache lookup result',
|
|
244
|
+
attributes: {
|
|
245
|
+
'example.cache.hit': {
|
|
246
|
+
type: 'boolean',
|
|
247
|
+
required: true,
|
|
248
|
+
description: 'Whether the cache contained the resource',
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
status: {
|
|
254
|
+
default: 'ok',
|
|
255
|
+
errorWhen: 'The read throws or returns an error result',
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
} as const);
|
|
260
|
+
|
|
261
|
+
const startSpan = createTypedSpanStarter(
|
|
262
|
+
telemetryContext,
|
|
263
|
+
[EXAMPLE_TELEMETRY_SCHEMA],
|
|
264
|
+
);
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
The starter exposes one overload per span and checks names and attributes at compile time. Union-valued names must be narrowed before a call, preserving the relationship between each runtime name and its attribute schema. Its callback receives a child starter over the same schemas, already bound to the callback span:
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
await startSpan(
|
|
271
|
+
'example.read',
|
|
272
|
+
{ 'example.resource': 'account' },
|
|
273
|
+
async (span, startChildSpan) => {
|
|
274
|
+
span.addEvent('example.cache', { 'example.cache.hit': true });
|
|
275
|
+
const accounts = await readAccounts();
|
|
276
|
+
span.setAttributes({ 'example.item_count': accounts.length });
|
|
277
|
+
|
|
278
|
+
await startChildSpan(
|
|
279
|
+
'example.read',
|
|
280
|
+
{ 'example.resource': 'project' },
|
|
281
|
+
async (childSpan) => {
|
|
282
|
+
const projects = await readProjects();
|
|
283
|
+
childSpan.setAttributes({ 'example.item_count': projects.length });
|
|
284
|
+
},
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
return accounts;
|
|
288
|
+
},
|
|
289
|
+
);
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Start and Completion Attributes
|
|
293
|
+
|
|
294
|
+
`startAttributes` and `endAttributes` describe when an attribute is normally known, not separate runtime storage:
|
|
295
|
+
|
|
296
|
+
| Schema field | How values are recorded | Requiredness |
|
|
297
|
+
|---|---|---|
|
|
298
|
+
| `startAttributes` | Passed in the typed starter's `attributes` argument when the span is created | Each definition explicitly sets `required: true` or `false` |
|
|
299
|
+
| `endAttributes` | Added later through the schema-scoped span's `setAttributes()` method | Always optional |
|
|
300
|
+
|
|
301
|
+
Both sets become ordinary attributes on the same backend span. There is no separate end-attribute payload or end callback. In the preceding example, `example.resource` is known when `example.read` starts, while `example.item_count` is known only after `readAccounts()` returns:
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
await startSpan(
|
|
305
|
+
'example.read',
|
|
306
|
+
{ 'example.resource': 'account' }, // required start attribute
|
|
307
|
+
async (span) => {
|
|
308
|
+
const accounts = await readAccounts();
|
|
309
|
+
span.setAttributes({
|
|
310
|
+
'example.item_count': accounts.length, // optional completion attribute
|
|
311
|
+
});
|
|
312
|
+
return accounts;
|
|
313
|
+
},
|
|
314
|
+
); // resolving the callback settles the span
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
“End” means completion enrichment: an end attribute may be set at any point while the callback is active, and it may be omitted when unavailable. Calling `setAttributes()` zero times is valid. This matters for early failures, cancellation, and provider-specific data that may not exist on every path.
|
|
318
|
+
|
|
319
|
+
Repeated `setAttributes()` calls merge into the same attribute bag. A later defined value replaces an earlier value for the same key, while `undefined` is ignored. The schema-scoped method accepts only the current span's declared end attributes.
|
|
320
|
+
|
|
321
|
+
Attributes do not end the span. Returning, resolving, throwing, or rejecting from the callback controls settlement; `startSpan()` performs the actual end operation. Adapter calls made after settlement are inert.
|
|
322
|
+
|
|
323
|
+
A starter can compose multiple independently versioned schemas:
|
|
324
|
+
|
|
325
|
+
```typescript
|
|
326
|
+
import { AGENT_TELEMETRY_SCHEMAS } from '@sammorrowdrums/mcpi-agent-core';
|
|
327
|
+
|
|
328
|
+
const startAgentSpan = createTypedSpanStarter(
|
|
329
|
+
telemetryContext,
|
|
330
|
+
AGENT_TELEMETRY_SCHEMAS,
|
|
331
|
+
);
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Inline schema arrays retain their tuple types automatically. Separately declared arrays should use `as const`. Literal duplicate span names across the array are rejected at compile time; schemas are not merged, inspected, or retained at runtime.
|
|
335
|
+
|
|
336
|
+
Schema-derived types reject missing required attributes, unknown keys, invalid closed-set values, undeclared events, and attributes on empty schemas. End attributes are always optional enrichment; the type system does not require `setAttributes()` to be called.
|
|
337
|
+
|
|
338
|
+
`defineTelemetrySchema()` is a typed identity function. It returns ordinary JSON-serializable data and performs no runtime validation or parent-rule enforcement.
|
|
339
|
+
|
|
340
|
+
## Schema Metadata
|
|
341
|
+
|
|
342
|
+
Supported attribute types are:
|
|
343
|
+
|
|
344
|
+
- `string`, `number`, and `boolean`;
|
|
345
|
+
- `string[]`, `number[]`, and `boolean[]`.
|
|
346
|
+
|
|
347
|
+
Attribute definitions support:
|
|
348
|
+
|
|
349
|
+
- `values`: a closed set for scalar values;
|
|
350
|
+
- `elementValues`: a closed set for array elements;
|
|
351
|
+
- `examples`: documentation examples;
|
|
352
|
+
- `sensitive`: marks data requiring special handling;
|
|
353
|
+
- `cardinality`: records expected `low` or `high` cardinality.
|
|
354
|
+
|
|
355
|
+
Start and event attributes declare `required`. End attributes do not; see [Start and Completion Attributes](#start-and-completion-attributes).
|
|
356
|
+
|
|
357
|
+
Parent metadata is descriptive schema data:
|
|
358
|
+
|
|
359
|
+
- `{ kind: 'any' }`: root or any caller span;
|
|
360
|
+
- `{ kind: 'root_or_external' }`: root or a caller-owned span outside the schema;
|
|
361
|
+
- `{ kind: 'spans', spans: [...] }`: only the listed schema spans.
|
|
362
|
+
|
|
363
|
+
Adapters do not need to understand schema objects. Instrumentation helpers and tests use them to keep emitted names and attributes consistent.
|
|
364
|
+
|
|
365
|
+
## mcpi Package Integration
|
|
366
|
+
|
|
367
|
+
Package ownership is intentionally split:
|
|
368
|
+
|
|
369
|
+
- `@sammorrowdrums/mcpi-telemetry` owns the vendor-neutral contract, no-op and in-memory reference contexts, schema utilities, and adapter conformance suite;
|
|
370
|
+
- `@sammorrowdrums/mcpi-ai` accepts and propagates `telemetryContext` in provider request options but owns no telemetry schema;
|
|
371
|
+
- `@sammorrowdrums/mcpi-agent-core` owns and exports the AI-request and harness schemas, their combined readonly schema tuple, and typed span helpers.
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
import {
|
|
375
|
+
AGENT_TELEMETRY_SCHEMAS,
|
|
376
|
+
AI_TELEMETRY_SCHEMA,
|
|
377
|
+
HARNESS_TELEMETRY_SCHEMA,
|
|
378
|
+
startAiSpan,
|
|
379
|
+
startHarnessSpan,
|
|
380
|
+
} from '@sammorrowdrums/mcpi-agent-core';
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
The established `pi.ai.*`, `pi.harness.*`, and `pi.session.*` schema names are retained as telemetry protocol identifiers so existing adapters do not break. They are compatibility vocabulary, not mcpi product branding. Adapters may translate them to backend conventions without changing the emitted vocabulary.
|
|
384
|
+
|
|
385
|
+
## Security and Portability
|
|
386
|
+
|
|
387
|
+
Telemetry is process-local diagnostics, not durable application state. Do not persist a `TelemetryContext`, `TelemetrySpan`, or backend-native trace object in records, messages, snapshots, or deferred handles.
|
|
388
|
+
|
|
389
|
+
Attribute values are intentionally limited to primitive scalars and arrays. Domain instrumentation should avoid prompts, completions, tool arguments or output, file contents, provider payloads, headers, credentials, and free-form error details unless its schema and data policy explicitly allow them.
|
|
390
|
+
|
|
391
|
+
The package does not use `AsyncLocalStorage` or another runtime-specific ambient context API. It is suitable for Node.js, Bun, browsers, and workers; backend adapters remain responsible for their own runtime compatibility.
|
|
392
|
+
|
|
393
|
+
## API Reference
|
|
394
|
+
|
|
395
|
+
### Core types and values
|
|
396
|
+
|
|
397
|
+
| Export | Purpose |
|
|
398
|
+
|---|---|
|
|
399
|
+
| `TelemetryContext` | Starts callback-managed child spans |
|
|
400
|
+
| `TelemetrySpan` | Records attributes, events, and status; also acts as a child context |
|
|
401
|
+
| `SpanOptions` | Span name and optional start attributes |
|
|
402
|
+
| `SpanAttributes` / `AttributeValue` | Open adapter-level attribute bag and supported values |
|
|
403
|
+
| `SpanStatus` | Explicit `ok` or `error` status |
|
|
404
|
+
| `NOOP_TELEMETRY_CONTEXT` | Shared passive context for disabled telemetry |
|
|
405
|
+
| `InMemoryTelemetryContext` | Reference adapter with deterministic process-local recording |
|
|
406
|
+
| `RecordedTelemetrySpan` | Normalized captured span snapshot |
|
|
407
|
+
| `RecordedTelemetryEvent` | Normalized captured event snapshot |
|
|
408
|
+
|
|
409
|
+
### Schema definitions and inference
|
|
410
|
+
|
|
411
|
+
| Export | Purpose |
|
|
412
|
+
|---|---|
|
|
413
|
+
| `defineTelemetrySchema()` | Typed identity helper for serializable schema data |
|
|
414
|
+
| `createTypedSpanStarter()` | Binds a parent context to one or more schema vocabularies |
|
|
415
|
+
| `TypedSpanStarter` | Exact starter type with recursively child-bound callbacks |
|
|
416
|
+
| `TelemetrySchemaDefinition` | Top-level schema shape |
|
|
417
|
+
| `TelemetrySpanDefinition` | Span metadata, parents, attributes, events, and status rule |
|
|
418
|
+
| `TelemetryAttributeType` | Supported scalar and array type names |
|
|
419
|
+
| `TelemetryAttributeMetadata` | Description, sensitivity, and cardinality metadata |
|
|
420
|
+
| `TelemetryAttributeDefinition` | Attribute type, allowed values, examples, and metadata |
|
|
421
|
+
| `TelemetryStartAttributeDefinition` | Start attribute definition with requiredness |
|
|
422
|
+
| `TelemetryEventAttributeDefinition` | Event attribute definition with requiredness |
|
|
423
|
+
| `TelemetryEventDefinition` | Event description and attribute definitions |
|
|
424
|
+
| `TelemetryParentDefinition` | Open, external-root, or finite schema-parent rule |
|
|
425
|
+
| `TelemetrySchemaSpanName` | Union of declared span names |
|
|
426
|
+
| `TelemetrySchemaSpanStartAttributes` | Exact inferred start attributes for one span |
|
|
427
|
+
| `TelemetrySchemaSpanEndAttributes` | Optional inferred end attributes for one span |
|
|
428
|
+
| `TelemetrySchemaSpanEventName` | Union of events declared by one span |
|
|
429
|
+
| `TelemetrySchemaSpanEventAttributes` | Exact inferred attributes for one event |
|
|
430
|
+
| `SchemaTelemetrySpan` | Span view restricted to one schema span |
|
|
431
|
+
| `TelemetrySchemaSpanUnion` | Discriminated union of all spans in a schema |
|
|
432
|
+
| `InferStartAttributes` | Required and optional values inferred from start definitions |
|
|
433
|
+
| `InferOptionalAttributes` | Optional values inferred from end definitions |
|
|
434
|
+
| `InferEventAttributes` | Required and optional values inferred from event definitions |
|
|
435
|
+
| `InferRequiredAndOptionalAttributes` | Shared inference utility for definitions with requiredness |
|
|
436
|
+
| `ExactTelemetryAttributes` | Rejects keys outside an expected attribute set |
|
|
437
|
+
|
|
438
|
+
### Testing subpath
|
|
439
|
+
|
|
440
|
+
| Export | Purpose |
|
|
441
|
+
|---|---|
|
|
442
|
+
| `createTelemetryAdapterConformance()` | Creates runner-independent adapter conformance cases |
|
|
443
|
+
| `TelemetryAdapterFixture` | Fresh context and normalized snapshot reader for one case |
|
|
444
|
+
| `TelemetryAdapterFixtureFactory` | Creates isolated fixtures |
|
|
445
|
+
| `TelemetryAdapterConformanceCase` | Grouped case that test runners execute |
|
|
446
|
+
|
|
447
|
+
## Development
|
|
448
|
+
|
|
449
|
+
From this package directory:
|
|
450
|
+
|
|
451
|
+
```bash
|
|
452
|
+
npm test
|
|
453
|
+
npm run build
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
Repository-wide type checking, formatting, linting, and smoke checks run with:
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
npm run check
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
## License
|
|
463
|
+
|
|
464
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
export type AttributeValue = string | number | boolean | readonly string[] | readonly number[] | readonly boolean[];
|
|
2
|
+
export interface SpanAttributes {
|
|
3
|
+
[name: string]: AttributeValue | undefined;
|
|
4
|
+
}
|
|
5
|
+
export interface SpanOptions {
|
|
6
|
+
name: string;
|
|
7
|
+
attributes?: SpanAttributes;
|
|
8
|
+
}
|
|
9
|
+
export type SpanStatus = {
|
|
10
|
+
status: "ok";
|
|
11
|
+
} | {
|
|
12
|
+
status: "error";
|
|
13
|
+
error?: {
|
|
14
|
+
name: string;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export interface TelemetryContext {
|
|
19
|
+
startSpan<T>(options: SpanOptions, callback: (span: TelemetrySpan) => T | Promise<T>): Promise<T>;
|
|
20
|
+
}
|
|
21
|
+
export interface TelemetrySpan extends TelemetryContext {
|
|
22
|
+
addEvent(name: string, attributes?: SpanAttributes): void;
|
|
23
|
+
setAttributes(attributes: SpanAttributes): void;
|
|
24
|
+
setStatus(status: SpanStatus): void;
|
|
25
|
+
}
|
|
26
|
+
export { NOOP_TELEMETRY_CONTEXT } from "./noop.ts";
|
|
27
|
+
export type TelemetryAttributeType = "string" | "number" | "boolean" | "string[]" | "number[]" | "boolean[]";
|
|
28
|
+
export interface TelemetryAttributeMetadata {
|
|
29
|
+
description: string;
|
|
30
|
+
sensitive?: boolean;
|
|
31
|
+
cardinality?: "low" | "high";
|
|
32
|
+
}
|
|
33
|
+
export type TelemetryAttributeDefinition = TelemetryAttributeMetadata & ({
|
|
34
|
+
type: "string";
|
|
35
|
+
values?: readonly string[];
|
|
36
|
+
examples?: readonly string[];
|
|
37
|
+
} | {
|
|
38
|
+
type: "number";
|
|
39
|
+
values?: readonly number[];
|
|
40
|
+
examples?: readonly number[];
|
|
41
|
+
} | {
|
|
42
|
+
type: "boolean";
|
|
43
|
+
values?: readonly boolean[];
|
|
44
|
+
examples?: readonly boolean[];
|
|
45
|
+
} | {
|
|
46
|
+
type: "string[]";
|
|
47
|
+
elementValues?: readonly string[];
|
|
48
|
+
examples?: readonly (readonly string[])[];
|
|
49
|
+
} | {
|
|
50
|
+
type: "number[]";
|
|
51
|
+
elementValues?: readonly number[];
|
|
52
|
+
examples?: readonly (readonly number[])[];
|
|
53
|
+
} | {
|
|
54
|
+
type: "boolean[]";
|
|
55
|
+
elementValues?: readonly boolean[];
|
|
56
|
+
examples?: readonly (readonly boolean[])[];
|
|
57
|
+
});
|
|
58
|
+
export type TelemetryStartAttributeDefinition = TelemetryAttributeDefinition & {
|
|
59
|
+
required: boolean;
|
|
60
|
+
};
|
|
61
|
+
export type TelemetryEventAttributeDefinition = TelemetryAttributeDefinition & {
|
|
62
|
+
required: boolean;
|
|
63
|
+
};
|
|
64
|
+
export interface TelemetryEventDefinition {
|
|
65
|
+
description: string;
|
|
66
|
+
attributes: Record<string, TelemetryEventAttributeDefinition>;
|
|
67
|
+
}
|
|
68
|
+
export type TelemetryParentDefinition = {
|
|
69
|
+
kind: "any";
|
|
70
|
+
} | {
|
|
71
|
+
kind: "root_or_external";
|
|
72
|
+
} | {
|
|
73
|
+
kind: "spans";
|
|
74
|
+
spans: readonly string[];
|
|
75
|
+
};
|
|
76
|
+
export interface TelemetrySpanDefinition {
|
|
77
|
+
description: string;
|
|
78
|
+
parents: TelemetryParentDefinition;
|
|
79
|
+
startAttributes: Record<string, TelemetryStartAttributeDefinition>;
|
|
80
|
+
endAttributes: Record<string, TelemetryAttributeDefinition>;
|
|
81
|
+
events?: Record<string, TelemetryEventDefinition>;
|
|
82
|
+
status: {
|
|
83
|
+
default: "ok";
|
|
84
|
+
errorWhen: string;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export interface TelemetrySchemaDefinition {
|
|
88
|
+
version: number;
|
|
89
|
+
spans: Record<string, TelemetrySpanDefinition>;
|
|
90
|
+
}
|
|
91
|
+
/** Typed identity helper for serializable telemetry schema data. */
|
|
92
|
+
export declare function defineTelemetrySchema<const T extends TelemetrySchemaDefinition>(schema: T): T;
|
|
93
|
+
type AttributeDefinitionValue<Definition extends TelemetryAttributeDefinition> = Definition extends {
|
|
94
|
+
type: "string";
|
|
95
|
+
values: readonly (infer Value extends string)[];
|
|
96
|
+
} ? Value : Definition extends {
|
|
97
|
+
type: "string";
|
|
98
|
+
} ? string : Definition extends {
|
|
99
|
+
type: "number";
|
|
100
|
+
values: readonly (infer Value extends number)[];
|
|
101
|
+
} ? Value : Definition extends {
|
|
102
|
+
type: "number";
|
|
103
|
+
} ? number : Definition extends {
|
|
104
|
+
type: "boolean";
|
|
105
|
+
values: readonly (infer Value extends boolean)[];
|
|
106
|
+
} ? Value : Definition extends {
|
|
107
|
+
type: "boolean";
|
|
108
|
+
} ? boolean : Definition extends {
|
|
109
|
+
type: "string[]";
|
|
110
|
+
elementValues: readonly (infer Value extends string)[];
|
|
111
|
+
} ? readonly Value[] : Definition extends {
|
|
112
|
+
type: "string[]";
|
|
113
|
+
} ? readonly string[] : Definition extends {
|
|
114
|
+
type: "number[]";
|
|
115
|
+
elementValues: readonly (infer Value extends number)[];
|
|
116
|
+
} ? readonly Value[] : Definition extends {
|
|
117
|
+
type: "number[]";
|
|
118
|
+
} ? readonly number[] : Definition extends {
|
|
119
|
+
type: "boolean[]";
|
|
120
|
+
elementValues: readonly (infer Value extends boolean)[];
|
|
121
|
+
} ? readonly Value[] : readonly boolean[];
|
|
122
|
+
type RequiredAttributeNames<Definitions extends Record<string, TelemetryStartAttributeDefinition | TelemetryEventAttributeDefinition>> = {
|
|
123
|
+
[Name in keyof Definitions]-?: Definitions[Name]["required"] extends true ? Name : never;
|
|
124
|
+
}[keyof Definitions];
|
|
125
|
+
type OptionalAttributeNames<Definitions extends Record<string, TelemetryStartAttributeDefinition | TelemetryEventAttributeDefinition>> = Exclude<keyof Definitions, RequiredAttributeNames<Definitions>>;
|
|
126
|
+
export type InferRequiredAndOptionalAttributes<Definitions extends Record<string, TelemetryStartAttributeDefinition | TelemetryEventAttributeDefinition>> = keyof Definitions extends never ? Record<string, never> : {
|
|
127
|
+
[Name in RequiredAttributeNames<Definitions>]: AttributeDefinitionValue<Definitions[Name]>;
|
|
128
|
+
} & {
|
|
129
|
+
[Name in OptionalAttributeNames<Definitions>]?: AttributeDefinitionValue<Definitions[Name]>;
|
|
130
|
+
};
|
|
131
|
+
export type InferStartAttributes<Definitions extends Record<string, TelemetryStartAttributeDefinition>> = InferRequiredAndOptionalAttributes<Definitions>;
|
|
132
|
+
export type InferOptionalAttributes<Definitions extends Record<string, TelemetryAttributeDefinition>> = keyof Definitions extends never ? Record<string, never> : {
|
|
133
|
+
[Name in keyof Definitions]?: AttributeDefinitionValue<Definitions[Name]>;
|
|
134
|
+
};
|
|
135
|
+
export type ExactTelemetryAttributes<Expected, Actual extends Expected> = Actual & Record<Exclude<keyof Actual, keyof Expected>, never>;
|
|
136
|
+
export type InferEventAttributes<Definitions extends Record<string, TelemetryEventAttributeDefinition>> = InferRequiredAndOptionalAttributes<Definitions>;
|
|
137
|
+
export type TelemetrySchemaSpanName<Schema extends TelemetrySchemaDefinition> = keyof Schema["spans"] & string;
|
|
138
|
+
type SchemaSpan<Schema extends TelemetrySchemaDefinition, Name extends TelemetrySchemaSpanName<Schema>> = Schema["spans"][Name];
|
|
139
|
+
export type TelemetrySchemaSpanStartAttributes<Schema extends TelemetrySchemaDefinition, Name extends TelemetrySchemaSpanName<Schema>> = SchemaSpan<Schema, Name>["startAttributes"] extends infer Definitions extends Record<string, TelemetryStartAttributeDefinition> ? InferStartAttributes<Definitions> : never;
|
|
140
|
+
export type TelemetrySchemaSpanEndAttributes<Schema extends TelemetrySchemaDefinition, Name extends TelemetrySchemaSpanName<Schema>> = SchemaSpan<Schema, Name>["endAttributes"] extends infer Definitions extends Record<string, TelemetryAttributeDefinition> ? InferOptionalAttributes<Definitions> : never;
|
|
141
|
+
type SchemaSpanEvents<Schema extends TelemetrySchemaDefinition, Name extends TelemetrySchemaSpanName<Schema>> = SchemaSpan<Schema, Name> extends {
|
|
142
|
+
events: infer Events extends Record<string, TelemetryEventDefinition>;
|
|
143
|
+
} ? Events : Record<never, never>;
|
|
144
|
+
export type TelemetrySchemaSpanEventName<Schema extends TelemetrySchemaDefinition, Name extends TelemetrySchemaSpanName<Schema>> = keyof SchemaSpanEvents<Schema, Name> & string;
|
|
145
|
+
type SchemaSpanEvent<Schema extends TelemetrySchemaDefinition, Name extends TelemetrySchemaSpanName<Schema>, EventName extends TelemetrySchemaSpanEventName<Schema, Name>> = SchemaSpanEvents<Schema, Name> extends infer Events ? EventName extends keyof Events ? Events[EventName] : never : never;
|
|
146
|
+
export type TelemetrySchemaSpanEventAttributes<Schema extends TelemetrySchemaDefinition, Name extends TelemetrySchemaSpanName<Schema>, EventName extends TelemetrySchemaSpanEventName<Schema, Name>> = SchemaSpanEvent<Schema, Name, EventName> extends {
|
|
147
|
+
attributes: infer Definitions extends Record<string, TelemetryEventAttributeDefinition>;
|
|
148
|
+
} ? InferEventAttributes<Definitions> : never;
|
|
149
|
+
type SchemaSpanEventAttributeDefinitions<Schema extends TelemetrySchemaDefinition, Name extends TelemetrySchemaSpanName<Schema>, EventName extends TelemetrySchemaSpanEventName<Schema, Name>> = SchemaSpanEvent<Schema, Name, EventName> extends {
|
|
150
|
+
attributes: infer Definitions extends Record<string, TelemetryEventAttributeDefinition>;
|
|
151
|
+
} ? Definitions : Record<never, never>;
|
|
152
|
+
type EventArguments<Definitions extends Record<string, TelemetryEventAttributeDefinition>, Attributes extends InferEventAttributes<Definitions>> = [RequiredAttributeNames<Definitions>] extends [never] ? [attributes?: ExactTelemetryAttributes<InferEventAttributes<Definitions>, Attributes>] : [attributes: ExactTelemetryAttributes<InferEventAttributes<Definitions>, Attributes>];
|
|
153
|
+
export type SchemaTelemetrySpan<Schema extends TelemetrySchemaDefinition, Name extends TelemetrySchemaSpanName<Schema>> = Omit<TelemetrySpan, "addEvent" | "setAttributes"> & {
|
|
154
|
+
addEvent<EventName extends TelemetrySchemaSpanEventName<Schema, Name>, const Attributes extends InferEventAttributes<SchemaSpanEventAttributeDefinitions<Schema, Name, EventName>> = InferEventAttributes<SchemaSpanEventAttributeDefinitions<Schema, Name, EventName>>>(name: EventName, ...args: EventArguments<SchemaSpanEventAttributeDefinitions<Schema, Name, EventName>, Attributes>): void;
|
|
155
|
+
setAttributes<const Attributes extends TelemetrySchemaSpanEndAttributes<Schema, Name>>(attributes: ExactTelemetryAttributes<TelemetrySchemaSpanEndAttributes<Schema, Name>, Attributes>): void;
|
|
156
|
+
};
|
|
157
|
+
export type TelemetrySchemaSpanUnion<Schema extends TelemetrySchemaDefinition> = {
|
|
158
|
+
[Name in TelemetrySchemaSpanName<Schema>]: {
|
|
159
|
+
name: Name;
|
|
160
|
+
startAttributes: TelemetrySchemaSpanStartAttributes<Schema, Name>;
|
|
161
|
+
endAttributes: TelemetrySchemaSpanEndAttributes<Schema, Name>;
|
|
162
|
+
events: {
|
|
163
|
+
[EventName in TelemetrySchemaSpanEventName<Schema, Name>]: TelemetrySchemaSpanEventAttributes<Schema, Name, EventName>;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
}[TelemetrySchemaSpanName<Schema>];
|
|
167
|
+
type TelemetrySchemaTuple = readonly [TelemetrySchemaDefinition, ...TelemetrySchemaDefinition[]];
|
|
168
|
+
type SpanNameInSchema<Schema extends TelemetrySchemaDefinition> = Schema extends TelemetrySchemaDefinition ? TelemetrySchemaSpanName<Schema> : never;
|
|
169
|
+
type SpanNameInSchemas<Schemas extends TelemetrySchemaTuple> = SpanNameInSchema<Schemas[number]>;
|
|
170
|
+
type SpanStartAttributesInSchema<Schema extends TelemetrySchemaDefinition, Name extends string> = Schema extends TelemetrySchemaDefinition ? Name extends TelemetrySchemaSpanName<Schema> ? TelemetrySchemaSpanStartAttributes<Schema, Name> : never : never;
|
|
171
|
+
type SpanInSchema<Schema extends TelemetrySchemaDefinition, Name extends string> = Schema extends TelemetrySchemaDefinition ? Name extends TelemetrySchemaSpanName<Schema> ? SchemaTelemetrySpan<Schema, Name> : never : never;
|
|
172
|
+
type DuplicateTelemetrySpanNames<Schemas extends readonly TelemetrySchemaDefinition[], Seen extends string = never> = Schemas extends readonly [
|
|
173
|
+
infer Schema extends TelemetrySchemaDefinition,
|
|
174
|
+
...infer Rest extends readonly TelemetrySchemaDefinition[]
|
|
175
|
+
] ? Extract<TelemetrySchemaSpanName<Schema>, Seen> | DuplicateTelemetrySpanNames<Rest, Seen | TelemetrySchemaSpanName<Schema>> : never;
|
|
176
|
+
type UniqueTelemetrySchemas<Schemas extends TelemetrySchemaTuple> = [DuplicateTelemetrySpanNames<Schemas>] extends [
|
|
177
|
+
never
|
|
178
|
+
] ? unknown : {
|
|
179
|
+
readonly "duplicate telemetry span names": DuplicateTelemetrySpanNames<Schemas>;
|
|
180
|
+
};
|
|
181
|
+
type UnionToIntersection<Union> = (Union extends unknown ? (value: Union) => void : never) extends (value: infer Intersection) => void ? Intersection : never;
|
|
182
|
+
type TypedSpanStarterForName<Schemas extends TelemetrySchemaTuple, Name extends SpanNameInSchemas<Schemas>> = <const Attributes extends SpanStartAttributesInSchema<Schemas[number], Name>, Result>(name: Name, attributes: ExactTelemetryAttributes<SpanStartAttributesInSchema<Schemas[number], Name>, Attributes>, callback: (span: SpanInSchema<Schemas[number], Name>, startChildSpan: TypedSpanStarter<Schemas>) => Result | Promise<Result>) => Promise<Result>;
|
|
183
|
+
/** A per-span overload set bound to one explicit parent context and one or more schemas. */
|
|
184
|
+
export type TypedSpanStarter<Schemas extends TelemetrySchemaTuple> = UnionToIntersection<{
|
|
185
|
+
[Name in SpanNameInSchemas<Schemas>]: TypedSpanStarterForName<Schemas, Name>;
|
|
186
|
+
}[SpanNameInSchemas<Schemas>]>;
|
|
187
|
+
/**
|
|
188
|
+
* Bind an explicit parent context to the combined span vocabulary of one or more schemas.
|
|
189
|
+
* Schema values are used only for type inference; no runtime schema validation is performed.
|
|
190
|
+
*/
|
|
191
|
+
export declare function createTypedSpanStarter<const Schemas extends TelemetrySchemaTuple>(telemetryContext: TelemetryContext, _schemas: Schemas & UniqueTelemetrySchemas<Schemas>): TypedSpanStarter<Schemas>;
|
|
192
|
+
export type { RecordedTelemetryEvent, RecordedTelemetrySpan } from "./memory.ts";
|
|
193
|
+
export { InMemoryTelemetryContext } from "./memory.ts";
|
|
194
|
+
//# sourceMappingURL=index.d.ts.map
|