@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/dist/config.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { k as OtelHookConfigPatch, O as OtelHookConfig } from './schema-CD61uW99.js';
3
- export { D as DEFAULT_CONFIG, a as DEFAULT_DETECTION_POLICY, b as DEFAULT_DIAGNOSTICS_POLICY, c as DEFAULT_ENDPOINT_DOWN_MILLIS, d as DEFAULT_EXPORTER_POLICY, e as DEFAULT_EXPORT_BUDGET_MILLIS, f as DEFAULT_LOGS_POLICY, g as DEFAULT_METRICS_POLICY, h as DEFAULT_PROVIDERS_POLICY, i as DetectionPolicy, j as DiagnosticsPolicy, E as ExporterPolicy, L as LogsPolicy, M as MetricsPolicy, P as ProvidersPolicy, S as SessionContextPolicy, l as detectionPolicySchema, m as diagnosticsPolicySchema, n as effectiveExportTimeoutMillis, o as effectiveMetricsPolicy, p as exporterPolicySchema, q as logsPolicySchema, r as metricsPolicySchema, s as otelHookConfigPatchSchema, t as otelHookConfigSchema, u as providersPolicySchema, v as readsClaudeTranscriptUsage, w as readsCodexRolloutUsage, x as sessionContextDir, y as sessionContextPolicySchema } from './schema-CD61uW99.js';
2
+ import { k as OtelHookConfigPatch, O as OtelHookConfig } from './schema-oRsbo7WO.js';
3
+ export { D as DEFAULT_CONFIG, a as DEFAULT_DETECTION_POLICY, b as DEFAULT_DIAGNOSTICS_POLICY, c as DEFAULT_ENDPOINT_DOWN_MILLIS, d as DEFAULT_EXPORTER_POLICY, e as DEFAULT_EXPORT_BUDGET_MILLIS, f as DEFAULT_LOGS_POLICY, g as DEFAULT_METRICS_POLICY, h as DEFAULT_PROVIDERS_POLICY, i as DetectionPolicy, j as DiagnosticsPolicy, E as ExporterPolicy, L as LogsPolicy, M as MetricsPolicy, P as ProvidersPolicy, S as SessionContextPolicy, l as detectionPolicySchema, m as diagnosticsPolicySchema, n as effectiveExportTimeoutMillis, o as effectiveMetricsPolicy, p as exporterPolicySchema, q as logsPolicySchema, r as metricsPolicySchema, s as otelHookConfigPatchSchema, t as otelHookConfigSchema, u as providersPolicySchema, v as readsClaudeTranscriptUsage, w as readsCodexRolloutUsage, x as sessionContextDir, y as sessionContextPolicySchema } from './schema-oRsbo7WO.js';
4
4
  import { OtelHookErrorInfo } from './errors.js';
5
5
  import { b as Attributes } from './primitives-CJ8-rn-f.js';
