@osfactory/otel-hook 0.13.2 → 0.14.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.
Files changed (46) hide show
  1. package/README.md +57 -0
  2. package/dist/{adapter-DyCb7y1N.d.ts → adapter-But5fFCk.d.ts} +9 -2
  3. package/dist/cli.js +628 -73
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config.d.ts +30 -4
  6. package/dist/config.js +161 -9
  7. package/dist/config.js.map +1 -1
  8. package/dist/{destinations-C4sSKjDO.d.ts → destinations-2KrcRslo.d.ts} +92 -2
  9. package/dist/{export-destinations-BjRXDots.d.ts → export-destinations-8tNkIC8a.d.ts} +110 -10
  10. package/dist/{filesystem-store-B3CpiIRl.d.ts → filesystem-store-Z8XgDtFj.d.ts} +1 -1
  11. package/dist/{hook-CKLpgrYP.d.ts → hook-D7XABd4f.d.ts} +19 -5
  12. package/dist/index.d.ts +14 -14
  13. package/dist/index.js +626 -72
  14. package/dist/index.js.map +1 -1
  15. package/dist/install.d.ts +4 -4
  16. package/dist/install.js.map +1 -1
  17. package/dist/integration.d.ts +9 -9
  18. package/dist/integration.js +555 -65
  19. package/dist/integration.js.map +1 -1
  20. package/dist/lifecycle.d.ts +1 -1
  21. package/dist/lifecycle.js +1 -1
  22. package/dist/lifecycle.js.map +1 -1
  23. package/dist/{memory-B3r6sZtC.d.ts → memory-gipZUiXP.d.ts} +1 -1
  24. package/dist/{payload-DLK7QaBB.d.ts → payload-DWdx9yk3.d.ts} +1 -1
  25. package/dist/{ports-DhpSDIkp.d.ts → ports-qZTwK-z2.d.ts} +22 -2
  26. package/dist/privacy.d.ts +2 -2
  27. package/dist/privacy.js +42 -1
  28. package/dist/privacy.js.map +1 -1
  29. package/dist/providers.d.ts +9 -9
  30. package/dist/providers.js +22 -5
  31. package/dist/providers.js.map +1 -1
  32. package/dist/{registry-DM-4YvIA.d.ts → registry-D9rmMYxw.d.ts} +2 -2
  33. package/dist/runtime.d.ts +24 -9
  34. package/dist/runtime.js +282 -30
  35. package/dist/runtime.js.map +1 -1
  36. package/dist/{schema-CD61uW99.d.ts → schema-oRsbo7WO.d.ts} +45 -0
  37. package/dist/{service-CbI9CObT.d.ts → service-DySC7KQM.d.ts} +6 -1
  38. package/dist/state.d.ts +3 -3
  39. package/dist/state.js.map +1 -1
  40. package/dist/telemetry.d.ts +6 -5
  41. package/dist/telemetry.js +304 -17
  42. package/dist/telemetry.js.map +1 -1
  43. package/dist/testing.d.ts +8 -8
  44. package/dist/testing.js +185 -10
  45. package/dist/testing.js.map +1 -1
  46. package/package.json +1 -1
package/README.md CHANGED
@@ -1117,6 +1117,63 @@ later refuses with a non-retryable status is dropped instead of blocking the
1117
1117
  queue behind it. Every drop is counted on disk, by reason, and `otel-hook doctor`
1118
1118
  reports each destination's queued batches, bytes, and drops.
1119
1119
 
