Skip to content

Commit 6ba9db3

Browse files
authored
chore!: BREAKING CHANGE: remove sqlite from telemetry config (llamastack#3808)
# What does this PR do? - Removed sqlite sink from telemetry config. - Removed related code - Updated doc related to telemetry ## Test Plan CI
1 parent 0a96a7f commit 6ba9db3

File tree

21 files changed

+26
-1026
lines changed

21 files changed

+26
-1026
lines changed

docs/docs/building_applications/telemetry.mdx

Lines changed: 3 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -10,58 +10,8 @@ import TabItem from '@theme/TabItem';
1010

1111
# Telemetry
1212

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.
1414

15-
## Event Types
16-
17-
The telemetry system supports three main types of events:
18-
19-
<Tabs>
20-
<TabItem value="unstructured" label="Unstructured Logs">
21-
22-
Free-form log messages with severity levels for general application logging:
23-
24-
```python
25-
unstructured_log_event = UnstructuredLogEvent(
26-
message="This is a log message",
27-
severity=LogSeverity.INFO
28-
)
29-
```
30-
31-
</TabItem>
32-
<TabItem value="metrics" label="Metric Events">
33-
34-
Numerical measurements with units for tracking performance and usage:
35-
36-
```python
37-
metric_event = MetricEvent(
38-
metric="my_metric",
39-
value=10,
40-
unit="count"
41-
)
42-
```
43-
44-
</TabItem>
45-
<TabItem value="structured" label="Structured Logs">
46-
47-
System events like span start/end that provide structured operation tracking:
48-
49-
```python
50-
structured_log_event = SpanStartPayload(
51-
name="my_span",
52-
parent_span_id="parent_span_id"
53-
)
54-
```
55-
56-
</TabItem>
57-
</Tabs>
58-
59-
## Spans and Traces
60-
61-
- **Spans**: Represent individual operations with timing information and hierarchical relationships
62-
- **Traces**: Collections of related spans that form a complete request flow across your application
63-
64-
This hierarchical structure allows you to understand the complete execution path of requests through your Llama Stack application.
6515

6616
## Automatic Metrics Generation
6717

@@ -129,21 +79,6 @@ Send events to an OpenTelemetry Collector for integration with observability pla
12979
- Compatible with all OpenTelemetry collectors
13080
- Supports both traces and metrics
13181

132-
</TabItem>
133-
<TabItem value="sqlite" label="SQLite">
134-
135-
Store events in a local SQLite database for direct querying:
136-
137-
**Use Cases:**
138-
- Local development and debugging
139-
- Custom analytics and reporting
140-
- Offline analysis of application behavior
141-
142-
**Features:**
143-
- Direct SQL querying capabilities
144-
- Persistent local storage
145-
- No external dependencies
146-
14782
</TabItem>
14883
<TabItem value="console" label="Console">
14984

@@ -174,9 +109,8 @@ telemetry:
174109
provider_type: inline::meta-reference
175110
config:
176111
service_name: "llama-stack-service"
177-
sinks: ['console', 'sqlite', 'otel_trace', 'otel_metric']
112+
sinks: ['console', 'otel_trace', 'otel_metric']
178113
otel_exporter_otlp_endpoint: "http://localhost:4318"
179-
sqlite_db_path: "/path/to/telemetry.db"
180114
```
181115
182116
### Environment Variables
@@ -185,7 +119,7 @@ Configure telemetry behavior using environment variables:
185119
186120
- **`OTEL_EXPORTER_OTLP_ENDPOINT`**: OpenTelemetry Collector endpoint (default: `http://localhost:4318`)
187121
- **`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: `[]`)
189123

190124
### Quick Setup: Complete Telemetry Stack
191125

@@ -248,37 +182,10 @@ Forward metrics to other observability systems:
248182
</TabItem>
249183
</Tabs>
250184

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-
277185
## Best Practices
278186

279187
### 🔍 **Monitoring Strategy**
280188
- Use OpenTelemetry for production environments
281-
- Combine multiple sinks for development (console + SQLite)
282189
- Set up alerts on key metrics like token usage and error rates
283190

284191
### 📊 **Metrics Analysis**
@@ -293,45 +200,8 @@ Refer to the [Getting Started notebook](https://github.com/meta-llama/llama-stac
293200

294201
### 🔧 **Configuration Management**
295202
- Use environment variables for flexible deployment
296-
- Configure appropriate retention policies for SQLite
297203
- Ensure proper network access to OpenTelemetry collectors
298204

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:
327-
span.set_attribute("user_id", "user123")
328-
span.set_attribute("operation_type", "chat_completion")
329-
330-
response = client.chat.completions.create(
331-
model="meta-llama/Llama-3.2-3B-Instruct",
332-
messages=[{"role": "user", "content": "Hello!"}]
333-
)
334-
```
335205

336206
## Related Resources
337207

docs/docs/distributions/self_hosted_distro/starter.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ The following environment variables can be configured:
119119

120120
### Telemetry Configuration
121121
- `OTEL_SERVICE_NAME`: OpenTelemetry service name
122-
- `TELEMETRY_SINKS`: Telemetry sinks (default: `console,sqlite`)
122+
- `TELEMETRY_SINKS`: Telemetry sinks (default: `[]`)
123123

124124
## Enabling Providers
125125

@@ -216,7 +216,6 @@ The starter distribution uses SQLite for local storage of various components:
216216
- **Files metadata**: `~/.llama/distributions/starter/files_metadata.db`
217217
- **Agents store**: `~/.llama/distributions/starter/agents_store.db`
218218
- **Responses store**: `~/.llama/distributions/starter/responses_store.db`
219-
- **Trace store**: `~/.llama/distributions/starter/trace_store.db`
220219
- **Evaluation store**: `~/.llama/distributions/starter/meta_reference_eval.db`
221220
- **Dataset I/O stores**: Various HuggingFace and local filesystem stores
222221

docs/docs/providers/telemetry/inline_meta-reference.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ Meta's reference implementation of telemetry and observability using OpenTelemet
1616
|-------|------|----------|---------|-------------|
1717
| `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. |
1818
| `service_name` | `<class 'str'>` | No || The service name to use for telemetry |
19-
| `sinks` | `list[inline.telemetry.meta_reference.config.TelemetrySink` | No | [&lt;TelemetrySink.SQLITE: 'sqlite'&gt;] | 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) |
2120

2221
## Sample Configuration
2322

2423
```yaml
2524
service_name: "${env.OTEL_SERVICE_NAME:=\u200B}"
26-
sinks: ${env.TELEMETRY_SINKS:=sqlite}
27-
sqlite_db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/trace_store.db
25+
sinks: ${env.TELEMETRY_SINKS:=}
2826
otel_exporter_otlp_endpoint: ${env.OTEL_EXPORTER_OTLP_ENDPOINT:=}
2927
```

llama_stack/apis/telemetry/telemetry.py

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -421,104 +421,3 @@ async def log_event(
421421
:param ttl_seconds: The time to live of the event.
422422
"""
423423
...
424-
425-
async def query_traces(
426-
self,
427-
attribute_filters: list[QueryCondition] | None = None,
428-
limit: int | None = 100,
429-
offset: int | None = 0,
430-
order_by: list[str] | None = None,
431-
) -> QueryTracesResponse:
432-
"""Query traces.
433-
434-
:param attribute_filters: The attribute filters to apply to the traces.
435-
:param limit: The limit of traces to return.
436-
:param offset: The offset of the traces to return.
437-
:param order_by: The order by of the traces to return.
438-
:returns: A QueryTracesResponse.
439-
"""
440-
...
441-
442-
async def get_trace(self, trace_id: str) -> Trace:
443-
"""Get a trace by its ID.
444-
445-
:param trace_id: The ID of the trace to get.
446-
:returns: A Trace.
447-
"""
448-
...
449-
450-
async def get_span(self, trace_id: str, span_id: str) -> Span:
451-
"""Get a span by its ID.
452-
453-
:param trace_id: The ID of the trace to get the span from.
454-
:param span_id: The ID of the span to get.
455-
:returns: A Span.
456-
"""
457-
...
458-
459-
async def get_span_tree(
460-
self,
461-
span_id: str,
462-
attributes_to_return: list[str] | None = None,
463-
max_depth: int | None = None,
464-
) -> QuerySpanTreeResponse:
465-
"""Get a span tree by its ID.
466-
467-
:param span_id: The ID of the span to get the tree from.
468-
:param attributes_to_return: The attributes to return in the tree.
469-
:param max_depth: The maximum depth of the tree.
470-
:returns: A QuerySpanTreeResponse.
471-
"""
472-
...
473-
474-
async def query_spans(
475-
self,
476-
attribute_filters: list[QueryCondition],
477-
attributes_to_return: list[str],
478-
max_depth: int | None = None,
479-
) -> QuerySpansResponse:
480-
"""Query spans.
481-
482-
:param attribute_filters: The attribute filters to apply to the spans.
483-
:param attributes_to_return: The attributes to return in the spans.
484-
:param max_depth: The maximum depth of the tree.
485-
:returns: A QuerySpansResponse.
486-
"""
487-
...
488-
489-
async def save_spans_to_dataset(
490-
self,
491-
attribute_filters: list[QueryCondition],
492-
attributes_to_save: list[str],
493-
dataset_id: str,
494-
max_depth: int | None = None,
495-
) -> None:
496-
"""Save spans to a dataset.
497-
498-
:param attribute_filters: The attribute filters to apply to the spans.
499-
:param attributes_to_save: The attributes to save to the dataset.
500-
:param dataset_id: The ID of the dataset to save the spans to.
501-
:param max_depth: The maximum depth of the tree.
502-
"""
503-
...
504-
505-
async def query_metrics(
506-
self,
507-
metric_name: str,
508-
start_time: int,
509-
end_time: int | None = None,
510-
granularity: str | None = None,
511-
query_type: MetricQueryType = MetricQueryType.RANGE,
512-
label_matchers: list[MetricLabelMatcher] | None = None,
513-
) -> QueryMetricsResponse:
514-
"""Query metrics.
515-
516-
:param metric_name: The name of the metric to query.
517-
:param start_time: The start time of the metric to query.
518-
:param end_time: The end time of the metric to query.
519-
:param granularity: The granularity of the metric to query.
520-
:param query_type: The type of query to perform.
521-
:param label_matchers: The label matchers to apply to the metric.
522-
:returns: A QueryMetricsResponse.
523-
"""
524-
...

llama_stack/core/library_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,9 @@ def __init__(
207207
super().__init__()
208208
# when using the library client, we should not log to console since many
209209
# of our logs are intended for server-side usage
210-
current_sinks = os.environ.get("TELEMETRY_SINKS", "sqlite").split(",")
211-
os.environ["TELEMETRY_SINKS"] = ",".join(sink for sink in current_sinks if sink != "console")
210+
if sinks_from_env := os.environ.get("TELEMETRY_SINKS", None):
211+
current_sinks = sinks_from_env.strip().lower().split(",")
212+
os.environ["TELEMETRY_SINKS"] = ",".join(sink for sink in current_sinks if sink != "console")
212213

213214
if in_notebook():
214215
import nest_asyncio

llama_stack/distributions/ci-tests/run.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ providers:
159159
provider_type: inline::meta-reference
160160
config:
161161
service_name: "${env.OTEL_SERVICE_NAME:=\u200B}"
162-
sinks: ${env.TELEMETRY_SINKS:=sqlite}
163-
sqlite_db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/trace_store.db
162+
sinks: ${env.TELEMETRY_SINKS:=}
164163
otel_exporter_otlp_endpoint: ${env.OTEL_EXPORTER_OTLP_ENDPOINT:=}
165164
post_training:
166165
- provider_id: torchtune-cpu

llama_stack/distributions/dell/run-with-safety.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ providers:
5050
provider_type: inline::meta-reference
5151
config:
5252
service_name: "${env.OTEL_SERVICE_NAME:=\u200B}"
53-
sinks: ${env.TELEMETRY_SINKS:=sqlite}
54-
sqlite_db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/trace_store.db
53+
sinks: ${env.TELEMETRY_SINKS:=}
5554
otel_exporter_otlp_endpoint: ${env.OTEL_EXPORTER_OTLP_ENDPOINT:=}
5655
eval:
5756
- provider_id: meta-reference

llama_stack/distributions/dell/run.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ providers:
4646
provider_type: inline::meta-reference
4747
config:
4848
service_name: "${env.OTEL_SERVICE_NAME:=\u200B}"
49-
sinks: ${env.TELEMETRY_SINKS:=sqlite}
50-
sqlite_db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/trace_store.db
49+
sinks: ${env.TELEMETRY_SINKS:=}
5150
otel_exporter_otlp_endpoint: ${env.OTEL_EXPORTER_OTLP_ENDPOINT:=}
5251
eval:
5352
- provider_id: meta-reference

llama_stack/distributions/meta-reference-gpu/run-with-safety.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ providers:
6161
provider_type: inline::meta-reference
6262
config:
6363
service_name: "${env.OTEL_SERVICE_NAME:=\u200B}"
64-
sinks: ${env.TELEMETRY_SINKS:=sqlite}
65-
sqlite_db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/trace_store.db
64+
sinks: ${env.TELEMETRY_SINKS:=}
6665
otel_exporter_otlp_endpoint: ${env.OTEL_EXPORTER_OTLP_ENDPOINT:=}
6766
eval:
6867
- provider_id: meta-reference

llama_stack/distributions/meta-reference-gpu/run.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ providers:
5151
provider_type: inline::meta-reference
5252
config:
5353
service_name: "${env.OTEL_SERVICE_NAME:=\u200B}"
54-
sinks: ${env.TELEMETRY_SINKS:=sqlite}
55-
sqlite_db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/trace_store.db
54+
sinks: ${env.TELEMETRY_SINKS:=}
5655
otel_exporter_otlp_endpoint: ${env.OTEL_EXPORTER_OTLP_ENDPOINT:=}
5756
eval:
5857
- provider_id: meta-reference

0 commit comments

Comments
 (0)