6
- export { D as DEFAULT_DESTINATION_NAME, a as DEFAULT_DESTINATION_SIGNALS, b as DEFAULT_SPOOL_POLICY, c as DESTINATION_NAME_PATTERN, d as DestinationDescription, E as ExportDestination, e as ExportDestinationConfig, f as ExportSignal, H as HEADER_ENV_REFERENCE_PREFIX, g as HeaderValueReference, M as MAX_DESTINATION_HEADERS, h as MAX_EXPORT_DESTINATIONS, R as ResolvedDestinationHeaders, S as SpoolPolicy, i as describeExportDestinations, j as effectiveSpoolPolicy, k as endpointOrigin, l as exportDestinationSchema, m as exportDestinationsSchema, n as exportSignalSchema, o as hasConfiguredDestinations, p as parseHeaderValueReference, r as resolveDestinationHeaders, q as resolveExportDestinations, s as spoolPolicySchema } from './destinations-C4sSKjDO.js';
6
+ export { A as ALL_REPOSITORIES, D as DEFAULT_DESTINATION_NAME, a as DEFAULT_DESTINATION_SIGNALS, b as DEFAULT_SPOOL_POLICY, c as DESTINATION_NAME_PATTERN, d as DestinationDescription, e as DestinationScope, f as DestinationScopeConfig, g as DestinationScopeDescription, E as ExportDestination, h as ExportDestinationConfig, i as ExportSignal, H as HEADER_ENV_REFERENCE_PREFIX, j as HeaderValueReference, M as MAX_DESTINATION_HEADERS, k as MAX_DESTINATION_SCOPES, l as MAX_EXPORT_DESTINATIONS, m as MAX_SCOPE_REPOSITORIES, R as ResolvedDestinationHeaders, S as SignalFlags, n as SpoolPolicy, o as describeExportDestinations, p as destinationScopeSchema, q as effectiveSpoolPolicy, r as endpointOrigin, s as exportDestinationSchema, t as exportDestinationsSchema, u as exportSignalSchema, v as hasConfiguredDestinations, w as matchDestinationScope, x as parseHeaderValueReference, y as resolveDestinationHeaders, z as resolveDestinationScopes, B as resolveExportDestinations, C as spoolPolicySchema } from './destinations-2KrcRslo.js';
7
7
  export { g as contentModeSchema } from './policy-CimmCfRp.js';
8
8
  import './taxonomy-DwhTtuWd.js';
9
9
  import './content-M9xIKG7h.js';
@@ -373,4 +373,30 @@ type OtlpSignal = "traces" | "logs" | "metrics";
373
373
  */
374
374
  declare const otlpSignalEndpointFromBase: (base: string, signal: OtlpSignal) => string;
375
375
 