1120
+ #### Per-repository scopes
1121
+
1122
+ A `destinations[]` entry may carry `scopes`, which turn it from "every record"
1123
+ into "only these repositories, at this detail" — for example a hosted receiver
1124
+ that should see two repositories, one of them without content:
1125
+
1126
+ ```json
1127
+ {
1128
+ "name": "hosted",
1129
+ "endpoint": "https://ingest.example/v1/traces",
1130
+ "headers": { "authorization": "env:HOSTED_TOKEN" },
1131
+ "signals": ["traces", "logs", "metrics"],
1132
+ "scopes": [
1133
+ { "repositories": ["https://github.com/acme/widget"], "contentMode": "redact" },
1134
+ {
1135
+ "repositories": ["git@github.com:acme/gadget.git"],
1136
+ "signals": ["traces", "metrics"],
1137
+ "contentMode": "omit",
1138
+ "includeSessionId": false
1139
+ }
1140
+ ]
1141
+ }
1142
+ ```
1143
+
1144
+ | Field | Meaning |
1145
+ | --- | --- |
1146
+ | `repositories` | Repository URLs in any remote spelling (HTTPS, `git@host:path`, `ssh://`, or `host/path`), compared by lowercased host and path without credentials, port or `.git`; or `"*"` for every record that names a repository. |
1147
+ | `signals` | Signals sent for these repositories, intersected with the destination's own `signals`. Default: all of the destination's. |
1148
+ | `contentMode` | `omit`, `mask`, `redact` or `raw`. Lowers the disclosure `privacy.contentMode` produced, for this destination only; never raises it (`exporter.logs.includeContent` still gates log bodies). |
1149
+ | `includeSessionId` | `false` leaves `session.id` off this destination's metric points for these repositories (cumulative series are then kept across sessions). Default true; cannot turn on what `exporter.metrics.includeSessionId` turned off. |
1150
+
1151
+ A record's repository is, in order: its `vcs.repository.url.full` session
1152
+ context stamp (`sessionContext.dir`); else the `origin` remote of the git
1153
+ repository the session's own directory is in (read from that repository's
1154
+ `.git/config`, no `git` process); else the exporter Resource
1155
+ (`--resource-attr` / `OTEL_RESOURCE_ATTRIBUTES`). So a session's first records
1156
+ (its start and first prompt) reach the destination scoped to the repository it
1157
+ runs in even before any session context exists. A local-path, missing or
1158
+ unparsable remote names no repository. A record a scoped destination takes by
1159
+ the session directory's remote or the Resource, with no stamp of its own, is
1160
+ sent to that destination with `vcs.repository.url.full` set to `https://<key>`:
1161
+ the normalized host and path the scope matched, never the remote as written, so
1162
+ no credential, port or local path can appear. The destination already names
1163
+ that repository in its own scope and the session's later records carry it, so
1164
+ this discloses nothing new; it lets the receiver file the session's first
1165
+ records under the repository it was opted in for. A record's own stamp is never
1166
+ changed, and what an unscoped destination receives does not change. The
1167
+ **first** scope listing it
1168
+ decides; a record that names no repository, or one no scope lists, is **not
1169
+ sent** to a scoped destination. A span is judged by its end edge when the end is
1170
+ in the same batch. Metric points are filtered point by point, so one callback's
1171
+ points can split across destinations. Filtering happens before mapping, so a
1172
+ scoped destination's spool only ever holds what passed its scopes. A destination
1173
+ without `scopes`, and the `default` destination, keep receiving everything.
1174
+ `otel-hook doctor` lists each destination's scopes; the exported configuration
1175
+ snapshot carries only their count.
1176
+
1120
1177
  ### Resource attributes
1121
1178
 
1122
1179
  `exporter.resourceAttributes` adds custom attributes to the OTLP Resource every
@@ -4,8 +4,8 @@ import { I as UsageTemporality, n as ModelDescriptor, b as CanonicalEvent, u as
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
- import { P as PrivacyService } from './service-CbI9CObT.js';
8
- import { C as Clock, I as IdGenerator, d as Logger } from './ports-DhpSDIkp.js';
7
+ import { P as PrivacyService } from './service-DySC7KQM.js';
8
+ import { C as Clock, I as IdGenerator, d as Logger } from './ports-qZTwK-z2.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. */
@@ -208,6 +208,13 @@ type ProviderParseResult = {
208
208
  * the event's `target` and discards it. Use `EventFactory.targetHints()`.
209
209
  */
210
210
  readonly targetHints?: ReadonlyMap<EventId, TargetHint>;
211
+ /**
212
+ * The session's own directory (the payload's `cwd` or single workspace
213
+ * root), absolute. **A local path, in-process only**: the core reads the
214
+ * `origin` remote of the repository it sits in to route records without a
215
+ * context stamp to scoped destinations, then discards it. Never exported.
216
+ */
217
+ readonly workspaceDirectory?: string;
211
218
  }
212
219
  /** The input was recognized but carries no telemetry. Not an error. */
213
220
  | {