@osfactory/otel-hook 0.13.0 → 0.13.1
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/dist/cli.js +124 -31
- package/dist/cli.js.map +1 -1
- package/dist/{export-destinations-Bey2djRk.d.ts → export-destinations-DUeQKr_C.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +116 -23
- package/dist/index.js.map +1 -1
- package/dist/install.js +4 -1
- package/dist/install.js.map +1 -1
- package/dist/integration.d.ts +2 -2
- package/dist/integration.js +105 -18
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.d.ts +8 -1
- package/dist/lifecycle.js +10 -3
- package/dist/lifecycle.js.map +1 -1
- package/dist/{metric-model-CFIeUwqd.d.ts → metric-model-B4lIuk6i.d.ts} +8 -0
- package/dist/providers.js +11 -2
- package/dist/providers.js.map +1 -1
- package/dist/state.js +20 -6
- package/dist/state.js.map +1 -1
- package/dist/telemetry.d.ts +2 -2
- package/dist/telemetry.js +69 -6
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.js +11 -2
- package/dist/testing.js.map +1 -1
- package/package.json +2 -1
package/dist/lifecycle.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as StateStore, C as Clock } from './ports-DhpSDIkp.js';
|
|
2
2
|
import { Attributes } from '@opentelemetry/api';
|
|
3
3
|
import { b as CanonicalEvent, f as CanonicalUsage } from './events-fcomX6d5.js';
|
|
4
|
-
import { p as SpanFamily, s as SpanScopeRef, m as SpanCorrelation, j as MetricObservation, k as MetricPoint } from './metric-model-
|
|
4
|
+
import { p as SpanFamily, s as SpanScopeRef, m as SpanCorrelation, j as MetricObservation, k as MetricPoint } from './metric-model-B4lIuk6i.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './errors.js';
|
|
7
7
|
import './primitives-CJ8-rn-f.js';
|
|
@@ -163,6 +163,13 @@ type SpanCorrelationFacts = {
|
|
|
163
163
|
readonly endedAt?: number;
|
|
164
164
|
readonly parent?: SpanScopeRef;
|
|
165
165
|
readonly attributes?: Attributes;
|
|
166
|
+
/**
|
|
167
|
+
* Set when this record is a *new run* of a scope whose span was already
|
|
168
|
+
* exported (a resumed Claude Code session fires `SessionStart` again for the
|
|
169
|
+
* same session id): the run's start event id, mixed into its span id so the
|
|
170
|
+
* second run never re-uses the id already on the wire.
|
|
171
|
+
*/
|
|
172
|
+
readonly runKey?: string;
|
|
166
173
|
};
|
|
167
174
|
type SpanStartInput = {
|
|
168
175
|
readonly sessionId: string;
|
package/dist/lifecycle.js
CHANGED
|
@@ -271,7 +271,7 @@ import {
|
|
|
271
271
|
} from "@opentelemetry/semantic-conventions/incubating";
|
|
272
272
|
|
|
273
273
|
// src/version.ts
|
|
274
|
-
var VERSION = "0.13.
|
|
274
|
+
var VERSION = "0.13.1";
|
|
275
275
|
|
|
276
276
|
// src/telemetry/export-identity.ts
|
|
277
277
|
import { ATTR_SESSION_ID } from "@opentelemetry/semantic-conventions/incubating";
|
|
@@ -1185,6 +1185,7 @@ var encodeRecord = (record) => ({
|
|
|
1185
1185
|
...record.endEventId === void 0 ? {} : { endEventId: record.endEventId },
|
|
1186
1186
|
...record.endedAt === void 0 ? {} : { endedAt: record.endedAt },
|
|
1187
1187
|
...record.exported === true ? { exported: true } : {},
|
|
1188
|
+
...record.runKey === void 0 ? {} : { runKey: record.runKey },
|
|
1188
1189
|
...record.parent === void 0 ? {} : { parentFamily: record.parent.family, parentScopeKey: record.parent.scopeKey },
|
|
1189
1190
|
...encodeAttributes(record.attributes)
|
|
1190
1191
|
}
|
|
@@ -1208,6 +1209,7 @@ var decodeRecord = (attributes) => {
|
|
|
1208
1209
|
return { kind: "corrupt" };
|
|
1209
1210
|
}
|
|
1210
1211
|
const exported = attributes["exported"] === true;
|
|
1212
|
+
const runKey = optionalString(attributes["runKey"]);
|
|
1211
1213
|
const parentFamily = attributes["parentFamily"];
|
|
1212
1214
|
const parentScopeKey = optionalString(attributes["parentScopeKey"]);
|
|
1213
1215
|
const parent = isSpanFamily(parentFamily) && parentScopeKey !== void 0 ? { family: parentFamily, scopeKey: parentScopeKey } : void 0;
|
|
@@ -1222,6 +1224,7 @@ var decodeRecord = (attributes) => {
|
|
|
1222
1224
|
...endedAt === void 0 ? {} : { endedAt },
|
|
1223
1225
|
...parent === void 0 ? {} : { parent },
|
|
1224
1226
|
...exported ? { exported: true } : {},
|
|
1227
|
+
...runKey === void 0 ? {} : { runKey },
|
|
1225
1228
|
...decodedAttributes === void 0 ? {} : { attributes: decodedAttributes }
|
|
1226
1229
|
}
|
|
1227
1230
|
};
|
|
@@ -1230,13 +1233,15 @@ var factsOf = (record) => ({
|
|
|
1230
1233
|
...record.startedAt === void 0 ? {} : { startedAt: record.startedAt },
|
|
1231
1234
|
...record.endedAt === void 0 ? {} : { endedAt: record.endedAt },
|
|
1232
1235
|
...record.parent === void 0 ? {} : { parent: record.parent },
|
|
1233
|
-
...record.attributes === void 0 ? {} : { attributes: record.attributes }
|
|
1236
|
+
...record.attributes === void 0 ? {} : { attributes: record.attributes },
|
|
1237
|
+
...record.runKey === void 0 ? {} : { runKey: record.runKey }
|
|
1234
1238
|
});
|
|
1235
1239
|
var correlationTimesOf = (facts, options = { withStart: true }) => ({
|
|
1236
1240
|
...facts.startedAt === void 0 || !options.withStart ? {} : { startMillis: facts.startedAt },
|
|
1237
1241
|
...facts.endedAt === void 0 ? {} : { endMillis: facts.endedAt },
|
|
1238
1242
|
...facts.parent === void 0 ? {} : { parent: facts.parent },
|
|
1239
|
-
...facts.attributes === void 0 ? {} : { attributes: facts.attributes }
|
|
1243
|
+
...facts.attributes === void 0 ? {} : { attributes: facts.attributes },
|
|
1244
|
+
...facts.runKey === void 0 ? {} : { runSpanIdDiscriminator: facts.runKey }
|
|
1240
1245
|
});
|
|
1241
1246
|
var orphanClassificationOf = (reason) => {
|
|
1242
1247
|
switch (reason) {
|
|
@@ -1296,10 +1301,12 @@ var createSpanCorrelator = (deps) => {
|
|
|
1296
1301
|
return existing.exported === true ? { status: "published", facts: factsOf(completed) } : { status: "recorded", facts: factsOf(completed) };
|
|
1297
1302
|
}
|
|
1298
1303
|
}
|
|
1304
|
+
const previouslyExported = decoded.kind === "present" && decoded.record.exported === true;
|
|
1299
1305
|
const fresh = {
|
|
1300
1306
|
providerId: input.providerId,
|
|
1301
1307
|
startEventId: input.eventId,
|
|
1302
1308
|
startedAt: input.occurredAt,
|
|
1309
|
+
...previouslyExported ? { runKey: input.eventId } : {},
|
|
1303
1310
|
...input.parent === void 0 ? {} : { parent: input.parent },
|
|
1304
1311
|
...input.attributes === void 0 ? {} : { attributes: input.attributes }
|
|
1305
1312
|
};
|