376
- export { CONFIG_SOURCE_PRECEDENCE, type ConfigLayer, type ConfigProvenance, type ConfigResolution, type ConfigSource, EMPTY_RESOURCE_ATTRIBUTES, ENVIRONMENT_VARIABLES, type EnvironmentConfigResult, type EnvironmentRecord, MAX_OTLP_HEADERS, MAX_RESOURCE_ATTRIBUTES, MAX_RESOURCE_ATTRIBUTE_KEY_LENGTH, MAX_RESOURCE_ATTRIBUTE_VALUE_LENGTH, OTLP_ENDPOINT_VARIABLES, OTLP_HEADER_VARIABLES, OtelHookConfig, OtelHookConfigPatch, type OtlpSignal, type ParsedOtlpHeaders, type ParsedResourceAttributes, RESERVED_RESOURCE_ATTRIBUTE_KEYS, RESOURCE_ATTRIBUTE_KEY_PATTERN, RESOURCE_ATTRIBUTE_KEY_REJECTION_DETAIL, type ResolvedOtlpHeaders, type ResourceAttributeKeyRejection, type ResourceAttributeValue, type ResourceAttributes, checkResourceAttributeKey, configSourceSchema, describeOtlpHeaderNames, describeResolvedConfig, describeResourceAttributeNames, isReservedResourceAttributeKey, isSecretResourceAttributeKey, mergeOtlpHeaders, otlpSignalEndpointFromBase, parseEnvironmentConfig, parseOtlpHeadersValue, parseResourceAttributesValue, resolveConfig, resolveOtlpHeaders, resourceAttributeValueSchema, resourceAttributesSchema, sanitizeResourceAttributes, unionOtlpHeaderNames };
376
+ /**
377
+ * Repository keys: how a destination scope names a repository, and how a record's
378
+ * `vcs.repository.url.full` is compared against it.
379
+ *
380
+ * A key is the repository URL's host and path, lowercased, without scheme,
381
+ * credentials, port, trailing slash, or `.git` suffix — `github.com/acme/widget`.
382
+ * The same remote spelled as HTTPS, `git@host:path` or `ssh://` gives the same
383
+ * key, so a scope written from `git remote get-url origin` matches a record
384
+ * stamped with the browse URL and the other way around.
385
+ *
386
+ * Pure: no I/O, never throws.
387
+ */
388
+ /** OpenTelemetry VCS attribute a record's repository is read from. */
389
+ declare const ATTR_VCS_REPOSITORY_URL_FULL = "vcs.repository.url.full";
390
+ /** Longest repository reference accepted, in a scope or on a record. */
391
+ declare const MAX_REPOSITORY_REFERENCE_LENGTH = 2048;
392
+ /**
393
+ * The key of a repository URL or remote, or `undefined` when it does not name
394
+ * one (empty, unparsable, no path, or a local path).
395
+ *
396
+ * Accepted: `https://host/path(.git)`, `http://…`, `ssh://user@host[:port]/path`,
397
+ * `git://…`, `user@host:path` (scp-like), and an already-normalized
398
+ * `host/path`. Credentials and ports never reach the key.
399
+ */
400
+ declare const normalizeRepositoryKey: (reference: string) => string | undefined;
401
+
402
+ export { ATTR_VCS_REPOSITORY_URL_FULL, CONFIG_SOURCE_PRECEDENCE, type ConfigLayer, type ConfigProvenance, type ConfigResolution, type ConfigSource, EMPTY_RESOURCE_ATTRIBUTES, ENVIRONMENT_VARIABLES, type EnvironmentConfigResult, type EnvironmentRecord, MAX_OTLP_HEADERS, MAX_REPOSITORY_REFERENCE_LENGTH, MAX_RESOURCE_ATTRIBUTES, MAX_RESOURCE_ATTRIBUTE_KEY_LENGTH, MAX_RESOURCE_ATTRIBUTE_VALUE_LENGTH, OTLP_ENDPOINT_VARIABLES, OTLP_HEADER_VARIABLES, OtelHookConfig, OtelHookConfigPatch, type OtlpSignal, type ParsedOtlpHeaders, type ParsedResourceAttributes, RESERVED_RESOURCE_ATTRIBUTE_KEYS, RESOURCE_ATTRIBUTE_KEY_PATTERN, RESOURCE_ATTRIBUTE_KEY_REJECTION_DETAIL, type ResolvedOtlpHeaders, type ResourceAttributeKeyRejection, type ResourceAttributeValue, type ResourceAttributes, checkResourceAttributeKey, configSourceSchema, describeOtlpHeaderNames, describeResolvedConfig, describeResourceAttributeNames, isReservedResourceAttributeKey, isSecretResourceAttributeKey, mergeOtlpHeaders, normalizeRepositoryKey, otlpSignalEndpointFromBase, parseEnvironmentConfig, parseOtlpHeadersValue, parseResourceAttributesValue, resolveConfig, resolveOtlpHeaders, resourceAttributeValueSchema, resourceAttributesSchema, sanitizeResourceAttributes, unionOtlpHeaderNames };
package/dist/config.js CHANGED
@@ -413,6 +413,60 @@ var unionOtlpHeaderNames = (...lists) => {
413
413
  };
414
414
  var describeOtlpHeaderNames = (...sources) => unionOtlpHeaderNames(...sources.map((source) => Object.keys(source)));
415
415
 
