You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/building_applications/telemetry.mdx
+3-133Lines changed: 3 additions & 133 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,58 +10,8 @@ import TabItem from '@theme/TabItem';
10
10
11
11
# Telemetry
12
12
13
-
The Llama Stack telemetry system provides comprehensive tracing, metrics, and logging capabilities. It supports multiple sink types including OpenTelemetry, SQLite, and Console output for complete observability of your AI applications.
13
+
The Llama Stack uses OpenTelemetry to provide comprehensive tracing, metrics, and logging capabilities.
14
14
15
-
## Event Types
16
-
17
-
The telemetry system supports three main types of events:
- **`OTEL_SERVICE_NAME`**: Service name for telemetry (default: empty string)
188
-
- **`TELEMETRY_SINKS`**: Comma-separated list of sinks (default: `console,sqlite`)
122
+
- **`TELEMETRY_SINKS`**: Comma-separated list of sinks (default: `[]`)
189
123
190
124
### Quick Setup: Complete Telemetry Stack
191
125
@@ -248,37 +182,10 @@ Forward metrics to other observability systems:
248
182
</TabItem>
249
183
</Tabs>
250
184
251
-
## SQLite Querying
252
-
253
-
The `sqlite` sink allows you to query traces without an external system. This is particularly useful for development and custom analytics.
254
-
255
-
### Example Queries
256
-
257
-
```sql
258
-
-- Query recent traces
259
-
SELECT * FROM traces WHERE timestamp > datetime('now', '-1 hour');
260
-
261
-
-- Analyze span durations
262
-
SELECT name, AVG(duration_ms) as avg_duration
263
-
FROM spans
264
-
GROUP BY name
265
-
ORDER BY avg_duration DESC;
266
-
267
-
-- Find slow operations
268
-
SELECT * FROM spans
269
-
WHERE duration_ms > 1000
270
-
ORDER BY duration_ms DESC;
271
-
```
272
-
273
-
:::tip[Advanced Analytics]
274
-
Refer to the [Getting Started notebook](https://github.com/meta-llama/llama-stack/blob/main/docs/getting_started.ipynb) for more examples on querying traces and spans programmatically.
275
-
:::
276
-
277
185
## Best Practices
278
186
279
187
### 🔍 **Monitoring Strategy**
280
188
- Use OpenTelemetry for production environments
281
-
- Combine multiple sinks for development (console + SQLite)
282
189
- Set up alerts on key metrics like token usage and error rates
283
190
284
191
### 📊 **Metrics Analysis**
@@ -293,45 +200,8 @@ Refer to the [Getting Started notebook](https://github.com/meta-llama/llama-stac
293
200
294
201
### 🔧 **Configuration Management**
295
202
- Use environment variables for flexible deployment
296
-
- Configure appropriate retention policies for SQLite
297
203
- Ensure proper network access to OpenTelemetry collectors
298
204
299
-
## Integration Examples
300
-
301
-
### Basic Telemetry Setup
302
-
303
-
```python
304
-
from llama_stack_client import LlamaStackClient
305
-
306
-
# Client with telemetry headers
307
-
client = LlamaStackClient(
308
-
base_url="http://localhost:8000",
309
-
extra_headers={
310
-
"X-Telemetry-Service": "my-ai-app",
311
-
"X-Telemetry-Version": "1.0.0"
312
-
}
313
-
)
314
-
315
-
# All API calls will be automatically traced
316
-
response = client.chat.completions.create(
317
-
model="meta-llama/Llama-3.2-3B-Instruct",
318
-
messages=[{"role": "user", "content": "Hello!"}]
319
-
)
320
-
```
321
-
322
-
### Custom Telemetry Context
323
-
324
-
```python
325
-
# Add custom span attributes for better tracking
326
-
with tracer.start_as_current_span("custom_operation") as span:
|`otel_exporter_otlp_endpoint`|`str \| None`| No || The OpenTelemetry collector endpoint URL (base URL for traces, metrics, and logs). If not set, the SDK will use OTEL_EXPORTER_OTLP_ENDPOINT environment variable. |
18
18
|`service_name`|`<class 'str'>`| No | | The service name to use for telemetry |
19
-
|`sinks`|`list[inline.telemetry.meta_reference.config.TelemetrySink`| No |[<TelemetrySink.SQLITE: 'sqlite'>]| List of telemetry sinks to enable (possible values: otel_trace, otel_metric, sqlite, console) |
20
-
|`sqlite_db_path`|`<class 'str'>`| No |~/.llama/runtime/trace_store.db | The path to the SQLite database to use for storing traces |
19
+
|`sinks`|`list[inline.telemetry.meta_reference.config.TelemetrySink`| No |[]| List of telemetry sinks to enable (possible values: otel_trace, otel_metric, console) |
0 commit comments