mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-25 19:15:18 +02:00
feat(observability): integrate OpenTelemetry collector and configuration for enhanced telemetry
This commit is contained in:
parent
51e4d8b489
commit
df698e0216
6 changed files with 160 additions and 7 deletions
|
|
@ -71,7 +71,7 @@ def _build_resource():
|
|||
"service.name": os.environ.get("OTEL_SERVICE_NAME", "surfsense-backend"),
|
||||
"service.version": _package_version(),
|
||||
"service.instance.id": socket.gethostname(),
|
||||
"deployment.environment": _deployment_environment(),
|
||||
"deployment.environment.name": _deployment_environment(),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -336,7 +336,10 @@ def init_logs() -> None:
|
|||
def _run() -> None:
|
||||
from opentelemetry.instrumentation.logging import LoggingInstrumentor
|
||||
|
||||
LoggingInstrumentor().instrument()
|
||||
# Required for stdlib LogRecords to receive otelTraceID/otelSpanID.
|
||||
# logging.basicConfig is already installed by main.py, so this does not
|
||||
# take over formatting in normal app startup.
|
||||
LoggingInstrumentor().instrument(set_logging_format=True)
|
||||
|
||||
if _safe_instrument("logging", _run):
|
||||
_LOGS_INITIALIZED = True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue