mirror of
https://github.com/langgenius/dify.git
synced 2026-02-10 04:54:30 +08:00
Migrate from direct TraceQueueManager.add_trace_task calls to TelemetryFacade.emit with TelemetryEvent abstraction. This reduces CE code invasion by consolidating telemetry logic in core/telemetry/ with a single guard in ops_trace_manager.py.
19 lines
357 B
Python
19 lines
357 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Any
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class TelemetryContext:
|
|
tenant_id: str | None = None
|
|
user_id: str | None = None
|
|
app_id: str | None = None
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class TelemetryEvent:
|
|
name: str
|
|
context: TelemetryContext
|
|
payload: dict[str, Any]
|