@telemetry-dev/sdk 0.1.12 → 0.2.0
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 +13 -9
- package/dist/index.d.mts +2 -2
- package/package.json +2 -2
- package/src/config.ts +1 -1
- package/src/prompts.ts +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Pure TypeScript SDK for [telemetry.dev](https://telemetry.dev): add LLM traces, logs, and GenAI
|
|
4
4
|
metrics to any app. Built on OpenTelemetry — spans use the `gen_ai.*` semantic conventions and
|
|
5
|
-
ship as OTLP protobuf to `https://
|
|
5
|
+
ship as OTLP protobuf to `https://api.telemetry.dev`. Works on Node >= 20.19 and edge runtimes
|
|
6
6
|
(Vercel Edge, and Cloudflare Workers with Node.js compatibility, which is on by default for
|
|
7
7
|
compatibility dates of 2026-08-04 or later; earlier dates need the `nodejs_compat` flag). ESM-only;
|
|
8
8
|
CJS consumers can `require()` it on Node >= 20.19.
|
|
@@ -59,12 +59,16 @@ Without an API key every call is a silent no-op — the SDK never throws into yo
|
|
|
59
59
|
|
|
60
60
|
## Configuration
|
|
61
61
|
|
|
62
|
-
| Option | Env var | Default
|
|
63
|
-
| ------------- | --------------------------- |
|
|
64
|
-
| `apiKey` | `TELEMETRY_DEV_API_KEY` | — (absent ⇒ no-op)
|
|
65
|
-
| `baseUrl` | `TELEMETRY_DEV_BASE_URL` | `https://
|
|
66
|
-
| `environment` | `TELEMETRY_DEV_ENVIRONMENT` | `production`
|
|
67
|
-
| `serviceName` | `OTEL_SERVICE_NAME` | `unknown_service`
|
|
62
|
+
| Option | Env var | Default |
|
|
63
|
+
| ------------- | --------------------------- | --------------------------- |
|
|
64
|
+
| `apiKey` | `TELEMETRY_DEV_API_KEY` | — (absent ⇒ no-op) |
|
|
65
|
+
| `baseUrl` | `TELEMETRY_DEV_BASE_URL` | `https://api.telemetry.dev` |
|
|
66
|
+
| `environment` | `TELEMETRY_DEV_ENVIRONMENT` | `production` |
|
|
67
|
+
| `serviceName` | `OTEL_SERVICE_NAME` | `unknown_service` |
|
|
68
|
+
|
|
69
|
+
Earlier versions sent data to `https://ingest.telemetry.dev` by default. That hostname reaches the
|
|
70
|
+
same service and stays supported: if a firewall allows only it, set `TELEMETRY_DEV_BASE_URL` or
|
|
71
|
+
`baseUrl` to it.
|
|
68
72
|
|
|
69
73
|
Other `init()` options: `enabled` (kill switch), `registerGlobal`, `exportMode: "batched" |
|
|
70
74
|
"immediate"`, `captureInput` / `captureOutput`, `mask(value, { key })` redaction hook,
|
|
@@ -157,7 +161,7 @@ const pinned = await getPrompt("support/reply", { version: 13 });
|
|
|
157
161
|
its prompt.
|
|
158
162
|
- getPrompt uses the API key and base URL of an enabled `init()`, or `TELEMETRY_DEV_API_KEY` and
|
|
159
163
|
`TELEMETRY_DEV_BASE_URL`, or its own `apiKey`, `baseUrl`, and `fetch` options. It reads the same
|
|
160
|
-
host that telemetry goes to, `https://
|
|
164
|
+
host that telemetry goes to, `https://api.telemetry.dev` by default. The key needs the read
|
|
161
165
|
scope for prompts.
|
|
162
166
|
- When a label sends part of the traffic to a second version, each session keeps one version: the
|
|
163
167
|
choice uses the session id of `propagateAttributes` (or of `sessionMode: "process"`). Without a
|
|
@@ -268,7 +272,7 @@ Alternatively `init({ registerGlobal: true })` makes the SDK's provider the app'
|
|
|
268
272
|
that mode only this SDK's spans are exported by default.
|
|
269
273
|
|
|
270
274
|
Any vanilla OTel app can also skip the SDK entirely: point a stock OTLP/HTTP protobuf exporter at
|
|
271
|
-
`https://
|
|
275
|
+
`https://api.telemetry.dev/v1/traces` with an `Authorization: Bearer td_live_...` header.
|
|
272
276
|
|
|
273
277
|
### Native Claude SDK spans
|
|
274
278
|
|
package/dist/index.d.mts
CHANGED
|
@@ -16,7 +16,7 @@ type MaskFn<T = unknown> = (value: T, ctx: {
|
|
|
16
16
|
interface TelemetryOptions {
|
|
17
17
|
/** telemetry.dev ingest key (`td_live_…`). Falls back to `TELEMETRY_DEV_API_KEY`. When absent the SDK is a no-op. */
|
|
18
18
|
apiKey?: string;
|
|
19
|
-
/** Base URL for telemetry export and getPrompt. Falls back to `TELEMETRY_DEV_BASE_URL`, then `https://
|
|
19
|
+
/** Base URL for telemetry export and getPrompt. Falls back to `TELEMETRY_DEV_BASE_URL`, then `https://api.telemetry.dev`. */
|
|
20
20
|
baseUrl?: string;
|
|
21
21
|
/** Deployment environment label. Falls back to `TELEMETRY_DEV_ENVIRONMENT`, then `production`. */
|
|
22
22
|
environment?: string;
|
|
@@ -355,7 +355,7 @@ interface GetPromptOptionsBase {
|
|
|
355
355
|
cacheTtlSeconds?: number;
|
|
356
356
|
/** API key with the prompts:read scope. Falls back to the initialized client, then `TELEMETRY_DEV_API_KEY`. */
|
|
357
357
|
apiKey?: string;
|
|
358
|
-
/** Falls back to the initialized client, then `TELEMETRY_DEV_BASE_URL`, then `https://
|
|
358
|
+
/** Falls back to the initialized client, then `TELEMETRY_DEV_BASE_URL`, then `https://api.telemetry.dev`. */
|
|
359
359
|
baseUrl?: string;
|
|
360
360
|
/** Falls back to the initialized client's `fetch`, then `globalThis.fetch`. */
|
|
361
361
|
fetch?: typeof fetch;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telemetry-dev/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@opentelemetry/sdk-logs": "^0.223.0",
|
|
43
43
|
"@opentelemetry/sdk-metrics": "^2.12.0",
|
|
44
44
|
"@opentelemetry/sdk-trace-base": "^2.12.0",
|
|
45
|
-
"@telemetry-dev/otel": "^0.
|
|
45
|
+
"@telemetry-dev/otel": "^0.2.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@opentelemetry/api": "^1.9.1",
|
package/src/config.ts
CHANGED
|
@@ -22,7 +22,7 @@ export type MaskFn<T = unknown> = (value: T, ctx: { key: string }) => T;
|
|
|
22
22
|
export interface TelemetryOptions {
|
|
23
23
|
/** telemetry.dev ingest key (`td_live_…`). Falls back to `TELEMETRY_DEV_API_KEY`. When absent the SDK is a no-op. */
|
|
24
24
|
apiKey?: string;
|
|
25
|
-
/** Base URL for telemetry export and getPrompt. Falls back to `TELEMETRY_DEV_BASE_URL`, then `https://
|
|
25
|
+
/** Base URL for telemetry export and getPrompt. Falls back to `TELEMETRY_DEV_BASE_URL`, then `https://api.telemetry.dev`. */
|
|
26
26
|
baseUrl?: string;
|
|
27
27
|
/** Deployment environment label. Falls back to `TELEMETRY_DEV_ENVIRONMENT`, then `production`. */
|
|
28
28
|
environment?: string;
|
package/src/prompts.ts
CHANGED
|
@@ -118,7 +118,7 @@ interface GetPromptOptionsBase {
|
|
|
118
118
|
cacheTtlSeconds?: number;
|
|
119
119
|
/** API key with the prompts:read scope. Falls back to the initialized client, then `TELEMETRY_DEV_API_KEY`. */
|
|
120
120
|
apiKey?: string;
|
|
121
|
-
/** Falls back to the initialized client, then `TELEMETRY_DEV_BASE_URL`, then `https://
|
|
121
|
+
/** Falls back to the initialized client, then `TELEMETRY_DEV_BASE_URL`, then `https://api.telemetry.dev`. */
|
|
122
122
|
baseUrl?: string;
|
|
123
123
|
/** Falls back to the initialized client's `fetch`, then `globalThis.fetch`. */
|
|
124
124
|
fetch?: typeof fetch;
|