@superblocksteam/telemetry 2.0.83-next.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/LICENSE.txt +87 -0
- package/README.md +155 -0
- package/dist/browser/index.d.ts +8 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +19 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/init.d.ts +75 -0
- package/dist/browser/init.d.ts.map +1 -0
- package/dist/browser/init.js +169 -0
- package/dist/browser/init.js.map +1 -0
- package/dist/browser/resilient-exporter.d.ts +43 -0
- package/dist/browser/resilient-exporter.d.ts.map +1 -0
- package/dist/browser/resilient-exporter.js +88 -0
- package/dist/browser/resilient-exporter.js.map +1 -0
- package/dist/common/contracts/tier2-traces.d.ts +75 -0
- package/dist/common/contracts/tier2-traces.d.ts.map +1 -0
- package/dist/common/contracts/tier2-traces.js +186 -0
- package/dist/common/contracts/tier2-traces.js.map +1 -0
- package/dist/common/deployment-type.d.ts +18 -0
- package/dist/common/deployment-type.d.ts.map +1 -0
- package/dist/common/deployment-type.js +30 -0
- package/dist/common/deployment-type.js.map +1 -0
- package/dist/common/guardrails.d.ts +116 -0
- package/dist/common/guardrails.d.ts.map +1 -0
- package/dist/common/guardrails.js +189 -0
- package/dist/common/guardrails.js.map +1 -0
- package/dist/common/index.d.ts +16 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +32 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/log-sanitizer.d.ts +78 -0
- package/dist/common/log-sanitizer.d.ts.map +1 -0
- package/dist/common/log-sanitizer.js +340 -0
- package/dist/common/log-sanitizer.js.map +1 -0
- package/dist/common/policy-evaluator.d.ts +103 -0
- package/dist/common/policy-evaluator.d.ts.map +1 -0
- package/dist/common/policy-evaluator.js +200 -0
- package/dist/common/policy-evaluator.js.map +1 -0
- package/dist/common/resource.d.ts +62 -0
- package/dist/common/resource.d.ts.map +1 -0
- package/dist/common/resource.js +106 -0
- package/dist/common/resource.js.map +1 -0
- package/dist/common/tier-hints.d.ts +182 -0
- package/dist/common/tier-hints.d.ts.map +1 -0
- package/dist/common/tier-hints.js +209 -0
- package/dist/common/tier-hints.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/lint/forbidden-attributes.d.ts +149 -0
- package/dist/lint/forbidden-attributes.d.ts.map +1 -0
- package/dist/lint/forbidden-attributes.js +214 -0
- package/dist/lint/forbidden-attributes.js.map +1 -0
- package/dist/lint/index.d.ts +9 -0
- package/dist/lint/index.d.ts.map +1 -0
- package/dist/lint/index.js +16 -0
- package/dist/lint/index.js.map +1 -0
- package/dist/llmobs/index.d.ts +22 -0
- package/dist/llmobs/index.d.ts.map +1 -0
- package/dist/llmobs/index.js +29 -0
- package/dist/llmobs/index.js.map +1 -0
- package/dist/llmobs/tier1-exporter.d.ts +146 -0
- package/dist/llmobs/tier1-exporter.d.ts.map +1 -0
- package/dist/llmobs/tier1-exporter.js +196 -0
- package/dist/llmobs/tier1-exporter.js.map +1 -0
- package/dist/llmobs/tier2-summarizer.d.ts +268 -0
- package/dist/llmobs/tier2-summarizer.d.ts.map +1 -0
- package/dist/llmobs/tier2-summarizer.js +650 -0
- package/dist/llmobs/tier2-summarizer.js.map +1 -0
- package/dist/node/exporters/resilient-exporter.d.ts +77 -0
- package/dist/node/exporters/resilient-exporter.d.ts.map +1 -0
- package/dist/node/exporters/resilient-exporter.js +129 -0
- package/dist/node/exporters/resilient-exporter.js.map +1 -0
- package/dist/node/index.d.ts +11 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +24 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/init.d.ts +75 -0
- package/dist/node/init.d.ts.map +1 -0
- package/dist/node/init.js +245 -0
- package/dist/node/init.js.map +1 -0
- package/dist/node/log-processor.d.ts +83 -0
- package/dist/node/log-processor.d.ts.map +1 -0
- package/dist/node/log-processor.js +266 -0
- package/dist/node/log-processor.js.map +1 -0
- package/dist/node/metrics-client.d.ts +66 -0
- package/dist/node/metrics-client.d.ts.map +1 -0
- package/dist/node/metrics-client.js +193 -0
- package/dist/node/metrics-client.js.map +1 -0
- package/dist/node/traced-socket.d.ts +76 -0
- package/dist/node/traced-socket.d.ts.map +1 -0
- package/dist/node/traced-socket.js +261 -0
- package/dist/node/traced-socket.js.map +1 -0
- package/dist/testing/in-memory-exporter.d.ts +179 -0
- package/dist/testing/in-memory-exporter.d.ts.map +1 -0
- package/dist/testing/in-memory-exporter.js +254 -0
- package/dist/testing/in-memory-exporter.js.map +1 -0
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +19 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/test-init.d.ts +80 -0
- package/dist/testing/test-init.d.ts.map +1 -0
- package/dist/testing/test-init.js +144 -0
- package/dist/testing/test-init.js.map +1 -0
- package/dist/types/index.d.ts +40 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +23 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/policy.d.ts +92 -0
- package/dist/types/policy.d.ts.map +1 -0
- package/dist/types/policy.js +125 -0
- package/dist/types/policy.js.map +1 -0
- package/dist-esm/browser/index.d.ts +8 -0
- package/dist-esm/browser/index.d.ts.map +1 -0
- package/dist-esm/browser/index.js +9 -0
- package/dist-esm/browser/index.js.map +1 -0
- package/dist-esm/browser/init.d.ts +75 -0
- package/dist-esm/browser/init.d.ts.map +1 -0
- package/dist-esm/browser/init.js +162 -0
- package/dist-esm/browser/init.js.map +1 -0
- package/dist-esm/browser/resilient-exporter.d.ts +43 -0
- package/dist-esm/browser/resilient-exporter.d.ts.map +1 -0
- package/dist-esm/browser/resilient-exporter.js +84 -0
- package/dist-esm/browser/resilient-exporter.js.map +1 -0
- package/dist-esm/common/contracts/tier2-traces.d.ts +75 -0
- package/dist-esm/common/contracts/tier2-traces.d.ts.map +1 -0
- package/dist-esm/common/contracts/tier2-traces.js +178 -0
- package/dist-esm/common/contracts/tier2-traces.js.map +1 -0
- package/dist-esm/common/deployment-type.d.ts +18 -0
- package/dist-esm/common/deployment-type.d.ts.map +1 -0
- package/dist-esm/common/deployment-type.js +27 -0
- package/dist-esm/common/deployment-type.js.map +1 -0
- package/dist-esm/common/guardrails.d.ts +116 -0
- package/dist-esm/common/guardrails.d.ts.map +1 -0
- package/dist-esm/common/guardrails.js +179 -0
- package/dist-esm/common/guardrails.js.map +1 -0
- package/dist-esm/common/index.d.ts +16 -0
- package/dist-esm/common/index.d.ts.map +1 -0
- package/dist-esm/common/index.js +16 -0
- package/dist-esm/common/index.js.map +1 -0
- package/dist-esm/common/log-sanitizer.d.ts +78 -0
- package/dist-esm/common/log-sanitizer.d.ts.map +1 -0
- package/dist-esm/common/log-sanitizer.js +331 -0
- package/dist-esm/common/log-sanitizer.js.map +1 -0
- package/dist-esm/common/policy-evaluator.d.ts +103 -0
- package/dist-esm/common/policy-evaluator.d.ts.map +1 -0
- package/dist-esm/common/policy-evaluator.js +196 -0
- package/dist-esm/common/policy-evaluator.js.map +1 -0
- package/dist-esm/common/resource.d.ts +62 -0
- package/dist-esm/common/resource.d.ts.map +1 -0
- package/dist-esm/common/resource.js +100 -0
- package/dist-esm/common/resource.js.map +1 -0
- package/dist-esm/common/tier-hints.d.ts +182 -0
- package/dist-esm/common/tier-hints.d.ts.map +1 -0
- package/dist-esm/common/tier-hints.js +199 -0
- package/dist-esm/common/tier-hints.js.map +1 -0
- package/dist-esm/index.d.ts +43 -0
- package/dist-esm/index.d.ts.map +1 -0
- package/dist-esm/index.js +53 -0
- package/dist-esm/index.js.map +1 -0
- package/dist-esm/lint/forbidden-attributes.d.ts +149 -0
- package/dist-esm/lint/forbidden-attributes.d.ts.map +1 -0
- package/dist-esm/lint/forbidden-attributes.js +209 -0
- package/dist-esm/lint/forbidden-attributes.js.map +1 -0
- package/dist-esm/lint/index.d.ts +9 -0
- package/dist-esm/lint/index.d.ts.map +1 -0
- package/dist-esm/lint/index.js +9 -0
- package/dist-esm/lint/index.js.map +1 -0
- package/dist-esm/llmobs/index.d.ts +22 -0
- package/dist-esm/llmobs/index.d.ts.map +1 -0
- package/dist-esm/llmobs/index.js +22 -0
- package/dist-esm/llmobs/index.js.map +1 -0
- package/dist-esm/llmobs/tier1-exporter.d.ts +146 -0
- package/dist-esm/llmobs/tier1-exporter.d.ts.map +1 -0
- package/dist-esm/llmobs/tier1-exporter.js +190 -0
- package/dist-esm/llmobs/tier1-exporter.js.map +1 -0
- package/dist-esm/llmobs/tier2-summarizer.d.ts +268 -0
- package/dist-esm/llmobs/tier2-summarizer.d.ts.map +1 -0
- package/dist-esm/llmobs/tier2-summarizer.js +646 -0
- package/dist-esm/llmobs/tier2-summarizer.js.map +1 -0
- package/dist-esm/node/exporters/resilient-exporter.d.ts +77 -0
- package/dist-esm/node/exporters/resilient-exporter.d.ts.map +1 -0
- package/dist-esm/node/exporters/resilient-exporter.js +125 -0
- package/dist-esm/node/exporters/resilient-exporter.js.map +1 -0
- package/dist-esm/node/index.d.ts +11 -0
- package/dist-esm/node/index.d.ts.map +1 -0
- package/dist-esm/node/index.js +11 -0
- package/dist-esm/node/index.js.map +1 -0
- package/dist-esm/node/init.d.ts +75 -0
- package/dist-esm/node/init.d.ts.map +1 -0
- package/dist-esm/node/init.js +239 -0
- package/dist-esm/node/init.js.map +1 -0
- package/dist-esm/node/log-processor.d.ts +83 -0
- package/dist-esm/node/log-processor.d.ts.map +1 -0
- package/dist-esm/node/log-processor.js +261 -0
- package/dist-esm/node/log-processor.js.map +1 -0
- package/dist-esm/node/metrics-client.d.ts +66 -0
- package/dist-esm/node/metrics-client.d.ts.map +1 -0
- package/dist-esm/node/metrics-client.js +189 -0
- package/dist-esm/node/metrics-client.js.map +1 -0
- package/dist-esm/node/traced-socket.d.ts +76 -0
- package/dist-esm/node/traced-socket.d.ts.map +1 -0
- package/dist-esm/node/traced-socket.js +257 -0
- package/dist-esm/node/traced-socket.js.map +1 -0
- package/dist-esm/testing/in-memory-exporter.d.ts +179 -0
- package/dist-esm/testing/in-memory-exporter.d.ts.map +1 -0
- package/dist-esm/testing/in-memory-exporter.js +248 -0
- package/dist-esm/testing/in-memory-exporter.js.map +1 -0
- package/dist-esm/testing/index.d.ts +8 -0
- package/dist-esm/testing/index.d.ts.map +1 -0
- package/dist-esm/testing/index.js +8 -0
- package/dist-esm/testing/index.js.map +1 -0
- package/dist-esm/testing/test-init.d.ts +80 -0
- package/dist-esm/testing/test-init.d.ts.map +1 -0
- package/dist-esm/testing/test-init.js +137 -0
- package/dist-esm/testing/test-init.js.map +1 -0
- package/dist-esm/types/index.d.ts +40 -0
- package/dist-esm/types/index.d.ts.map +1 -0
- package/dist-esm/types/index.js +7 -0
- package/dist-esm/types/index.js.map +1 -0
- package/dist-esm/types/policy.d.ts +92 -0
- package/dist-esm/types/policy.d.ts.map +1 -0
- package/dist-esm/types/policy.js +122 -0
- package/dist-esm/types/policy.js.map +1 -0
- package/package.json +101 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telemetry Policy Types
|
|
3
|
+
*
|
|
4
|
+
* NOTE: In the hybrid tier architecture, the OTEL Collector handles
|
|
5
|
+
* sanitization, hashing, and routing. The SDK just emits full-fidelity data.
|
|
6
|
+
* See obs/otel-collector/config-tiered.yaml for Collector configuration.
|
|
7
|
+
*/
|
|
8
|
+
import { DeploymentTypeEnum } from "@superblocksteam/shared";
|
|
9
|
+
export { DeploymentTypeEnum as DeploymentType };
|
|
10
|
+
/**
|
|
11
|
+
* Telemetry tier definitions.
|
|
12
|
+
*
|
|
13
|
+
* Tier 1 (Local): Full fidelity data for debugging. Stored in customer LGTM.
|
|
14
|
+
* Tier 2 (Operational): Sanitized metrics/traces for ops. Exported to Superblocks.
|
|
15
|
+
* Tier 3 (Analytics): AI experience telemetry. Exported with content controls.
|
|
16
|
+
*
|
|
17
|
+
* In the hybrid architecture:
|
|
18
|
+
* - SDK emits all data to the Collector
|
|
19
|
+
* - Collector transforms and routes to appropriate tier pipelines
|
|
20
|
+
* - Tier tagging, hashing, and filtering happen at Collector level
|
|
21
|
+
*/
|
|
22
|
+
export declare enum TelemetryTier {
|
|
23
|
+
/** Full fidelity debugging data - prompts, code, tool IO, stack traces */
|
|
24
|
+
TIER_1_LOCAL = "tier_1_local",
|
|
25
|
+
/** Sanitized operational metrics and traces for dashboards/billing */
|
|
26
|
+
TIER_2_OPERATIONAL = "tier_2_operational",
|
|
27
|
+
/** AI experience telemetry - prompts, responses, quality signals (no tool outputs) */
|
|
28
|
+
TIER_3_AI_EXPERIENCE = "tier_3_ai_experience"
|
|
29
|
+
}
|
|
30
|
+
export declare enum EnforcementMode {
|
|
31
|
+
/** Log violations but allow */
|
|
32
|
+
AUDIT = "audit",
|
|
33
|
+
/** Block violations */
|
|
34
|
+
ENFORCE = "enforce"
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Tier 3 content export policy for runtime control during incidents.
|
|
38
|
+
*/
|
|
39
|
+
export interface Tier3ContentPolicy {
|
|
40
|
+
/** Export AI prompts/responses. Kill switch for incidents. */
|
|
41
|
+
contentExportEnabled: boolean;
|
|
42
|
+
/** Redact detected secrets (JWTs, API keys, PEM blocks) from content */
|
|
43
|
+
secretRedactionEnabled: boolean;
|
|
44
|
+
/** Block export if tool output patterns detected in response */
|
|
45
|
+
toolOutputFilteringEnabled: boolean;
|
|
46
|
+
/** Max prompt length in bytes */
|
|
47
|
+
maxPromptBytes: number;
|
|
48
|
+
/** Max response length in bytes */
|
|
49
|
+
maxResponseBytes: number;
|
|
50
|
+
}
|
|
51
|
+
export interface TierConfig {
|
|
52
|
+
/** Is this tier enabled for local retention? */
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
/** Is this tier enabled for export? */
|
|
55
|
+
exportEnabled: boolean;
|
|
56
|
+
/** Sampling rate for this tier (0.0 - 1.0) */
|
|
57
|
+
sampleRate: number;
|
|
58
|
+
}
|
|
59
|
+
export interface TelemetryPolicy {
|
|
60
|
+
/** Deployment context */
|
|
61
|
+
deploymentType: DeploymentTypeEnum;
|
|
62
|
+
/** Per-tier configuration */
|
|
63
|
+
tiers: {
|
|
64
|
+
[TelemetryTier.TIER_1_LOCAL]: TierConfig;
|
|
65
|
+
[TelemetryTier.TIER_2_OPERATIONAL]: TierConfig;
|
|
66
|
+
[TelemetryTier.TIER_3_AI_EXPERIENCE]: TierConfig;
|
|
67
|
+
};
|
|
68
|
+
/** Tier 3 content export controls (prompts, responses). */
|
|
69
|
+
tier3Content: Tier3ContentPolicy;
|
|
70
|
+
/** Enforcement behavior */
|
|
71
|
+
enforcementMode: EnforcementMode;
|
|
72
|
+
/** Optional org-specific overrides */
|
|
73
|
+
orgOverrides?: Record<string, Partial<TelemetryPolicy>>;
|
|
74
|
+
}
|
|
75
|
+
/** Default Tier 3 content policy (enabled with all guardrails) */
|
|
76
|
+
export declare const TIER3_CONTENT_POLICY_DEFAULT: Tier3ContentPolicy;
|
|
77
|
+
/** Tier 3 content policy: disabled (kill switch) */
|
|
78
|
+
export declare const TIER3_CONTENT_POLICY_DISABLED: Tier3ContentPolicy;
|
|
79
|
+
/**
|
|
80
|
+
* Cloud deployment: all tiers enabled and exported.
|
|
81
|
+
*/
|
|
82
|
+
export declare const CLOUD_DEFAULT_POLICY: TelemetryPolicy;
|
|
83
|
+
/**
|
|
84
|
+
* Cloud-Prem deployment: Tier 1 local only, Tier 2/3 exported.
|
|
85
|
+
* Hashing/sanitization handled by OTEL Collector.
|
|
86
|
+
*/
|
|
87
|
+
export declare const CLOUD_PREM_DEFAULT_POLICY: TelemetryPolicy;
|
|
88
|
+
/**
|
|
89
|
+
* Get the default policy for a deployment type.
|
|
90
|
+
*/
|
|
91
|
+
export declare function getDefaultPolicy(deploymentType: DeploymentTypeEnum): TelemetryPolicy;
|
|
92
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +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AAC;IAEjC,2BAA2B;IAC3B,eAAe,EAAE,eAAe,CAAC;IAEjC,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC;CACzD;AAMD,kEAAkE;AAClE,eAAO,MAAM,4BAA4B,EAAE,kBAM1C,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,6BAA6B,EAAE,kBAM3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,eAqBlC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,eAqBvC,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,kBAAkB,GACjC,eAAe,CASjB"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLOUD_PREM_DEFAULT_POLICY = exports.CLOUD_DEFAULT_POLICY = exports.TIER3_CONTENT_POLICY_DISABLED = exports.TIER3_CONTENT_POLICY_DEFAULT = exports.EnforcementMode = exports.TelemetryTier = exports.DeploymentType = void 0;
|
|
4
|
+
exports.getDefaultPolicy = getDefaultPolicy;
|
|
5
|
+
/**
|
|
6
|
+
* Telemetry Policy Types
|
|
7
|
+
*
|
|
8
|
+
* NOTE: In the hybrid tier architecture, the OTEL Collector handles
|
|
9
|
+
* sanitization, hashing, and routing. The SDK just emits full-fidelity data.
|
|
10
|
+
* See obs/otel-collector/config-tiered.yaml for Collector configuration.
|
|
11
|
+
*/
|
|
12
|
+
const shared_1 = require("@superblocksteam/shared");
|
|
13
|
+
Object.defineProperty(exports, "DeploymentType", { enumerable: true, get: function () { return shared_1.DeploymentTypeEnum; } });
|
|
14
|
+
/**
|
|
15
|
+
* Telemetry tier definitions.
|
|
16
|
+
*
|
|
17
|
+
* Tier 1 (Local): Full fidelity data for debugging. Stored in customer LGTM.
|
|
18
|
+
* Tier 2 (Operational): Sanitized metrics/traces for ops. Exported to Superblocks.
|
|
19
|
+
* Tier 3 (Analytics): AI experience telemetry. Exported with content controls.
|
|
20
|
+
*
|
|
21
|
+
* In the hybrid architecture:
|
|
22
|
+
* - SDK emits all data to the Collector
|
|
23
|
+
* - Collector transforms and routes to appropriate tier pipelines
|
|
24
|
+
* - Tier tagging, hashing, and filtering happen at Collector level
|
|
25
|
+
*/
|
|
26
|
+
var TelemetryTier;
|
|
27
|
+
(function (TelemetryTier) {
|
|
28
|
+
/** Full fidelity debugging data - prompts, code, tool IO, stack traces */
|
|
29
|
+
TelemetryTier["TIER_1_LOCAL"] = "tier_1_local";
|
|
30
|
+
/** Sanitized operational metrics and traces for dashboards/billing */
|
|
31
|
+
TelemetryTier["TIER_2_OPERATIONAL"] = "tier_2_operational";
|
|
32
|
+
/** AI experience telemetry - prompts, responses, quality signals (no tool outputs) */
|
|
33
|
+
TelemetryTier["TIER_3_AI_EXPERIENCE"] = "tier_3_ai_experience";
|
|
34
|
+
})(TelemetryTier || (exports.TelemetryTier = TelemetryTier = {}));
|
|
35
|
+
var EnforcementMode;
|
|
36
|
+
(function (EnforcementMode) {
|
|
37
|
+
/** Log violations but allow */
|
|
38
|
+
EnforcementMode["AUDIT"] = "audit";
|
|
39
|
+
/** Block violations */
|
|
40
|
+
EnforcementMode["ENFORCE"] = "enforce";
|
|
41
|
+
})(EnforcementMode || (exports.EnforcementMode = EnforcementMode = {}));
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// Default Policies
|
|
44
|
+
// ============================================================================
|
|
45
|
+
/** Default Tier 3 content policy (enabled with all guardrails) */
|
|
46
|
+
exports.TIER3_CONTENT_POLICY_DEFAULT = {
|
|
47
|
+
contentExportEnabled: true,
|
|
48
|
+
secretRedactionEnabled: true,
|
|
49
|
+
toolOutputFilteringEnabled: true,
|
|
50
|
+
maxPromptBytes: 32768,
|
|
51
|
+
maxResponseBytes: 65536,
|
|
52
|
+
};
|
|
53
|
+
/** Tier 3 content policy: disabled (kill switch) */
|
|
54
|
+
exports.TIER3_CONTENT_POLICY_DISABLED = {
|
|
55
|
+
contentExportEnabled: false,
|
|
56
|
+
secretRedactionEnabled: true,
|
|
57
|
+
toolOutputFilteringEnabled: true,
|
|
58
|
+
maxPromptBytes: 32768,
|
|
59
|
+
maxResponseBytes: 65536,
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Cloud deployment: all tiers enabled and exported.
|
|
63
|
+
*/
|
|
64
|
+
exports.CLOUD_DEFAULT_POLICY = {
|
|
65
|
+
deploymentType: shared_1.DeploymentTypeEnum.CLOUD,
|
|
66
|
+
tiers: {
|
|
67
|
+
[TelemetryTier.TIER_1_LOCAL]: {
|
|
68
|
+
enabled: true,
|
|
69
|
+
exportEnabled: true,
|
|
70
|
+
sampleRate: 1.0,
|
|
71
|
+
},
|
|
72
|
+
[TelemetryTier.TIER_2_OPERATIONAL]: {
|
|
73
|
+
enabled: true,
|
|
74
|
+
exportEnabled: true,
|
|
75
|
+
sampleRate: 1.0,
|
|
76
|
+
},
|
|
77
|
+
[TelemetryTier.TIER_3_AI_EXPERIENCE]: {
|
|
78
|
+
enabled: true,
|
|
79
|
+
exportEnabled: true,
|
|
80
|
+
sampleRate: 1.0,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
tier3Content: exports.TIER3_CONTENT_POLICY_DEFAULT,
|
|
84
|
+
enforcementMode: EnforcementMode.ENFORCE,
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Cloud-Prem deployment: Tier 1 local only, Tier 2/3 exported.
|
|
88
|
+
* Hashing/sanitization handled by OTEL Collector.
|
|
89
|
+
*/
|
|
90
|
+
exports.CLOUD_PREM_DEFAULT_POLICY = {
|
|
91
|
+
deploymentType: shared_1.DeploymentTypeEnum.CLOUD_PREM,
|
|
92
|
+
tiers: {
|
|
93
|
+
[TelemetryTier.TIER_1_LOCAL]: {
|
|
94
|
+
enabled: true,
|
|
95
|
+
exportEnabled: false,
|
|
96
|
+
sampleRate: 1.0,
|
|
97
|
+
},
|
|
98
|
+
[TelemetryTier.TIER_2_OPERATIONAL]: {
|
|
99
|
+
enabled: true,
|
|
100
|
+
exportEnabled: true,
|
|
101
|
+
sampleRate: 1.0,
|
|
102
|
+
},
|
|
103
|
+
[TelemetryTier.TIER_3_AI_EXPERIENCE]: {
|
|
104
|
+
enabled: true,
|
|
105
|
+
exportEnabled: true,
|
|
106
|
+
sampleRate: 1.0,
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
tier3Content: exports.TIER3_CONTENT_POLICY_DEFAULT,
|
|
110
|
+
enforcementMode: EnforcementMode.ENFORCE,
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Get the default policy for a deployment type.
|
|
114
|
+
*/
|
|
115
|
+
function getDefaultPolicy(deploymentType) {
|
|
116
|
+
switch (deploymentType) {
|
|
117
|
+
case shared_1.DeploymentTypeEnum.CLOUD:
|
|
118
|
+
return exports.CLOUD_DEFAULT_POLICY;
|
|
119
|
+
case shared_1.DeploymentTypeEnum.CLOUD_PREM:
|
|
120
|
+
return exports.CLOUD_PREM_DEFAULT_POLICY;
|
|
121
|
+
default:
|
|
122
|
+
return exports.CLOUD_DEFAULT_POLICY;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/types/policy.ts"],"names":[],"mappings":";;;AAsKA,4CAWC;AAjLD;;;;;;GAMG;AACH,oDAA6D;AAG9B,+FAHtB,2BAAkB,OAGkB;AAE7C;;;;;;;;;;;GAWG;AACH,IAAY,aASX;AATD,WAAY,aAAa;IACvB,0EAA0E;IAC1E,8CAA6B,CAAA;IAE7B,sEAAsE;IACtE,0DAAyC,CAAA;IAEzC,sFAAsF;IACtF,8DAA6C,CAAA;AAC/C,CAAC,EATW,aAAa,6BAAb,aAAa,QAS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Y,CAAC,EAAE;YAC5B,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,GAAG;SAChB;QACD,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAAE;YAClC,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,IAAI;YACnB,UAAU,EAAE,GAAG;SAChB;QACD,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE;YACpC,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,IAAI;YACnB,UAAU,EAAE,GAAG;SAChB;KACF;IACD,YAAY,EAAE,oCAA4B;IAC1C,eAAe,EAAE,eAAe,CAAC,OAAO;CACzC,CAAC;AAEF;;GAEG;AACH,SAAgB,gBAAgB,CAC9B,cAAkC;IAElC,QAAQ,cAAc,EAAE,CAAC;QACvB,KAAK,2BAAkB,CAAC,KAAK;YAC3B,OAAO,4BAAoB,CAAC;QAC9B,KAAK,2BAAkB,CAAC,UAAU;YAChC,OAAO,iCAAyB,CAAC;QACnC;YACE,OAAO,4BAAoB,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Telemetry Bootstrap
|
|
3
|
+
*
|
|
4
|
+
* This is the ONLY approved way to initialize telemetry in browser contexts.
|
|
5
|
+
*/
|
|
6
|
+
export { initBrowserTelemetry, getBrowserTelemetryInstance, isBrowserTelemetryInitialized, resetBrowserTelemetry, getEnvironmentFromHostname, type BrowserTelemetryInstance, } from './init.js';
|
|
7
|
+
export { getDefaultPolicy, DeploymentType } from '../types/policy.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,6BAA6B,EAC7B,qBAAqB,EACrB,0BAA0B,EAC1B,KAAK,wBAAwB,GAC9B,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Telemetry Bootstrap
|
|
3
|
+
*
|
|
4
|
+
* This is the ONLY approved way to initialize telemetry in browser contexts.
|
|
5
|
+
*/
|
|
6
|
+
export { initBrowserTelemetry, getBrowserTelemetryInstance, isBrowserTelemetryInitialized, resetBrowserTelemetry, getEnvironmentFromHostname, } from './init.js';
|
|
7
|
+
// Re-export policy utilities for convenience
|
|
8
|
+
export { getDefaultPolicy, DeploymentType } from '../types/policy.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,6BAA6B,EAC7B,qBAAqB,EACrB,0BAA0B,GAE3B,MAAM,WAAW,CAAC;AAEnB,6CAA6C;AAC7C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Telemetry Bootstrap
|
|
3
|
+
*
|
|
4
|
+
* This is the ONLY approved way to initialize telemetry in browser contexts.
|
|
5
|
+
* Direct WebTracerProvider usage outside this package is prohibited.
|
|
6
|
+
*/
|
|
7
|
+
import { Tracer } from "@opentelemetry/api";
|
|
8
|
+
import { WebTracerProvider } from "@opentelemetry/sdk-trace-web";
|
|
9
|
+
import { TelemetryPolicyEvaluator } from "../common/policy-evaluator.js";
|
|
10
|
+
import type { BrowserTelemetryConfig } from "../types/index.js";
|
|
11
|
+
import { TelemetryPolicy } from "../types/policy.js";
|
|
12
|
+
/**
|
|
13
|
+
* Browser telemetry instance.
|
|
14
|
+
*/
|
|
15
|
+
export interface BrowserTelemetryInstance {
|
|
16
|
+
/** The underlying WebTracerProvider */
|
|
17
|
+
provider: WebTracerProvider;
|
|
18
|
+
/** Policy evaluator for runtime decisions */
|
|
19
|
+
policyEvaluator: TelemetryPolicyEvaluator;
|
|
20
|
+
/** Get a tracer */
|
|
21
|
+
getTracer: (name?: string) => Tracer;
|
|
22
|
+
/** Graceful shutdown */
|
|
23
|
+
shutdown: () => Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Initialize browser telemetry with policy enforcement.
|
|
27
|
+
*
|
|
28
|
+
* Browser telemetry is always sanitized (Tier 2) since it runs in untrusted context.
|
|
29
|
+
* Full fidelity Tier 1 data should never be emitted from the browser.
|
|
30
|
+
*
|
|
31
|
+
* @param config - Browser configuration
|
|
32
|
+
* @param policy - Telemetry policy (REQUIRED)
|
|
33
|
+
* @returns Browser telemetry instance
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import { initBrowserTelemetry } from '@superblocksteam/telemetry/browser';
|
|
38
|
+
* import { getDefaultPolicy, DeploymentType } from '@superblocksteam/shared';
|
|
39
|
+
*
|
|
40
|
+
* const policy = getDefaultPolicy(DeploymentType.CLOUD);
|
|
41
|
+
* const telemetry = initBrowserTelemetry({
|
|
42
|
+
* serviceName: 'superblocks-ui',
|
|
43
|
+
* serviceVersion: '1.0.0',
|
|
44
|
+
* environment: 'production',
|
|
45
|
+
* otlpUrl: 'https://app.superblocks.com/api/v1/traces',
|
|
46
|
+
* }, policy);
|
|
47
|
+
*
|
|
48
|
+
* const tracer = telemetry.getTracer();
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function initBrowserTelemetry(config: BrowserTelemetryConfig, policy: TelemetryPolicy): BrowserTelemetryInstance;
|
|
52
|
+
/**
|
|
53
|
+
* Get the current browser telemetry instance.
|
|
54
|
+
*
|
|
55
|
+
* @throws Error if not initialized
|
|
56
|
+
*/
|
|
57
|
+
export declare function getBrowserTelemetryInstance(): BrowserTelemetryInstance;
|
|
58
|
+
/**
|
|
59
|
+
* Check if browser telemetry is initialized.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isBrowserTelemetryInitialized(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Reset browser telemetry (for testing only).
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export declare function resetBrowserTelemetry(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Derive environment from hostname.
|
|
69
|
+
* Utility for browser context where env vars aren't available.
|
|
70
|
+
*
|
|
71
|
+
* @param hostname - The hostname to analyze
|
|
72
|
+
* @returns Environment string
|
|
73
|
+
*/
|
|
74
|
+
export declare function getEnvironmentFromHostname(hostname: string): string;
|
|
75
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/browser/init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAS,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAUjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAiB,MAAM,oBAAoB,CAAC;AAGpE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,uCAAuC;IACvC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,6CAA6C;IAC7C,eAAe,EAAE,wBAAwB,CAAC;IAC1C,mBAAmB;IACnB,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,wBAAwB;IACxB,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAmCD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,eAAe,GACtB,wBAAwB,CAkE1B;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,IAAI,wBAAwB,CAOtE;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAWnE"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Telemetry Bootstrap
|
|
3
|
+
*
|
|
4
|
+
* This is the ONLY approved way to initialize telemetry in browser contexts.
|
|
5
|
+
* Direct WebTracerProvider usage outside this package is prohibited.
|
|
6
|
+
*/
|
|
7
|
+
import { trace } from "@opentelemetry/api";
|
|
8
|
+
import { WebTracerProvider } from "@opentelemetry/sdk-trace-web";
|
|
9
|
+
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
10
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
11
|
+
import { W3CTraceContextPropagator, W3CBaggagePropagator, CompositePropagator, } from "@opentelemetry/core";
|
|
12
|
+
import { buildResource } from "../common/resource.js";
|
|
13
|
+
import { TelemetryPolicyEvaluator } from "../common/policy-evaluator.js";
|
|
14
|
+
import { TelemetryTier } from "../types/policy.js";
|
|
15
|
+
import { BrowserResilientExporter } from "./resilient-exporter.js";
|
|
16
|
+
// Singleton instance
|
|
17
|
+
let instance;
|
|
18
|
+
/**
|
|
19
|
+
* Validate browser telemetry configuration.
|
|
20
|
+
*
|
|
21
|
+
* @param config - Configuration to validate
|
|
22
|
+
* @throws Error if configuration is invalid
|
|
23
|
+
*/
|
|
24
|
+
function validateBrowserTelemetryConfig(config) {
|
|
25
|
+
if (!config.serviceName?.trim()) {
|
|
26
|
+
throw new Error("[Telemetry] serviceName is required and cannot be empty");
|
|
27
|
+
}
|
|
28
|
+
if (!config.serviceVersion?.trim()) {
|
|
29
|
+
throw new Error("[Telemetry] serviceVersion is required and cannot be empty");
|
|
30
|
+
}
|
|
31
|
+
if (!config.environment?.trim()) {
|
|
32
|
+
throw new Error("[Telemetry] environment is required and cannot be empty");
|
|
33
|
+
}
|
|
34
|
+
if (!config.otlpUrl?.trim()) {
|
|
35
|
+
throw new Error("[Telemetry] otlpUrl is required for browser telemetry");
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
new URL(config.otlpUrl);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
throw new Error(`[Telemetry] Invalid otlpUrl: ${config.otlpUrl} (${error.message})`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Initialize browser telemetry with policy enforcement.
|
|
46
|
+
*
|
|
47
|
+
* Browser telemetry is always sanitized (Tier 2) since it runs in untrusted context.
|
|
48
|
+
* Full fidelity Tier 1 data should never be emitted from the browser.
|
|
49
|
+
*
|
|
50
|
+
* @param config - Browser configuration
|
|
51
|
+
* @param policy - Telemetry policy (REQUIRED)
|
|
52
|
+
* @returns Browser telemetry instance
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* import { initBrowserTelemetry } from '@superblocksteam/telemetry/browser';
|
|
57
|
+
* import { getDefaultPolicy, DeploymentType } from '@superblocksteam/shared';
|
|
58
|
+
*
|
|
59
|
+
* const policy = getDefaultPolicy(DeploymentType.CLOUD);
|
|
60
|
+
* const telemetry = initBrowserTelemetry({
|
|
61
|
+
* serviceName: 'superblocks-ui',
|
|
62
|
+
* serviceVersion: '1.0.0',
|
|
63
|
+
* environment: 'production',
|
|
64
|
+
* otlpUrl: 'https://app.superblocks.com/api/v1/traces',
|
|
65
|
+
* }, policy);
|
|
66
|
+
*
|
|
67
|
+
* const tracer = telemetry.getTracer();
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export function initBrowserTelemetry(config, policy) {
|
|
71
|
+
// Policy is required
|
|
72
|
+
if (!policy) {
|
|
73
|
+
throw new Error("[Telemetry] Policy is required. Cannot initialize telemetry without a policy.");
|
|
74
|
+
}
|
|
75
|
+
// Validate config
|
|
76
|
+
validateBrowserTelemetryConfig(config);
|
|
77
|
+
// Return existing instance if already initialized
|
|
78
|
+
if (instance) {
|
|
79
|
+
console.warn("[Telemetry] Browser provider already initialized");
|
|
80
|
+
return instance;
|
|
81
|
+
}
|
|
82
|
+
const policyEvaluator = new TelemetryPolicyEvaluator(policy);
|
|
83
|
+
const resource = buildResource(config);
|
|
84
|
+
// Build span processors based on policy
|
|
85
|
+
// Use isExportEnabled (not canExport) - sampling applies at runtime, not initialization
|
|
86
|
+
const spanProcessors = policyEvaluator.isExportEnabled(TelemetryTier.TIER_2_OPERATIONAL)
|
|
87
|
+
? [
|
|
88
|
+
new BatchSpanProcessor(new BrowserResilientExporter({
|
|
89
|
+
delegate: new OTLPTraceExporter({ url: config.otlpUrl }),
|
|
90
|
+
})),
|
|
91
|
+
]
|
|
92
|
+
: [];
|
|
93
|
+
// Create provider with span processors in constructor (OTEL v2.x API)
|
|
94
|
+
const provider = new WebTracerProvider({
|
|
95
|
+
resource,
|
|
96
|
+
spanProcessors,
|
|
97
|
+
});
|
|
98
|
+
// Register with composite propagator for W3C TraceContext and Baggage
|
|
99
|
+
provider.register({
|
|
100
|
+
propagator: new CompositePropagator({
|
|
101
|
+
propagators: [
|
|
102
|
+
new W3CBaggagePropagator(),
|
|
103
|
+
new W3CTraceContextPropagator(),
|
|
104
|
+
],
|
|
105
|
+
}),
|
|
106
|
+
});
|
|
107
|
+
console.debug(`[Telemetry] Browser tracing initialized for ${config.serviceName} (${policy.deploymentType})`);
|
|
108
|
+
instance = {
|
|
109
|
+
provider,
|
|
110
|
+
policyEvaluator,
|
|
111
|
+
getTracer: (name) => trace.getTracer(name ?? config.serviceName, config.serviceVersion),
|
|
112
|
+
shutdown: async () => {
|
|
113
|
+
await provider.shutdown();
|
|
114
|
+
instance = undefined;
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
return instance;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get the current browser telemetry instance.
|
|
121
|
+
*
|
|
122
|
+
* @throws Error if not initialized
|
|
123
|
+
*/
|
|
124
|
+
export function getBrowserTelemetryInstance() {
|
|
125
|
+
if (!instance) {
|
|
126
|
+
throw new Error("[Telemetry] Not initialized. Call initBrowserTelemetry() first.");
|
|
127
|
+
}
|
|
128
|
+
return instance;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Check if browser telemetry is initialized.
|
|
132
|
+
*/
|
|
133
|
+
export function isBrowserTelemetryInitialized() {
|
|
134
|
+
return instance !== undefined;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Reset browser telemetry (for testing only).
|
|
138
|
+
* @internal
|
|
139
|
+
*/
|
|
140
|
+
export function resetBrowserTelemetry() {
|
|
141
|
+
instance = undefined;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Derive environment from hostname.
|
|
145
|
+
* Utility for browser context where env vars aren't available.
|
|
146
|
+
*
|
|
147
|
+
* @param hostname - The hostname to analyze
|
|
148
|
+
* @returns Environment string
|
|
149
|
+
*/
|
|
150
|
+
export function getEnvironmentFromHostname(hostname) {
|
|
151
|
+
if (hostname.includes("localhost") || hostname.includes("127.0.0.1")) {
|
|
152
|
+
return "local";
|
|
153
|
+
}
|
|
154
|
+
if (hostname.includes("staging") || hostname.includes("stg")) {
|
|
155
|
+
return "staging";
|
|
156
|
+
}
|
|
157
|
+
if (hostname.includes("dev") || hostname.includes("development")) {
|
|
158
|
+
return "development";
|
|
159
|
+
}
|
|
160
|
+
return "production";
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QACjE,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Resilient Exporter
|
|
3
|
+
*
|
|
4
|
+
* Simplified resilient exporter for browser environments.
|
|
5
|
+
* Ensures export failures don't affect the main thread.
|
|
6
|
+
*/
|
|
7
|
+
import type { SpanExporter, ReadableSpan } from "@opentelemetry/sdk-trace-base";
|
|
8
|
+
import { ExportResult } from "@opentelemetry/core";
|
|
9
|
+
/**
|
|
10
|
+
* Configuration for the browser resilient exporter.
|
|
11
|
+
*/
|
|
12
|
+
export interface BrowserResilientExporterConfig {
|
|
13
|
+
/** Underlying exporter to wrap */
|
|
14
|
+
delegate: SpanExporter;
|
|
15
|
+
/** Max items to buffer before dropping (default: 512, lower than Node for memory) */
|
|
16
|
+
maxQueueSize?: number;
|
|
17
|
+
/** Export timeout in ms (default: 10000, shorter for browser) */
|
|
18
|
+
exportTimeoutMs?: number;
|
|
19
|
+
/** Callback when items are dropped */
|
|
20
|
+
onDrop?: (count: number, reason: "queue_full" | "export_failed" | "timeout") => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Browser-compatible resilient exporter.
|
|
24
|
+
*
|
|
25
|
+
* CRITICAL: Export failures must never block or affect the main thread.
|
|
26
|
+
* This wrapper catches all errors and timeouts.
|
|
27
|
+
*/
|
|
28
|
+
export declare class BrowserResilientExporter implements SpanExporter {
|
|
29
|
+
private readonly delegate;
|
|
30
|
+
private readonly maxQueueSize;
|
|
31
|
+
private readonly exportTimeoutMs;
|
|
32
|
+
private readonly onDrop;
|
|
33
|
+
private queuedCount;
|
|
34
|
+
private shuttingDown;
|
|
35
|
+
constructor(config: BrowserResilientExporterConfig);
|
|
36
|
+
/**
|
|
37
|
+
* Export spans with resilient error handling.
|
|
38
|
+
*/
|
|
39
|
+
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
40
|
+
shutdown(): Promise<void>;
|
|
41
|
+
forceFlush(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=resilient-exporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resilient-exporter.d.ts","sourceRoot":"","sources":["../../src/browser/resilient-exporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAoB,MAAM,qBAAqB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,kCAAkC;IAClC,QAAQ,EAAE,YAAY,CAAC;IACvB,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,eAAe,GAAG,SAAS,KAAK,IAAI,CAAC;CACtF;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,YAAW,YAAY;IAC3D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAGb;IAEV,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,YAAY,CAAS;gBAEjB,MAAM,EAAE,8BAA8B;IAOlD;;OAEG;IACH,MAAM,CACJ,KAAK,EAAE,YAAY,EAAE,EACrB,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAC7C,IAAI;IAiDD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAKzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAGlC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Resilient Exporter
|
|
3
|
+
*
|
|
4
|
+
* Simplified resilient exporter for browser environments.
|
|
5
|
+
* Ensures export failures don't affect the main thread.
|
|
6
|
+
*/
|
|
7
|
+
import { ExportResultCode } from "@opentelemetry/core";
|
|
8
|
+
/**
|
|
9
|
+
* Browser-compatible resilient exporter.
|
|
10
|
+
*
|
|
11
|
+
* CRITICAL: Export failures must never block or affect the main thread.
|
|
12
|
+
* This wrapper catches all errors and timeouts.
|
|
13
|
+
*/
|
|
14
|
+
export class BrowserResilientExporter {
|
|
15
|
+
delegate;
|
|
16
|
+
maxQueueSize;
|
|
17
|
+
exportTimeoutMs;
|
|
18
|
+
onDrop;
|
|
19
|
+
queuedCount = 0;
|
|
20
|
+
shuttingDown = false;
|
|
21
|
+
constructor(config) {
|
|
22
|
+
this.delegate = config.delegate;
|
|
23
|
+
this.maxQueueSize = config.maxQueueSize ?? 512;
|
|
24
|
+
this.exportTimeoutMs = config.exportTimeoutMs ?? 10000;
|
|
25
|
+
this.onDrop = config.onDrop ?? (() => { });
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Export spans with resilient error handling.
|
|
29
|
+
*/
|
|
30
|
+
export(spans, resultCallback) {
|
|
31
|
+
// Reject during shutdown
|
|
32
|
+
if (this.shuttingDown) {
|
|
33
|
+
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// Check backpressure
|
|
37
|
+
if (this.queuedCount + spans.length > this.maxQueueSize) {
|
|
38
|
+
this.onDrop(spans.length, "queue_full");
|
|
39
|
+
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this.queuedCount += spans.length;
|
|
43
|
+
let completed = false;
|
|
44
|
+
// Timeout handler
|
|
45
|
+
const timeoutId = setTimeout(() => {
|
|
46
|
+
if (completed)
|
|
47
|
+
return;
|
|
48
|
+
completed = true;
|
|
49
|
+
this.queuedCount -= spans.length;
|
|
50
|
+
this.onDrop(spans.length, "timeout");
|
|
51
|
+
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
52
|
+
}, this.exportTimeoutMs);
|
|
53
|
+
try {
|
|
54
|
+
this.delegate.export(spans, (result) => {
|
|
55
|
+
if (completed)
|
|
56
|
+
return;
|
|
57
|
+
completed = true;
|
|
58
|
+
clearTimeout(timeoutId);
|
|
59
|
+
this.queuedCount -= spans.length;
|
|
60
|
+
if (result.code !== ExportResultCode.SUCCESS) {
|
|
61
|
+
this.onDrop(spans.length, "export_failed");
|
|
62
|
+
}
|
|
63
|
+
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
if (completed)
|
|
68
|
+
return;
|
|
69
|
+
completed = true;
|
|
70
|
+
clearTimeout(timeoutId);
|
|
71
|
+
this.queuedCount -= spans.length;
|
|
72
|
+
this.onDrop(spans.length, "export_failed");
|
|
73
|
+
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async shutdown() {
|
|
77
|
+
this.shuttingDown = true;
|
|
78
|
+
return this.delegate.shutdown();
|
|
79
|
+
}
|
|
80
|
+
async forceFlush() {
|
|
81
|
+
return this.delegate.forceFlush?.() ?? Promise.resolve();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=resilient-exporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resilient-exporter.js","sourceRoot":"","sources":["../../src/browser/resilient-exporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAgB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAgBrE;;;;;GAKG;AACH,MAAM,OAAO,wB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