@adea-ai/telemetry 4.1.2 → 4.1.3
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 +6 -6
- package/dist/redaction.js +22 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,19 +41,19 @@ import { createSentryErrorTracker } from '@adea-ai/telemetry/sentry'
|
|
|
41
41
|
|
|
42
42
|
## What's inside
|
|
43
43
|
|
|
44
|
-
- **Structured logging
|
|
44
|
+
- **Structured logging**: `createStructuredLogger` / `jsonLogger` emit
|
|
45
45
|
redacted JSON lines to stdout/stderr.
|
|
46
|
-
- **Redaction
|
|
46
|
+
- **Redaction**: `redactTelemetryValue` scrubs sensitive keys, bearer
|
|
47
47
|
tokens, GitHub/AWS/Slack/Stripe/Google credentials, URL credentials, and PEM
|
|
48
48
|
blocks from arbitrary values; `redactDiagnostics` applies substring-based
|
|
49
49
|
key matching with an explicit allowlist for diagnostics payloads.
|
|
50
|
-
- **Trace context
|
|
50
|
+
- **Trace context**: W3C-style `traceparent` extraction/injection for
|
|
51
51
|
cross-service correlation.
|
|
52
|
-
- **Sampling
|
|
52
|
+
- **Sampling**: `createDeterministicSamplingPolicy` for stable,
|
|
53
53
|
hash-based span sampling.
|
|
54
|
-
- **Adapters
|
|
54
|
+
- **Adapters**: OpenTelemetry metrics/traces, Sentry error tracking, and a
|
|
55
55
|
LangSmith trace adapter (port-injected, dependency-free).
|
|
56
|
-
- **Catalog** (`@adea-ai/telemetry/catalog`)
|
|
56
|
+
- **Catalog** (`@adea-ai/telemetry/catalog`): the Control Plane's canonical
|
|
57
57
|
execution-trace span names, operational metric names, and diagnostic
|
|
58
58
|
queries.
|
|
59
59
|
|
package/dist/redaction.js
CHANGED
|
@@ -62,7 +62,10 @@ const secretsInText = [
|
|
|
62
62
|
replacement: '[REDACTED_PATH]',
|
|
63
63
|
},
|
|
64
64
|
];
|
|
65
|
+
const mayContainSecretText = /[:=/]|bearer|gh[pousr]_|github_pat_|akia|asia|xox[baprs]-|_live_|aiza|-----begin|localhost|127/i;
|
|
65
66
|
function redactText(value) {
|
|
67
|
+
if (!mayContainSecretText.test(value))
|
|
68
|
+
return value;
|
|
66
69
|
return secretsInText.reduce((redacted, { pattern, replacement }) => redacted.replace(pattern, replacement), value);
|
|
67
70
|
}
|
|
68
71
|
const sensitiveKeySuffix = /(?:token|secret|password|passwd|passphrase|credentials?|apikey|privatekey|accesskey|secretkey|signingkey|encryptionkey|cookie|authorization)$/;
|
|
@@ -91,12 +94,17 @@ function redact(value, seen) {
|
|
|
91
94
|
if (seen.has(value))
|
|
92
95
|
return '[Circular]';
|
|
93
96
|
seen.add(value);
|
|
97
|
+
let result;
|
|
94
98
|
if (Array.isArray(value))
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
result = value.map((item) => redact(item, seen));
|
|
100
|
+
else {
|
|
101
|
+
const record = {};
|
|
102
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
103
|
+
record[key] = isSensitiveKey(key) ? '[REDACTED]' : redact(nested, seen);
|
|
104
|
+
}
|
|
105
|
+
result = record;
|
|
99
106
|
}
|
|
107
|
+
seen.delete(value);
|
|
100
108
|
return result;
|
|
101
109
|
}
|
|
102
110
|
export function sanitizeAttributes(attributes) {
|
|
@@ -126,14 +134,16 @@ function redactDiagnosticValue(value, explicitKeys, seen) {
|
|
|
126
134
|
if (seen.has(value))
|
|
127
135
|
return diagnosticCircularValue;
|
|
128
136
|
seen.add(value);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
const result = Array.isArray(value)
|
|
138
|
+
? value.map((item) => redactDiagnosticValue(item, explicitKeys, seen))
|
|
139
|
+
: Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
140
|
+
key,
|
|
141
|
+
isSensitiveDiagnosticKey(key, explicitKeys)
|
|
142
|
+
? diagnosticRedactedValue
|
|
143
|
+
: redactDiagnosticValue(item, explicitKeys, seen),
|
|
144
|
+
]));
|
|
145
|
+
seen.delete(value);
|
|
146
|
+
return result;
|
|
137
147
|
}
|
|
138
148
|
function isSensitiveDiagnosticKey(key, explicitKeys) {
|
|
139
149
|
return diagnosticSensitiveKey.test(key) || explicitKeys.has(normalizeDiagnosticKey(key));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/telemetry",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "Fail-open observability toolkit: structured logging, secret redaction, trace-context propagation, deterministic sampling, and pluggable OpenTelemetry, Sentry, and LangSmith adapters.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"langsmith",
|