Files
dify/api/extensions
GareArc 6cc38c61cc feat(enterprise): Add OTEL exporter and trace handler with enum-based telemetry
Implement core enterprise OpenTelemetry infrastructure with type-safe enums
for all telemetry primitives (spans, counters, histograms).

Architecture:
- EnterpriseExporter: Own TracerProvider + shared global MeterProvider
- EnterpriseDataTrace: Duck-typed trace handler (not BaseTraceInstance subclass)
- Flask extension: Lifecycle management and singleton exporter access
- Enums: Single source of truth for span names and metric names

Key features:
- Type-safe telemetry with IDE autocomplete and compile-time checking
- Configurable trace sampling (default 100%)
- 100% accurate metrics (always collected, no sampling)
- Privacy controls via ENTERPRISE_INCLUDE_CONTENT flag
- Zero overhead when disabled (enterprise flag gates)

Components:
- enterprise/telemetry/entities: Span/Counter/Histogram enums
- enterprise/telemetry/exporter.py: OTEL exporter setup
- enterprise/telemetry/enterprise_trace.py: Trace handler using enums
- extensions/ext_enterprise_telemetry.py: Flask extension
- app_factory.py: Register extension in init list
2026-01-29 17:07:31 -08:00
..
2025-10-21 11:26:58 +08:00
2025-10-21 11:26:58 +08:00
2025-10-21 11:26:58 +08:00
2025-10-21 11:26:58 +08:00