@osfactory/otel-hook 0.13.1 → 0.13.2
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 +51 -3
- package/dist/cli.js +814 -164
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +5 -3
- package/dist/config.js +39 -5
- package/dist/config.js.map +1 -1
- package/dist/{destinations-DvqsPulb.d.ts → destinations-C4sSKjDO.d.ts} +1 -1
- package/dist/{export-destinations-DUeQKr_C.d.ts → export-destinations-BjRXDots.d.ts} +36 -4
- package/dist/{hook-D5imE0Qc.d.ts → hook-CKLpgrYP.d.ts} +2 -2
- package/dist/index.d.ts +8 -8
- package/dist/index.js +839 -193
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +1 -1
- package/dist/install.js +1 -0
- package/dist/install.js.map +1 -1
- package/dist/integration.d.ts +14 -7
- package/dist/integration.js +923 -172
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.js +1 -1
- package/dist/lifecycle.js.map +1 -1
- package/dist/{payload-CdDKeRpH.d.ts → payload-DLK7QaBB.d.ts} +17 -1
- package/dist/providers.d.ts +91 -6
- package/dist/providers.js +300 -2
- package/dist/providers.js.map +1 -1
- package/dist/{registry-BKQhhIO3.d.ts → registry-DM-4YvIA.d.ts} +1 -1
- package/dist/runtime.d.ts +3 -3
- package/dist/runtime.js +23 -3
- package/dist/runtime.js.map +1 -1
- package/dist/{schema-SpFM6YQY.d.ts → schema-CD61uW99.d.ts} +32 -3
- package/dist/telemetry.d.ts +3 -3
- package/dist/telemetry.js +820 -490
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +50 -19
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
export { D as DEFAULT_CONFIG, a as DEFAULT_DETECTION_POLICY, b as DEFAULT_DIAGNOSTICS_POLICY, c as
|
|
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';
|
|
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-
|
|
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';
|
|
7
7
|
export { g as contentModeSchema } from './policy-CimmCfRp.js';
|
|
8
8
|
import './taxonomy-DwhTtuWd.js';
|
|
9
9
|
import './content-M9xIKG7h.js';
|
|
@@ -246,6 +246,8 @@ declare const ENVIRONMENT_VARIABLES: Readonly<{
|
|
|
246
246
|
logLevel: "OTEL_HOOK_LOG_LEVEL";
|
|
247
247
|
/** `providers.claudeCode.readTranscriptUsage`; see `providersPolicySchema`. */
|
|
248
248
|
claudeTranscriptUsage: "OTEL_HOOK_CLAUDE_TRANSCRIPT_USAGE";
|
|
249
|
+
/** `providers.codex.readRolloutUsage`; see `providersPolicySchema`. */
|
|
250
|
+
codexRolloutUsage: "OTEL_HOOK_CODEX_ROLLOUT_USAGE";
|
|
249
251
|
}>;
|
|
250
252
|
/**
|
|
251
253
|
* Read configuration from an environment record.
|
package/dist/config.js
CHANGED
|
@@ -701,8 +701,26 @@ var exporterPolicySchema = z5.strictObject({
|
|
|
701
701
|
* Per-destination retry spool bounds, each optional and merged per leaf; any
|
|
702
702
|
* bound left unset takes its value from `DEFAULT_SPOOL_POLICY`.
|
|
703
703
|
*/
|
|
704
|
-
spool: spoolPolicySchema.partial().optional()
|
|
704
|
+
spool: spoolPolicySchema.partial().optional(),
|
|
705
|
+
/**
|
|
706
|
+
* The most time one hook invocation spends trying to reach one endpoint, in
|
|
707
|
+
* milliseconds: caps `timeoutMillis` for every OTLP request (connection setup
|
|
708
|
+
* included) and the exporter's own retries inside it. A batch that does not
|
|
709
|
+
* get through in time is spooled. Default {@link DEFAULT_EXPORT_BUDGET_MILLIS}:
|
|
710
|
+
* the host agent waits for its hooks, so a down collector must not stall it.
|
|
711
|
+
*/
|
|
712
|
+
exportBudgetMillis: z5.number().int().min(50).max(6e5).optional(),
|
|
713
|
+
/**
|
|
714
|
+
* After an endpoint was unreachable (refused, timed out, or answered a
|
|
715
|
+
* retryable status), every hook spools for it without trying for this long,
|
|
716
|
+
* in milliseconds; then one hook probes it again. 0 disables the window.
|
|
717
|
+
* Default {@link DEFAULT_ENDPOINT_DOWN_MILLIS}.
|
|
718
|
+
*/
|
|
719
|
+
endpointDownMillis: z5.number().int().min(0).max(36e5).optional()
|
|
705
720
|
});
|
|
721
|
+
var DEFAULT_EXPORT_BUDGET_MILLIS = 1500;
|
|
722
|
+
var DEFAULT_ENDPOINT_DOWN_MILLIS = 3e4;
|
|
723
|
+
var effectiveExportTimeoutMillis = (exporter) => Math.min(exporter.timeoutMillis, exporter.exportBudgetMillis ?? DEFAULT_EXPORT_BUDGET_MILLIS);
|
|
706
724
|
var detectionPolicySchema = z5.strictObject({
|
|
707
725
|
/** Detections below this confidence resolve to the unknown provider. */
|
|
708
726
|
minimumConfidence: detectionConfidenceSchema,
|
|
@@ -719,6 +737,9 @@ var diagnosticsPolicySchema = z5.strictObject({
|
|
|
719
737
|
var providersPolicySchema = z5.strictObject({
|
|
720
738
|
claudeCode: z5.strictObject({
|
|
721
739
|
readTranscriptUsage: z5.boolean()
|
|
740
|
+
}).optional(),
|
|
741
|
+
codex: z5.strictObject({
|
|
742
|
+
readRolloutUsage: z5.boolean()
|
|
722
743
|
}).optional()
|
|
723
744
|
});
|
|
724
745
|
var sessionContextPolicySchema = z5.strictObject({
|
|
@@ -748,7 +769,8 @@ var otelHookConfigPatchSchema = z5.strictObject({
|
|
|
748
769
|
detection: detectionPolicySchema.partial().optional(),
|
|
749
770
|
diagnostics: diagnosticsPolicySchema.partial().optional(),
|
|
750
771
|
providers: z5.strictObject({
|
|
751
|
-
claudeCode: z5.strictObject({ readTranscriptUsage: z5.boolean() }).partial().optional()
|
|
772
|
+
claudeCode: z5.strictObject({ readTranscriptUsage: z5.boolean() }).partial().optional(),
|
|
773
|
+
codex: z5.strictObject({ readRolloutUsage: z5.boolean() }).partial().optional()
|
|
752
774
|
}).partial().optional(),
|
|
753
775
|
sessionContext: sessionContextPolicySchema.partial().optional()
|
|
754
776
|
});
|
|
@@ -775,7 +797,8 @@ var DEFAULT_DIAGNOSTICS_POLICY = Object.freeze({
|
|
|
775
797
|
emitErrorEvents: true
|
|
776
798
|
});
|
|
777
799
|
var DEFAULT_PROVIDERS_POLICY = Object.freeze({
|
|
778
|
-
claudeCode: Object.freeze({ readTranscriptUsage: false })
|
|
800
|
+
claudeCode: Object.freeze({ readTranscriptUsage: false }),
|
|
801
|
+
codex: Object.freeze({ readRolloutUsage: false })
|
|
779
802
|
});
|
|
780
803
|
var DEFAULT_CONFIG = Object.freeze({
|
|
781
804
|
exporter: DEFAULT_EXPORTER_POLICY,
|
|
@@ -785,6 +808,7 @@ var DEFAULT_CONFIG = Object.freeze({
|
|
|
785
808
|
providers: DEFAULT_PROVIDERS_POLICY
|
|
786
809
|
});
|
|
787
810
|
var readsClaudeTranscriptUsage = (config) => config.providers?.claudeCode?.readTranscriptUsage === true;
|
|
811
|
+
var readsCodexRolloutUsage = (config) => config.providers?.codex?.readRolloutUsage === true;
|
|
788
812
|
var sessionContextDir = (config) => config.sessionContext?.dir;
|
|
789
813
|
var effectiveMetricsPolicy = (exporter) => ({
|
|
790
814
|
...DEFAULT_METRICS_POLICY,
|
|
@@ -1295,7 +1319,9 @@ var ENVIRONMENT_VARIABLES = Object.freeze({
|
|
|
1295
1319
|
minimumConfidence: "OTEL_HOOK_MIN_DETECTION_CONFIDENCE",
|
|
1296
1320
|
logLevel: "OTEL_HOOK_LOG_LEVEL",
|
|
1297
1321
|
/** `providers.claudeCode.readTranscriptUsage`; see `providersPolicySchema`. */
|
|
1298
|
-
claudeTranscriptUsage: "OTEL_HOOK_CLAUDE_TRANSCRIPT_USAGE"
|
|
1322
|
+
claudeTranscriptUsage: "OTEL_HOOK_CLAUDE_TRANSCRIPT_USAGE",
|
|
1323
|
+
/** `providers.codex.readRolloutUsage`; see `providersPolicySchema`. */
|
|
1324
|
+
codexRolloutUsage: "OTEL_HOOK_CODEX_ROLLOUT_USAGE"
|
|
1299
1325
|
});
|
|
1300
1326
|
var BOOLEAN_TRUE = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
1301
1327
|
var BOOLEAN_FALSE = /* @__PURE__ */ new Set(["0", "false", "no", "off"]);
|
|
@@ -1490,7 +1516,11 @@ var parseEnvironmentConfig = (env) => {
|
|
|
1490
1516
|
const detection = confidenceParsed?.success === true ? { minimumConfidence: confidenceParsed.data } : {};
|
|
1491
1517
|
const diagnostics = logLevel === void 0 ? {} : { logLevel };
|
|
1492
1518
|
const claudeTranscriptUsage = readBoolean(ENVIRONMENT_VARIABLES.claudeTranscriptUsage);
|
|
1493
|
-
const
|
|
1519
|
+
const codexRolloutUsage = readBoolean(ENVIRONMENT_VARIABLES.codexRolloutUsage);
|
|
1520
|
+
const providers = {
|
|
1521
|
+
...claudeTranscriptUsage === void 0 ? {} : { claudeCode: { readTranscriptUsage: claudeTranscriptUsage } },
|
|
1522
|
+
...codexRolloutUsage === void 0 ? {} : { codex: { readRolloutUsage: codexRolloutUsage } }
|
|
1523
|
+
};
|
|
1494
1524
|
const patch = {
|
|
1495
1525
|
...Object.keys(exporter).length === 0 ? {} : { exporter },
|
|
1496
1526
|
...Object.keys(privacy).length === 0 ? {} : { privacy },
|
|
@@ -1507,7 +1537,9 @@ export {
|
|
|
1507
1537
|
DEFAULT_DESTINATION_SIGNALS,
|
|
1508
1538
|
DEFAULT_DETECTION_POLICY,
|
|
1509
1539
|
DEFAULT_DIAGNOSTICS_POLICY,
|
|
1540
|
+
DEFAULT_ENDPOINT_DOWN_MILLIS,
|
|
1510
1541
|
DEFAULT_EXPORTER_POLICY,
|
|
1542
|
+
DEFAULT_EXPORT_BUDGET_MILLIS,
|
|
1511
1543
|
DEFAULT_LOGS_POLICY,
|
|
1512
1544
|
DEFAULT_METRICS_POLICY,
|
|
1513
1545
|
DEFAULT_PROVIDERS_POLICY,
|
|
@@ -1536,6 +1568,7 @@ export {
|
|
|
1536
1568
|
describeResourceAttributeNames,
|
|
1537
1569
|
detectionPolicySchema,
|
|
1538
1570
|
diagnosticsPolicySchema,
|
|
1571
|
+
effectiveExportTimeoutMillis,
|
|
1539
1572
|
effectiveMetricsPolicy,
|
|
1540
1573
|
effectiveSpoolPolicy,
|
|
1541
1574
|
endpointOrigin,
|
|
@@ -1558,6 +1591,7 @@ export {
|
|
|
1558
1591
|
parseResourceAttributesValue,
|
|
1559
1592
|
providersPolicySchema,
|
|
1560
1593
|
readsClaudeTranscriptUsage,
|
|
1594
|
+
readsCodexRolloutUsage,
|
|
1561
1595
|
resolveConfig,
|
|
1562
1596
|
resolveDestinationHeaders,
|
|
1563
1597
|
resolveExportDestinations,
|