@rbbtsn0w/adg 0.9.1-dev.pr116.6b5739f → 0.9.1-dev.pr118.0795f98
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 +8 -0
- package/dist/src/telemetry.js +24 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -472,6 +472,14 @@ every positional value, including file paths, to `[VALUE]`. The literal
|
|
|
472
472
|
argument values themselves — plugin names, sources, paths — are never
|
|
473
473
|
included.
|
|
474
474
|
|
|
475
|
+
Dev and PR-preview builds (a `-dev.*` prerelease or build metadata such as
|
|
476
|
+
`+local`) send the same spans to the development gateway,
|
|
477
|
+
`https://telemetry-gateway-development.hamiltonsnow.workers.dev/v1/traces`,
|
|
478
|
+
so pre-merge traffic stays out of the production dataset. Published releases,
|
|
479
|
+
including `beta` and `rc` prereleases, use the production gateway.
|
|
480
|
+
`OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` and `OTEL_EXPORTER_OTLP_ENDPOINT` still
|
|
481
|
+
override either default.
|
|
482
|
+
|
|
475
483
|
Opt out with any of:
|
|
476
484
|
|
|
477
485
|
```bash
|
package/dist/src/telemetry.js
CHANGED
|
@@ -23,6 +23,26 @@ export function normalizeTraceEndpoint(endpoint) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
const DEFAULT_TRACE_ENDPOINT = "https://telemetry-gateway.hamiltonsnow.workers.dev/v1/traces";
|
|
26
|
+
// Dev and PR-preview builds report here by default so pre-merge traffic never reaches
|
|
27
|
+
// the production dataset. The client cannot declare an environment, so the endpoint
|
|
28
|
+
// is the only isolation boundary.
|
|
29
|
+
const DEVELOPMENT_TRACE_ENDPOINT = "https://telemetry-gateway-development.hamiltonsnow.workers.dev/v1/traces";
|
|
30
|
+
const SEMVER_RE = /^v?\d+\.\d+\.\d+(?:-([0-9A-Za-z.-]+))?(?:\+([0-9A-Za-z.-]+))?$/;
|
|
31
|
+
/**
|
|
32
|
+
* Classify a build as `development` or `production` from its semver version.
|
|
33
|
+
* Only a `dev` prerelease (`0.9.1-dev.pr115.<sha>`) or build metadata (`+local`)
|
|
34
|
+
* leaves production; published `beta`/`rc` builds are user-facing and stay on
|
|
35
|
+
* production. An unparseable version falls back to production so a parsing defect
|
|
36
|
+
* can never silently drop stable-release telemetry.
|
|
37
|
+
*/
|
|
38
|
+
export function releaseChannel(version) {
|
|
39
|
+
const match = SEMVER_RE.exec(version);
|
|
40
|
+
if (!match)
|
|
41
|
+
return "production";
|
|
42
|
+
const [, prerelease, build] = match;
|
|
43
|
+
const isDev = prerelease?.split(".")[0]?.toLowerCase() === "dev";
|
|
44
|
+
return isDev || build !== undefined ? "development" : "production";
|
|
45
|
+
}
|
|
26
46
|
const GATEWAY_ORIGINS = new Set([
|
|
27
47
|
"https://telemetry-gateway-development.hamiltonsnow.workers.dev",
|
|
28
48
|
"https://telemetry-gateway-staging.hamiltonsnow.workers.dev",
|
|
@@ -63,18 +83,19 @@ export function withoutAmbientOtlpHeaders(operation) {
|
|
|
63
83
|
}
|
|
64
84
|
}
|
|
65
85
|
}
|
|
66
|
-
export function defaultTelemetryConfig(env) {
|
|
86
|
+
export function defaultTelemetryConfig(env, version = serviceVersion()) {
|
|
67
87
|
const explicitTraceEndpoint = env.OTEL_EXPORTER_OTLP_TRACES_ENDPOINT;
|
|
68
88
|
const explicitBaseEndpoint = env.OTEL_EXPORTER_OTLP_ENDPOINT;
|
|
89
|
+
const defaultEndpoint = releaseChannel(version) === "development" ? DEVELOPMENT_TRACE_ENDPOINT : DEFAULT_TRACE_ENDPOINT;
|
|
69
90
|
return {
|
|
70
91
|
enabled: env.OTEL_SDK_DISABLED?.toLowerCase() !== "true" &&
|
|
71
92
|
!env.DISABLE_TELEMETRY &&
|
|
72
93
|
!env.DO_NOT_TRACK &&
|
|
73
94
|
!env.NODE_TEST_CONTEXT,
|
|
74
95
|
traceEndpoint: explicitTraceEndpoint ??
|
|
75
|
-
(explicitBaseEndpoint ? normalizeTraceEndpoint(explicitBaseEndpoint) :
|
|
96
|
+
(explicitBaseEndpoint ? normalizeTraceEndpoint(explicitBaseEndpoint) : defaultEndpoint),
|
|
76
97
|
headers: gatewayHeaders(explicitTraceEndpoint ??
|
|
77
|
-
(explicitBaseEndpoint ? normalizeTraceEndpoint(explicitBaseEndpoint) :
|
|
98
|
+
(explicitBaseEndpoint ? normalizeTraceEndpoint(explicitBaseEndpoint) : defaultEndpoint)),
|
|
78
99
|
batch: {
|
|
79
100
|
maxQueueSize: 256,
|
|
80
101
|
maxExportBatchSize: 64,
|
package/package.json
CHANGED