@telemetry-dev/sdk 0.1.7 → 0.1.8

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 CHANGED
@@ -102,6 +102,8 @@ The SDK installs the [session sampling wrapper](../otel/README.md#correlation-at
102
102
  or inject W3C trace context. Baggage is omitted unless `includeBaggage` is true.
103
103
  - `captureEnabled("input" | "output")` — report whether the active initialized client permits that
104
104
  capture direction. Returns `false` when no client is initialized.
105
+ - `captureMasked()` — report whether the active initialized client has a `mask` configured.
106
+ Returns `false` when no client is initialized.
105
107
  - `boundedCapture(value, options?)` — copy a JSON-compatible value within bounded work and retained
106
108
  size. Defaults to 48 KiB, depth 32, and 1,000 traversal items. Returns `{ value, truncated }`;
107
109
  `value` can be partial or `undefined` when a limit, cycle, getter, or skip rule prevents capture.
@@ -126,9 +128,9 @@ histogram state and does not retain individual intervals. Pull-based timing incl
126
128
  between reads. An explicit timestamp uses the same monotonic millisecond clock for every chunk.
127
129
 
128
130
  Provider integrations feature-detect stream APIs. With an older core SDK that lacks the stream
129
- capture policy, streams are still traced with usage, model, finish reason, and timing, but output
130
- retention assumes the default 65536 limit and treats a mask as configured, so incomplete output is
131
- withheld. Instrumentation failures are not reported to `onError` with such a core. If only
131
+ capture policy, streams are still traced with usage, model, finish reason, and timing. Output is
132
+ retained within the same fixed bounds as with a current core, but a mask is assumed to be
133
+ configured, so incomplete output is withheld. Instrumentation failures are not reported to `onError` with such a core. If only
132
134
  `recordOutputChunk` is unavailable, tracing and reconstruction continue but chunk-interval metrics
133
135
  are unavailable. Upgrade the core SDK with provider integrations to enable the full stream
134
136
  telemetry.
package/dist/index.d.mts CHANGED
@@ -154,6 +154,8 @@ interface TelemetryClient {
154
154
  shutdown(): Promise<void>;
155
155
  }
156
156
  declare function captureEnabled(kind: "input" | "output"): boolean;
157
+ /** Whether the active client runs captured values through a mask; false before `init`. */
158
+ declare function captureMasked(): boolean;
157
159
  declare function flush(): Promise<void>;
158
160
  declare function shutdown(): Promise<void>;
159
161
  declare function init(options?: TelemetryOptions, overrides?: ClientOverrides): TelemetryClient;
@@ -242,4 +244,4 @@ interface ObserveOptions extends StartSpanOptions {
242
244
  */
243
245
  declare function observe<TThis, TArgs extends unknown[], TReturn>(fn: (this: TThis, ...args: TArgs) => TReturn, options?: ObserveOptions): (...args: TArgs) => TReturn;
244
246
  //#endregion
245
- export { type AgentFields, type BatchOptions, type BoundedCaptureDetails, type BoundedCaptureOptions, type BoundedCaptureResult, type ClientOverrides, type ExportMode, type GenerationFields, type LogLevel, type LogOptions, type MaskFn, type ObserveOptions, type ParentRef, type PropagatedAttributes, SCOPE_NAME, type SdkLogLevel, type SpanCapturePolicy, type SpanFields, type SpanHandle, type SpanType, type StartSpanOptions, type TelemetryClient, type TelemetryOptions, TelemetrySpanProcessor, type TelemetrySpanProcessorOptions, type TokenUsage, type ToolFields, activeContext, boundedCapture, boundedCaptureDetails, captureEnabled, extractW3cContext, flush, getTraceparent, init, injectW3cContext, log, observe, propagateAttributes, shutdown, startActiveSpan, startSpan, updateActiveSpan, withContext };
247
+ export { type AgentFields, type BatchOptions, type BoundedCaptureDetails, type BoundedCaptureOptions, type BoundedCaptureResult, type ClientOverrides, type ExportMode, type GenerationFields, type LogLevel, type LogOptions, type MaskFn, type ObserveOptions, type ParentRef, type PropagatedAttributes, SCOPE_NAME, type SdkLogLevel, type SpanCapturePolicy, type SpanFields, type SpanHandle, type SpanType, type StartSpanOptions, type TelemetryClient, type TelemetryOptions, TelemetrySpanProcessor, type TelemetrySpanProcessorOptions, type TokenUsage, type ToolFields, activeContext, boundedCapture, boundedCaptureDetails, captureEnabled, captureMasked, extractW3cContext, flush, getTraceparent, init, injectW3cContext, log, observe, propagateAttributes, shutdown, startActiveSpan, startSpan, updateActiveSpan, withContext };
package/dist/index.mjs CHANGED
@@ -63,6 +63,10 @@ function captureEnabled(kind) {
63
63
  const config = currentClient().core?.config;
64
64
  return kind === "input" ? config?.captureInput ?? false : config?.captureOutput ?? false;
65
65
  }
66
+ /** Whether the active client runs captured values through a mask; false before `init`. */
67
+ function captureMasked() {
68
+ return currentClient().core?.config.mask !== void 0;
69
+ }
66
70
  function flush() {
67
71
  return currentClient().flush();
68
72
  }
@@ -805,4 +809,4 @@ function observe(fn, options) {
805
809
  return wrapped;
806
810
  }
807
811
  //#endregion
808
- export { SCOPE_NAME, TelemetrySpanProcessor, activeContext, boundedCapture, boundedCaptureDetails, captureEnabled, extractW3cContext, flush, getTraceparent, init, injectW3cContext, log, observe, propagateAttributes, shutdown, startActiveSpan, startSpan, updateActiveSpan, withContext };
812
+ export { SCOPE_NAME, TelemetrySpanProcessor, activeContext, boundedCapture, boundedCaptureDetails, captureEnabled, captureMasked, extractW3cContext, flush, getTraceparent, init, injectW3cContext, log, observe, propagateAttributes, shutdown, startActiveSpan, startSpan, updateActiveSpan, withContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telemetry-dev/sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Pure TypeScript SDK for telemetry.dev: LLM traces, logs, and GenAI metrics on OpenTelemetry, for Node and edge runtimes.",
5
5
  "keywords": [
6
6
  "genai",
package/src/client.ts CHANGED
@@ -94,6 +94,11 @@ export function captureEnabled(kind: "input" | "output"): boolean {
94
94
  return kind === "input" ? (config?.captureInput ?? false) : (config?.captureOutput ?? false);
95
95
  }
96
96
 
97
+ /** Whether the active client runs captured values through a mask; false before `init`. */
98
+ export function captureMasked(): boolean {
99
+ return currentClient().core?.config.mask !== undefined;
100
+ }
101
+
97
102
  export function flush(): Promise<void> {
98
103
  return currentClient().flush();
99
104
  }
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ export type {
9
9
 
10
10
  export {
11
11
  captureEnabled,
12
+ captureMasked,
12
13
  type ClientOverrides,
13
14
  flush,
14
15
  init,