telemetry-dev 0.2.13__tar.gz → 0.3.0__tar.gz
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.
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/PKG-INFO +10 -6
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/README.md +9 -5
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/pyproject.toml +1 -1
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/pyproject.toml.orig +1 -1
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_config.py +1 -1
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_prompts.py +8 -2
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/LICENSE +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/__init__.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_capture.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_client.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_context.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_export.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_logs.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_metrics.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_observe.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_processor.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_semconv.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_serialize.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/_spans.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/otel.py +0 -0
- {telemetry_dev-0.2.13 → telemetry_dev-0.3.0}/src/telemetry_dev/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: telemetry-dev
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: telemetry.dev SDK for Python — OpenTelemetry-native GenAI tracing, logs, and metrics
|
|
5
5
|
Keywords: telemetry,opentelemetry,llm,genai,tracing,observability
|
|
6
6
|
Author: telemetry.dev
|
|
@@ -81,7 +81,7 @@ routed to the `on_error` hook / `telemetry_dev` logger — never raised into you
|
|
|
81
81
|
| Variable | Default | Purpose |
|
|
82
82
|
| --- | --- | --- |
|
|
83
83
|
| `TELEMETRY_DEV_API_KEY` | — | Ingest key (`td_live_...`). Absent = SDK is a no-op. |
|
|
84
|
-
| `TELEMETRY_DEV_BASE_URL` | `https://
|
|
84
|
+
| `TELEMETRY_DEV_BASE_URL` | `https://api.telemetry.dev` | Base URL for telemetry export and `get_prompt` (trailing slashes stripped). |
|
|
85
85
|
| `TELEMETRY_DEV_ENVIRONMENT` | `production` | Deployment environment label. |
|
|
86
86
|
| `OTEL_SERVICE_NAME` | `unknown_service` | Service name on every trace. |
|
|
87
87
|
| `OTEL_TRACES_SAMPLER` | `parentbased_always_on` | OTel trace sampling policy, which includes session roots. |
|
|
@@ -89,6 +89,10 @@ routed to the `on_error` hook / `telemetry_dev` logger — never raised into you
|
|
|
89
89
|
|
|
90
90
|
Explicit `init()` arguments take precedence over environment variables.
|
|
91
91
|
|
|
92
|
+
Earlier versions sent data to `https://ingest.telemetry.dev` by default. That hostname reaches the
|
|
93
|
+
same service and stays supported: if a firewall allows only it, set `TELEMETRY_DEV_BASE_URL` or
|
|
94
|
+
`base_url` to it.
|
|
95
|
+
|
|
92
96
|
Root spans remain independent by default. `telemetry_dev.init(session_mode="process")` groups
|
|
93
97
|
otherwise uncorrelated spans and logs using a fresh opaque UUID for each enabled SDK
|
|
94
98
|
initialization. Explicit and propagated session IDs take precedence, and valid parent trace
|
|
@@ -253,7 +257,7 @@ pinned = telemetry_dev.get_prompt("support/reply", version=13)
|
|
|
253
257
|
without its prompt.
|
|
254
258
|
- `get_prompt` uses the API key and base URL of an enabled `init()`, or `TELEMETRY_DEV_API_KEY`
|
|
255
259
|
and `TELEMETRY_DEV_BASE_URL`, or its own `api_key` and `base_url`. It reads the same host that
|
|
256
|
-
telemetry goes to, `https://
|
|
260
|
+
telemetry goes to, `https://api.telemetry.dev` by default. The key needs the read scope for
|
|
257
261
|
prompts.
|
|
258
262
|
- When a label sends part of the traffic to a second version, each session keeps one version: the
|
|
259
263
|
choice uses the session id of `propagate_attributes` (or of `session_mode="process"`). Without a
|
|
@@ -331,7 +335,7 @@ from telemetry_dev import TelemetrySpanProcessor
|
|
|
331
335
|
| Option | Default | Purpose |
|
|
332
336
|
| --- | --- | --- |
|
|
333
337
|
| `api_key` | `TELEMETRY_DEV_API_KEY` | Ingest key. Absent with no `span_exporter` = inert no-op. |
|
|
334
|
-
| `base_url` | `TELEMETRY_DEV_BASE_URL` or `https://
|
|
338
|
+
| `base_url` | `TELEMETRY_DEV_BASE_URL` or `https://api.telemetry.dev` | Base URL; trailing slashes are stripped. |
|
|
335
339
|
| `export_mode` | `"batched"` | `"batched"` or `"immediate"` span export. |
|
|
336
340
|
| `max_export_batch_size` | `64` | BatchSpanProcessor export batch size. |
|
|
337
341
|
| `schedule_delay_millis` | `1000` | BatchSpanProcessor schedule delay. |
|
|
@@ -399,7 +403,7 @@ from opentelemetry.sdk.trace import TracerProvider
|
|
|
399
403
|
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
400
404
|
|
|
401
405
|
exporter = OTLPSpanExporter(
|
|
402
|
-
endpoint="https://
|
|
406
|
+
endpoint="https://api.telemetry.dev/v1/traces",
|
|
403
407
|
headers={"Authorization": f"Bearer {os.environ['TELEMETRY_DEV_API_KEY']}"},
|
|
404
408
|
)
|
|
405
409
|
provider = TracerProvider()
|
|
@@ -407,7 +411,7 @@ provider.add_span_processor(BatchSpanProcessor(exporter))
|
|
|
407
411
|
trace.set_tracer_provider(provider)
|
|
408
412
|
```
|
|
409
413
|
|
|
410
|
-
The Claude API can also send server-side spans to telemetry.dev through a Console destination. Set the endpoint to `https://
|
|
414
|
+
The Claude API can also send server-side spans to telemetry.dev through a Console destination. Set the endpoint to `https://api.telemetry.dev`. Set the `Authorization` header to `Bearer <telemetry.dev API key>`. For more information, refer to [Claude Platform](https://telemetry.dev/docs/integrations/claude-platform).
|
|
411
415
|
|
|
412
416
|
When the SDK and the Claude API send the spans of a request to the same telemetry.dev project, telemetry.dev counts the tokens of the request one time, from the API span. The SDK span stays in the trace with no tokens. telemetry.dev matches the two spans by the request ID or the response ID, so the API span does not have to be a child of the SDK span. If the Console destination uses an API key that is scoped to one environment, its API spans take over only the SDK spans of that environment.
|
|
413
417
|
|
|
@@ -56,7 +56,7 @@ routed to the `on_error` hook / `telemetry_dev` logger — never raised into you
|
|
|
56
56
|
| Variable | Default | Purpose |
|
|
57
57
|
| --- | --- | --- |
|
|
58
58
|
| `TELEMETRY_DEV_API_KEY` | — | Ingest key (`td_live_...`). Absent = SDK is a no-op. |
|
|
59
|
-
| `TELEMETRY_DEV_BASE_URL` | `https://
|
|
59
|
+
| `TELEMETRY_DEV_BASE_URL` | `https://api.telemetry.dev` | Base URL for telemetry export and `get_prompt` (trailing slashes stripped). |
|
|
60
60
|
| `TELEMETRY_DEV_ENVIRONMENT` | `production` | Deployment environment label. |
|
|
61
61
|
| `OTEL_SERVICE_NAME` | `unknown_service` | Service name on every trace. |
|
|
62
62
|
| `OTEL_TRACES_SAMPLER` | `parentbased_always_on` | OTel trace sampling policy, which includes session roots. |
|
|
@@ -64,6 +64,10 @@ routed to the `on_error` hook / `telemetry_dev` logger — never raised into you
|
|
|
64
64
|
|
|
65
65
|
Explicit `init()` arguments take precedence over environment variables.
|
|
66
66
|
|
|
67
|
+
Earlier versions sent data to `https://ingest.telemetry.dev` by default. That hostname reaches the
|
|
68
|
+
same service and stays supported: if a firewall allows only it, set `TELEMETRY_DEV_BASE_URL` or
|
|
69
|
+
`base_url` to it.
|
|
70
|
+
|
|
67
71
|
Root spans remain independent by default. `telemetry_dev.init(session_mode="process")` groups
|
|
68
72
|
otherwise uncorrelated spans and logs using a fresh opaque UUID for each enabled SDK
|
|
69
73
|
initialization. Explicit and propagated session IDs take precedence, and valid parent trace
|
|
@@ -228,7 +232,7 @@ pinned = telemetry_dev.get_prompt("support/reply", version=13)
|
|
|
228
232
|
without its prompt.
|
|
229
233
|
- `get_prompt` uses the API key and base URL of an enabled `init()`, or `TELEMETRY_DEV_API_KEY`
|
|
230
234
|
and `TELEMETRY_DEV_BASE_URL`, or its own `api_key` and `base_url`. It reads the same host that
|
|
231
|
-
telemetry goes to, `https://
|
|
235
|
+
telemetry goes to, `https://api.telemetry.dev` by default. The key needs the read scope for
|
|
232
236
|
prompts.
|
|
233
237
|
- When a label sends part of the traffic to a second version, each session keeps one version: the
|
|
234
238
|
choice uses the session id of `propagate_attributes` (or of `session_mode="process"`). Without a
|
|
@@ -306,7 +310,7 @@ from telemetry_dev import TelemetrySpanProcessor
|
|
|
306
310
|
| Option | Default | Purpose |
|
|
307
311
|
| --- | --- | --- |
|
|
308
312
|
| `api_key` | `TELEMETRY_DEV_API_KEY` | Ingest key. Absent with no `span_exporter` = inert no-op. |
|
|
309
|
-
| `base_url` | `TELEMETRY_DEV_BASE_URL` or `https://
|
|
313
|
+
| `base_url` | `TELEMETRY_DEV_BASE_URL` or `https://api.telemetry.dev` | Base URL; trailing slashes are stripped. |
|
|
310
314
|
| `export_mode` | `"batched"` | `"batched"` or `"immediate"` span export. |
|
|
311
315
|
| `max_export_batch_size` | `64` | BatchSpanProcessor export batch size. |
|
|
312
316
|
| `schedule_delay_millis` | `1000` | BatchSpanProcessor schedule delay. |
|
|
@@ -374,7 +378,7 @@ from opentelemetry.sdk.trace import TracerProvider
|
|
|
374
378
|
from opentelemetry.sdk.trace.export import BatchSpanProcessor
|
|
375
379
|
|
|
376
380
|
exporter = OTLPSpanExporter(
|
|
377
|
-
endpoint="https://
|
|
381
|
+
endpoint="https://api.telemetry.dev/v1/traces",
|
|
378
382
|
headers={"Authorization": f"Bearer {os.environ['TELEMETRY_DEV_API_KEY']}"},
|
|
379
383
|
)
|
|
380
384
|
provider = TracerProvider()
|
|
@@ -382,7 +386,7 @@ provider.add_span_processor(BatchSpanProcessor(exporter))
|
|
|
382
386
|
trace.set_tracer_provider(provider)
|
|
383
387
|
```
|
|
384
388
|
|
|
385
|
-
The Claude API can also send server-side spans to telemetry.dev through a Console destination. Set the endpoint to `https://
|
|
389
|
+
The Claude API can also send server-side spans to telemetry.dev through a Console destination. Set the endpoint to `https://api.telemetry.dev`. Set the `Authorization` header to `Bearer <telemetry.dev API key>`. For more information, refer to [Claude Platform](https://telemetry.dev/docs/integrations/claude-platform).
|
|
386
390
|
|
|
387
391
|
When the SDK and the Claude API send the spans of a request to the same telemetry.dev project, telemetry.dev counts the tokens of the request one time, from the API span. The SDK span stays in the trace with no tokens. telemetry.dev matches the two spans by the request ID or the response ID, so the API span does not have to be a child of the SDK span. If the Console destination uses an API key that is scoped to one environment, its API spans take over only the SDK spans of that environment.
|
|
388
392
|
|
|
@@ -26,7 +26,7 @@ from opentelemetry import context as otel_context
|
|
|
26
26
|
from opentelemetry.context import Context
|
|
27
27
|
|
|
28
28
|
from ._client import Client, get_client
|
|
29
|
-
from ._config import report_error, resolve_config
|
|
29
|
+
from ._config import SDK_VERSION, report_error, resolve_config
|
|
30
30
|
from ._context import propagated_attributes
|
|
31
31
|
from ._semconv import (
|
|
32
32
|
ATTR_PROMPT_LABEL,
|
|
@@ -333,7 +333,13 @@ def _get_prompt(
|
|
|
333
333
|
cache_ttl_seconds,
|
|
334
334
|
lambda: _fetch(
|
|
335
335
|
f"{url}/v1/prompts?{urllib.parse.urlencode(query)}",
|
|
336
|
-
{
|
|
336
|
+
{
|
|
337
|
+
"Authorization": f"Bearer {key}",
|
|
338
|
+
"X-Telemetry-Dev-SDK": "telemetry-dev",
|
|
339
|
+
# urllib's default User-Agent, Python-urllib/3.x, is refused by bot filters
|
|
340
|
+
# such as Cloudflare's Browser Integrity Check.
|
|
341
|
+
"User-Agent": f"telemetry-dev-python/{SDK_VERSION}",
|
|
342
|
+
},
|
|
337
343
|
),
|
|
338
344
|
on_error,
|
|
339
345
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|