416
+ // src/config/repository-key.ts
417
+ var ATTR_VCS_REPOSITORY_URL_FULL = "vcs.repository.url.full";
418
+ var MAX_REPOSITORY_REFERENCE_LENGTH = 2048;
419
+ var SCHEME_PATTERN = /^[a-z][a-z0-9+.-]*:\/\//i;
420
+ var SCP_LIKE_PATTERN = /^(?:[^@/\s]+@)?([^:/\s]+):(?!\/\/)(.+)$/;
421
+ var trimTrailingSlashes = (value) => {
422
+ let end = value.length;
423
+ while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;
424
+ return value.slice(0, end);
425
+ };
426
+ var keyOf = (host, pathname) => {
427
+ const withoutSlashes = trimTrailingSlashes(pathname);
428
+ const cleanedPath = trimTrailingSlashes(
429
+ withoutSlashes.toLowerCase().endsWith(".git") ? withoutSlashes.slice(0, -4) : withoutSlashes
430
+ );
431
+ if (host.length === 0 || cleanedPath.length === 0 || cleanedPath === "/") {
432
+ return void 0;
433
+ }
434
+ const withSlash = cleanedPath.startsWith("/") ? cleanedPath : `/${cleanedPath}`;
435
+ return `${host}${withSlash}`.toLowerCase();
436
+ };
437
+ var normalizeRepositoryKey = (reference) => {
438
+ const trimmed = reference.trim();
439
+ if (trimmed.length === 0 || trimmed.length > MAX_REPOSITORY_REFERENCE_LENGTH) {
440
+ return void 0;
441
+ }
442
+ if (SCHEME_PATTERN.test(trimmed)) {
443
+ let url;
444
+ try {
445
+ url = new URL(trimmed);
446
+ } catch {
447
+ return void 0;
448
+ }
449
+ if (url.protocol === "file:") {
450
+ return void 0;
451
+ }
452
+ return keyOf(url.hostname, url.pathname);
453
+ }
454
+ if (trimmed.startsWith("/") || trimmed.startsWith(".") || trimmed.includes("\\")) {
455
+ return void 0;
456
+ }
457
+ const scp = SCP_LIKE_PATTERN.exec(trimmed);
458
+ if (scp !== null && !trimmed.split(":")[0]?.includes("/")) {
459
+ const [, host, pathPart] = scp;
460
+ return host === void 0 || pathPart === void 0 ? void 0 : keyOf(host, pathPart);
461
+ }
462
+ try {
463
+ const url = new URL(`https://${trimmed}`);
464
+ return keyOf(url.hostname, url.pathname);
465
+ } catch {
466
+ return void 0;
467
+ }
468
+ };
469
+
416
470
  // src/config/destinations.ts
417
471
  var DEFAULT_DESTINATION_NAME = "default";
418
472
  var DESTINATION_NAME_PATTERN = /^[a-z0-9][a-z0-9_-]{0,62}$/;
@@ -431,6 +485,30 @@ var headerValueSchema = z4.string().min(1).max(MAX_HEADER_VALUE_LENGTH).refine(
431
485
  "an env: header reference must name an environment variable, e.g. env:COLLECTOR_TOKEN"
432
486
  );
433
487
  var endpointSchema = z4.string().url().max(2048);
