dify/api/core/ops
GareArc adadf1ec5f
refactor(telemetry): migrate to type-safe enum-based event routing with centralized enterprise filtering
Changes:
- Change TelemetryEvent.name from str to TraceTaskName enum for type safety
- Remove hardcoded trace_task_name_map from facade (no mapping needed)
- Add centralized enterprise-only filter in TelemetryFacade.emit()
- Rename is_telemetry_enabled() to is_enterprise_telemetry_enabled()
- Update all 11 call sites to pass TraceTaskName enum values
- Remove redundant enterprise guard from draft_trace.py
- Add unit tests for TelemetryFacade.emit() routing (6 tests)
- Add unit tests for TraceQueueManager telemetry guard (5 tests)
- Fix test fixture scoping issue for full test suite compatibility
- Fix tenant_id handling in agent tool callback handler

Benefits:
- 100% type-safe: basedpyright catches errors at compile time
- No string literals: eliminates entire class of typo bugs
- Single point of control: centralized filtering in facade
- All guards removed except facade
- Zero regressions: 4887 tests passing

Verification:
- make lint: PASS
- make type-check: PASS (0 errors, 0 warnings)
- pytest: 4887 passed, 8 skipped
2026-02-05 20:15:12 -08:00
..
aliyun_trace fix: use Factory to create repository in Aliyun Trace (#30899) 2026-01-14 10:21:46 +08:00
arize_phoenix_trace fix(api): Populate Missing Attributes For Arize Phoenix Integration (#29526) 2025-12-15 11:15:18 +08:00
entities refactor(telemetry): introduce TelemetryFacade to centralize event emission 2026-02-05 20:15:11 -08:00
langfuse_trace feat(enterprise): Add OTEL telemetry with slim traces, metrics, and structured logs 2026-02-05 20:12:28 -08:00
langsmith_trace feat(enterprise): Add OTEL telemetry with slim traces, metrics, and structured logs 2026-02-05 20:12:28 -08:00
mlflow_trace feat: MLflow tracing (#26093) 2025-11-22 13:53:58 +08:00
opik_trace remove .value (#26633) 2025-10-11 09:08:29 +08:00
tencent_trace revert: "fix(ops): add streaming metrics and LLM span for agent-chat traces" (#29469) 2025-12-11 12:53:37 +08:00
weave_trace Fix duration displayed for workflow steps on Weave dashboard (#28289) 2025-11-20 11:37:01 +08:00
__init__.py feat: add ops trace (#5483) 2024-06-26 17:33:29 +08:00
base_trace_instance.py Migrate SQLAlchemy from 1.x to 2.0 with automated and manual adjustments (#23224) 2025-09-02 10:30:19 +08:00
ops_trace_manager.py refactor(telemetry): migrate to type-safe enum-based event routing with centralized enterprise filtering 2026-02-05 20:15:12 -08:00
utils.py revert: revert human input relevant code (#31766) 2026-01-30 19:18:49 +08:00