@osfactory/otel-hook 0.11.0 → 0.12.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/README.md +26 -1
- package/dist/{adapter-DiLknaTF.d.ts → adapter-DQiPu8xF.d.ts} +2 -2
- package/dist/cli.js +371 -65
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +3 -3
- package/dist/config.js +16 -3
- package/dist/config.js.map +1 -1
- package/dist/{destinations-BIl3gGzx.d.ts → destinations-DvqsPulb.d.ts} +1 -1
- package/dist/{events-CSD_YiJ2.d.ts → events-fcomX6d5.d.ts} +22 -0
- package/dist/{export-destinations-QWKGGEjk.d.ts → export-destinations-CI7z4n3i.d.ts} +11 -6
- package/dist/{filesystem-store-D3SCNmbX.d.ts → filesystem-store-CmnUlj1O.d.ts} +1 -1
- package/dist/{hook-BOecWGSz.d.ts → hook-vM_cgqS2.d.ts} +11 -5
- package/dist/index.d.ts +14 -14
- package/dist/index.js +389 -100
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +4 -4
- package/dist/install.js +9 -1
- package/dist/install.js.map +1 -1
- package/dist/integration.d.ts +16 -10
- package/dist/integration.js +341 -71
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.d.ts +3 -3
- package/dist/lifecycle.js +10 -2
- package/dist/lifecycle.js.map +1 -1
- package/dist/{memory-Cs51jyRk.d.ts → memory-DdU1U91y.d.ts} +2 -2
- package/dist/{metric-model-DDnWxL9d.d.ts → metric-model-C9lLqqpI.d.ts} +4 -1
- package/dist/model.d.ts +1 -1
- package/dist/model.js +9 -1
- package/dist/model.js.map +1 -1
- package/dist/{payload-ChtrEX6A.d.ts → payload-BT19hiVZ.d.ts} +1 -1
- package/dist/{ports-CeqLq31i.d.ts → ports-C3k_5eOQ.d.ts} +33 -2
- package/dist/providers.d.ts +10 -10
- package/dist/providers.js +10 -1
- package/dist/providers.js.map +1 -1
- package/dist/{registry-CcJNF3WY.d.ts → registry-gyJqaWmp.d.ts} +2 -2
- package/dist/runtime.d.ts +97 -9
- package/dist/runtime.js +257 -24
- package/dist/runtime.js.map +1 -1
- package/dist/{schema-DMnoU1V_.d.ts → schema-SpFM6YQY.d.ts} +24 -1
- package/dist/state.d.ts +4 -4
- package/dist/state.js +9 -1
- package/dist/state.js.map +1 -1
- package/dist/telemetry.d.ts +6 -6
- package/dist/telemetry.js +77 -22
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.d.ts +10 -8
- package/dist/testing.js +109 -24
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -286,7 +286,7 @@ otel-hook doctor --json
|
|
|
286
286
|
|
|
287
287
|
Reports the version, an attribute-safe configuration snapshot, a real
|
|
288
288
|
write/read/delete probe of the state directory, spool depth, exporter
|
|
289
|
-
configuration, privacy mode, and the adapter count. With
|
|
289
|
+
configuration, privacy mode, [session context](docs/session-context.md), and the adapter count. With
|
|
290
290
|
[multiple destinations](#multiple-destinations) it also reports each one: its
|
|
291
291
|
signals and endpoint origins, the environment variables its headers reference (by
|
|
292
292
|
name — never a value), any that are missing, and its spool depth and drops. Exits 1 when any check fails,
|
|
@@ -938,6 +938,28 @@ const enriched = await attachClaudeTranscriptTurn(hookPayload);
|
|
|
938
938
|
|
|
939
939
|
See [finding 8](docs/claude-code-usage-contract.md#finding-8-the-model-is-on-sessionstart-and-in-the-transcript-never-on-stop).
|
|
940
940
|
|
|
941
|
+
#### Session context
|
|
942
|
+
|
|
943
|
+
A session's environment is fixed when the agent starts, but the work it does is
|
|
944
|
+
not: it can start in the main checkout and move into a slot later. A harness can
|
|
945
|
+
write what the session is working on to a **session context** file, and
|
|
946
|
+
otel-hook puts it on every span, log record and metric point from then on:
|
|
947
|
+
|
|
948
|
+
```bash
|
|
949
|
+
otel-hook run --provider claude-code --session-context-dir /home/dev/.har/sessions
|
|
950
|
+
# or, in --config-file: { "sessionContext": { "dir": "/home/dev/.har/sessions" } }
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
The hook reads `<dir>/<agent-tool>/<session-id>.json` (`claude_code`, `codex`,
|
|
954
|
+
`cursor`, …), picks the segment in force at each event's time, and applies its
|
|
955
|
+
attributes. They override the same keys from the Resource, on records and on the
|
|
956
|
+
Resource itself, so a stale `factory.attempt.id` from the environment is not
|
|
957
|
+
exported. Subagent events use their parent session's file. `factory.local.*` is
|
|
958
|
+
never applied. No file, an invalid one, or no segment in force: nothing is added,
|
|
959
|
+
and the hook never fails. There is no environment variable for it, because Claude
|
|
960
|
+
Code strips `OTEL_*` variables from hooks. Format and rules:
|
|
961
|
+
[docs/session-context.md](docs/session-context.md).
|
|
962
|
+
|
|
941
963
|
### Multiple destinations
|
|
942
964
|
|
|
943
965
|
`exporter.destinations` sends every batch to several OTLP endpoints at once — a
|
|
@@ -1124,6 +1146,9 @@ these namespaces are therefore also copied onto every span and log record:
|
|
|
1124
1146
|
described above, resolved (and trimmed) on its own. Other attributes, such as
|
|
1125
1147
|
`deployment.environment`, stay on the Resource only.
|
|
1126
1148
|
|
|
1149
|
+
[Session context](#session-context) attributes are layered over these on every
|
|
1150
|
+
record, and override the same keys on the Resource.
|
|
1151
|
+
|
|
1127
1152
|
Diagnostics report resource attribute **names** only — `doctor --json` shows
|
|
1128
1153
|
`exporter.resource_attribute_names`. A name is already on the wire in every
|
|
1129
1154
|
exported resource; a value is not disclosed anywhere a name would do.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { OtelHookErrorInfo } from './errors.js';
|
|
3
|
-
import { I as UsageTemporality, n as ModelDescriptor, b as CanonicalEvent, u as TargetHint, e as CanonicalEventType } from './events-
|
|
3
|
+
import { I as UsageTemporality, n as ModelDescriptor, b as CanonicalEvent, u as TargetHint, e as CanonicalEventType } from './events-fcomX6d5.js';
|
|
4
4
|
import { I as IdentityClaim, d as InvocationIdentity } from './identity-BrVBs901.js';
|
|
5
5
|
import { R as ResolvedProviderId, g as ProviderId, h as SourceTransport, d as EventId } from './primitives-CJ8-rn-f.js';
|
|
6
6
|
import { e as PrivacyLimits } from './policy-CimmCfRp.js';
|
|
7
7
|
import { P as PrivacyService } from './service-CbI9CObT.js';
|
|
8
|
-
import { C as Clock, I as IdGenerator, d as Logger } from './ports-
|
|
8
|
+
import { C as Clock, I as IdGenerator, d as Logger } from './ports-C3k_5eOQ.js';
|
|
9
9
|
import { A as AttributionOutcome, a as AttributionReason } from './taxonomy-DwhTtuWd.js';
|
|
10
10
|
|
|
11
11
|
/** Raw input offered to adapters. `payload` is `unknown` on purpose. */
|