Skip to content

Commit 2d0af79

Browse files
authored
docs(tracing): add OpenTelemetry span format guide (#1350)
Add documentation describing the new OpenTelemetry-based span format for tracing, including configuration, key differences from the legacy format, migration steps, and important considerations around privacy and performance. Also add a test script to verify Jaeger integration with NeMo-Guardrails using OpenTelemetry, demonstrating trace export and event-span correlation.
1 parent 78b2982 commit 2d0af79

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

docs/user-guides/tracing/index.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,69 @@ With tracing, you can:
1111
- Debug flow execution and identify bottlenecks.
1212
- Analyze conversation patterns and errors.
1313

14+
## Span Formats
15+
16+
Starting with NeMo Guardrails v0.16.0, the tracing system has transitioned to OpenTelemetry semantic conventions for Generative AI (GenAI), moving away from the legacy span format. This change enhances observability standardization and improves monitoring capabilities for AI workloads.
17+
18+
**Reference Documentation:**
19+
20+
- [OpenTelemetry Semantic Conventions for GenAI](https://opentelemetry.io/docs/specs/semconv/gen-ai/) - Overview of GenAI semantic conventions
21+
- [GenAI Events Specification](https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-events/) - Details on capturing user inputs and model outputs
22+
- [GenAI Spans Specification](https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/) - Span naming and attribute conventions
23+
24+
### Supported Formats
25+
26+
NeMo Guardrails support the following formats.
27+
28+
- **OpenTelemetry** (`opentelemetry`) - **Recommended default format** following OpenTelemetry semantic conventions for GenAI
29+
- **Legacy** (`legacy`) - Previous format with simple metrics dictionary (deprecated)
30+
31+
### Configuration
32+
33+
You can control the span format through the tracing configuration:
34+
35+
```yaml
36+
tracing:
37+
enabled: true
38+
span_format: "opentelemetry" # default
39+
enable_content_capture: false # default, see privacy considerations below
40+
```
41+
42+
### Key Differences
43+
44+
The following are the key differences between the supported span formats.
45+
46+
**OpenTelemetry Format:**
47+
48+
- Follows the standardized [semantic conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/)
49+
- Rich-structured attributes and events (e.g., `gen_ai.request.model`, `gen_ai.usage.input_tokens`)
50+
- Enhanced LLM call tracking with provider and model information
51+
- Support for span events and error tracking
52+
- Compatible with OpenTelemetry ecosystem tools
53+
54+
**Legacy Format:**
55+
56+
- Simple metrics dictionary
57+
- Minimal overhead with limited observability
58+
- **Deprecated** - maintained for backward compatibility only
59+
60+
### Important Considerations
61+
62+
**Development Status**: The [OpenTelemetry semantic conventions for GenAI](https://opentelemetry.io/docs/specs/semconv/gen-ai/) are currently in development and may undergo changes. Consider the following risks:
63+
64+
- **Evolving Standards**: Conventions may change as they mature, potentially affecting existing implementations
65+
- **Data Privacy**: The `enable_content_capture` option captures user inputs and model outputs, which may include sensitive information (PII). Only enable when necessary and ensure compliance with data protection regulations. See [GenAI Events documentation](https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-events/) for details
66+
- **Performance Impact**: Extensive telemetry collection may impact system performance, especially with large inputs/outputs
67+
68+
### Migration Path
69+
70+
Existing configurations will continue to work. However, it is strongly recommended to migrate to the OpenTelemetry format. Migration steps are:
71+
72+
1. Update your configuration to use `span_format: "opentelemetry"`
73+
2. Review your telemetry backends for compatibility with OpenTelemetry conventions
74+
3. Test thoroughly, as span structures and attribute names have changed
75+
4. Consider privacy implications if enabling content capture
76+
1477
## Contents
1578
1679
- [](quick-start.md) - Minimal setup to enable tracing using the OpenTelemetry SDK

0 commit comments

Comments
 (0)