488
+ var MAX_DESTINATION_SCOPES = 64;
489
+ var MAX_SCOPE_REPOSITORIES = 256;
490
+ var ALL_REPOSITORIES = "*";
491
+ var repositoryReferenceSchema = z4.string().min(1).max(MAX_REPOSITORY_REFERENCE_LENGTH).refine(
492
+ (value) => normalizeRepositoryKey(value) !== void 0,
493
+ "not a repository URL: use https://host/owner/repo, git@host:owner/repo.git, or host/owner/repo"
494
+ );
495
+ var destinationScopeSchema = z4.strictObject({
496
+ /**
497
+ * Repository URLs (any spelling of the remote; compared by host and path,
498
+ * case-insensitively, without `.git`), or `"*"` for every record that names
499
+ * a repository. A record that names none never matches a scope.
500
+ */
501
+ repositories: z4.union([
502
+ z4.literal(ALL_REPOSITORIES),
503
+ z4.array(repositoryReferenceSchema).min(1).max(MAX_SCOPE_REPOSITORIES).readonly()
504
+ ]),
505
+ /** Signals sent for these repositories. Default: every signal the destination takes. */
506
+ signals: z4.array(exportSignalSchema).min(1).max(3).readonly().optional(),
507
+ /** Content disclosure for these repositories, never above `privacy.contentMode`. Default: unchanged. */
508
+ contentMode: contentModeSchema.optional(),
509
+ /** False leaves `session.id` off metric data points for these repositories. Default true. */
510
+ includeSessionId: z4.boolean().optional()
511
+ });
434
512
  var exportDestinationSchema = z4.strictObject({
435
513
  /** Unique, lowercase, filesystem-safe. `default` is reserved for the single-endpoint settings. */
436
514
  name: z4.string().regex(DESTINATION_NAME_PATTERN, "destination names are lowercase letters, digits, _ and -"),
@@ -464,7 +542,15 @@ var exportDestinationSchema = z4.strictObject({
464
542
  * opt-in for content-bearing records leaving the host. `metrics` is never on by
465
543
  * default: a destination receives hook-derived metrics only when it lists them.
466
544
  */
467
- signals: z4.array(exportSignalSchema).min(1).max(3).readonly().optional()
545
+ signals: z4.array(exportSignalSchema).min(1).max(3).readonly().optional(),
546
+ /**
547
+ * Per-repository filter. Absent: every record goes to this destination, as
548
+ * before scopes existed. Present: a record goes only when its repository
549
+ * (`vcs.repository.url.full`) matches a scope — the first matching scope
550
+ * decides its signals, content mode, and session id — and a record that
551
+ * names no repository is not sent here at all.
552
+ */
553
+ scopes: z4.array(destinationScopeSchema).min(1).max(MAX_DESTINATION_SCOPES).readonly().optional()
468
554
  }).refine(
469
555
  (destination) => destination.endpoint !== void 0 || destination.tracesEndpoint !== void 0 || destination.logsEndpoint !== void 0 || destination.metricsEndpoint !== void 0,
470
556
  "a destination needs an endpoint, or a tracesEndpoint / logsEndpoint / metricsEndpoint"
@@ -508,6 +594,32 @@ var effectiveSpoolPolicy = (exporter) => ({
508
594
  maxAgeMillis: exporter.spool?.maxAgeMillis ?? DEFAULT_SPOOL_POLICY.maxAgeMillis,
509
595
  maxBatches: exporter.spool?.maxBatches ?? DEFAULT_SPOOL_POLICY.maxBatches
510
596
  });
597
+ var resolveDestinationScopes = (scopes, destinationSignals) => scopes.map((scope) => {
598
+ const listed = scope.signals ?? exportSignalSchema.options;
599
+ return {
600
+ repositories: scope.repositories === ALL_REPOSITORIES ? ALL_REPOSITORIES : new Set(
601
+ scope.repositories.flatMap((reference) => {
602
+ const key = normalizeRepositoryKey(reference);
603
+ return key === void 0 ? [] : [key];
604
+ })
605
+ ),
606
+ signals: {
607
+ traces: destinationSignals.traces && listed.includes("traces"),
608
+ logs: destinationSignals.logs && listed.includes("logs"),
609
+ metrics: destinationSignals.metrics && listed.includes("metrics")
610
+ },
611
+ ...scope.contentMode === void 0 ? {} : { contentMode: scope.contentMode },
612
+ includeSessionId: scope.includeSessionId ?? true
613
+ };
614
+ });
615
+ var matchDestinationScope = (scopes, repositoryKey) => {
616
+ if (repositoryKey === void 0) {
617
+ return void 0;
618
+ }
619
+ return scopes.find(
620
+ (scope) => scope.repositories === ALL_REPOSITORIES || scope.repositories.has(repositoryKey)
621
+ );
622
+ };
511
623
  var legacyDestination = (exporter) => ({
512
624
  name: DEFAULT_DESTINATION_NAME,
513
625
  source: "exporter",
@@ -532,6 +644,11 @@ var resolveExportDestinations = (exporter) => {
532
644
  continue;
533
645
  }
534
646
  const signals = destination.signals ?? DEFAULT_DESTINATION_SIGNALS;
647
+ const flags = {
648
+ traces: signals.includes("traces"),
649
+ logs: exporter.logs.enabled && signals.includes("logs"),
650
+ metrics: signals.includes("metrics")
651
+ };
535
652
  resolved.push({
536
653
  name: destination.name,
537
654
  source: "destinations",
@@ -540,12 +657,9 @@ var resolveExportDestinations = (exporter) => {
540
657
  ...destination.tracesEndpoint === void 0 ? {} : { tracesEndpoint: destination.tracesEndpoint },
541
658
  ...destination.logsEndpoint === void 0 ? {} : { logsEndpoint: destination.logsEndpoint },
542
659
  ...destination.metricsEndpoint === void 0 ? {} : { metricsEndpoint: destination.metricsEndpoint },
543
- signals: {
544
- traces: signals.includes("traces"),
545
- logs: exporter.logs.enabled && signals.includes("logs"),
546
- metrics: signals.includes("metrics")
547
- },
548
- headers: { ...destination.headers ?? {} }
660
+ signals: flags,
661
+ headers: { ...destination.headers ?? {} },
662
+ ...destination.scopes === void 0 ? {} : { scopes: resolveDestinationScopes(destination.scopes, flags) }
549
663
  });
550
664
  }
551
665
  return resolved;
@@ -569,6 +683,12 @@ var resolveDestinationHeaders = (headers, environment) => {
569
683
  }
570
684
  return { values, missingVariables: [...new Set(missing)].sort() };
571
685
  };
686
+ var describeScope = (scope) => ({
687
+ repositories: scope.repositories === ALL_REPOSITORIES ? ALL_REPOSITORIES : [...scope.repositories].sort(),
688
+ signals: exportSignalSchema.options.filter((signal) => scope.signals[signal]),
689
+ ...scope.contentMode === void 0 ? {} : { contentMode: scope.contentMode },
690
+ includeSessionId: scope.includeSessionId
691
+ });
572
692
  var endpointOrigin = (endpoint) => {
573
693
  if (endpoint === void 0) {
574
694
  return void 0;
@@ -598,7 +718,8 @@ var describeExportDestinations = (exporter) => {
598
718
  ...logsOrigin === void 0 || !destination.signals.logs ? {} : { logsEndpointOrigin: logsOrigin },
599
719
  ...metricsOrigin === void 0 || !destination.signals.metrics ? {} : { metricsEndpointOrigin: metricsOrigin },
600
720
  headerNames: destination.source === "exporter" ? [...exporter.headerNames].sort() : Object.keys(destination.headers).sort(),
601
- headerVariables: [...new Set(variables)].sort()
721
+ headerVariables: [...new Set(variables)].sort(),
722
+ ...destination.scopes === void 0 ? {} : { scopes: destination.scopes.map(describeScope) }
602
723
  };
603
724
  };
604
725
  const enabled = resolveExportDestinations(exporter).map(
@@ -612,7 +733,14 @@ var describeExportDestinations = (exporter) => {
612
733
  protocol: destination.protocol ?? exporter.protocol,
613
734
  ...destination.endpoint === void 0 ? {} : { endpoint: destination.endpoint },
614
735
  signals: { traces: false, logs: false, metrics: false },
615
- headers: { ...destination.headers ?? {} }
736
+ headers: { ...destination.headers ?? {} },
737
+ ...destination.scopes === void 0 ? {} : {
738
+ scopes: resolveDestinationScopes(destination.scopes, {
739
+ traces: true,
740
+ logs: true,
741
+ metrics: true
742
+ })
743
+ }
616
744
  },
617
745
  false
618
746
  )
@@ -1146,6 +1274,18 @@ var resolveConfig = (layers = []) => {
1146
1274
  );
1147
1275
  }
1148
1276
  }
1277
+ const rank = { omit: 0, mask: 1, redact: 2, raw: 3 };
1278
+ const effectiveMode = parsed.data.privacy.contentMode === "raw" && !parsed.data.privacy.allowRawContent ? "omit" : parsed.data.privacy.contentMode;
1279
+ const widening = enabled.filter(
1280
+ (destination) => (destination.scopes ?? []).some(
1281
+ (scope) => scope.contentMode !== void 0 && rank[scope.contentMode] > rank[effectiveMode]
1282
+ )
1283
+ ).map((destination) => destination.name);
1284
+ if (widening.length > 0) {
1285
+ notes.push(
1286
+ `destination(s) ${widening.join(", ")} have a scope contentMode above privacy.contentMode=${effectiveMode}; a scope can only lower disclosure, so ${effectiveMode} applies`
1287
+ );
1288
+ }
1149
1289
  }
1150
1290
  if (!withDestinations && parsed.data.exporter.logs.enabled && parsed.data.exporter.logs.endpoint === void 0 && parsed.data.exporter.endpoint === void 0) {
1151
1291
  notes.push(
@@ -1193,6 +1333,9 @@ var describeDestinationAttributes = (config) => {
1193
1333
  }
1194
1334
  attributes[`${prefix}.header_names`] = [...destination.headerNames];
1195
1335
  attributes[`${prefix}.header_variables`] = [...destination.headerVariables];
1336
+ if (destination.scopes !== void 0) {
1337
+ attributes[`${prefix}.scope_count`] = destination.scopes.length;
1338
+ }
1196
1339
  }
1197
1340
  return attributes;
1198
1341
  };
@@ -1531,6 +1674,8 @@ var parseEnvironmentConfig = (env) => {
1531
1674
  return { patch, warnings };
1532
1675
  };
1533
1676
  export {
1677
+ ALL_REPOSITORIES,
1678
+ ATTR_VCS_REPOSITORY_URL_FULL,
1534
1679
  CONFIG_SOURCE_PRECEDENCE,
1535
1680
  DEFAULT_CONFIG,
1536
1681
  DEFAULT_DESTINATION_NAME,
@@ -1549,11 +1694,14 @@ export {
1549
1694
  ENVIRONMENT_VARIABLES,
1550
1695
  HEADER_ENV_REFERENCE_PREFIX,
1551
1696
  MAX_DESTINATION_HEADERS,
1697
+ MAX_DESTINATION_SCOPES,
1552
1698
  MAX_EXPORT_DESTINATIONS,
1553
1699
  MAX_OTLP_HEADERS,
1700
+ MAX_REPOSITORY_REFERENCE_LENGTH,
1554
1701
  MAX_RESOURCE_ATTRIBUTES,
1555
1702
  MAX_RESOURCE_ATTRIBUTE_KEY_LENGTH,
1556
1703
  MAX_RESOURCE_ATTRIBUTE_VALUE_LENGTH,
1704
+ MAX_SCOPE_REPOSITORIES,
1557
1705
  OTLP_ENDPOINT_VARIABLES,
1558
1706
  OTLP_HEADER_VARIABLES,
1559
1707
  RESERVED_RESOURCE_ATTRIBUTE_KEYS,
@@ -1566,6 +1714,7 @@ export {
1566
1714
  describeOtlpHeaderNames,
1567
1715
  describeResolvedConfig,
1568
1716
  describeResourceAttributeNames,
1717
+ destinationScopeSchema,
1569
1718
  detectionPolicySchema,
1570
1719
  diagnosticsPolicySchema,
1571
1720
  effectiveExportTimeoutMillis,
@@ -1580,8 +1729,10 @@ export {
1580
1729
  isReservedResourceAttributeKey,
1581
1730
  isSecretResourceAttributeKey,
1582
1731
  logsPolicySchema,
1732
+ matchDestinationScope,
1583
1733
  mergeOtlpHeaders,
1584
1734
  metricsPolicySchema,
1735
+ normalizeRepositoryKey,
1585
1736
  otelHookConfigPatchSchema,
1586
1737
  otelHookConfigSchema,
1587
1738
  otlpSignalEndpointFromBase,
@@ -1594,6 +1745,7 @@ export {
1594
1745
  readsCodexRolloutUsage,
1595
1746
  resolveConfig,
1596
1747
  resolveDestinationHeaders,
1748
+ resolveDestinationScopes,
1597
1749
  resolveExportDestinations,
1598
1750
  resolveOtlpHeaders,
1599
1751
  resourceAttributeValueSchema,