Skip to content

Support server monitoring with OpenTelemetry #4034

Merged
r4victor merged 9 commits into
masterfrom
issue_4029_otel
Jul 16, 2026
Merged

Support server monitoring with OpenTelemetry #4034
r4victor merged 9 commits into
masterfrom
issue_4029_otel

Conversation

@r4victor

Copy link
Copy Markdown
Collaborator

Closes #4029

The PR integrates dstack server with OpenTelemetry SDK for exporting server traces, logs, and metrics. This can be used for monitoring dstack server via a LGTM (Grafana) observability stack or any other solution supporting OLTP. See the new Observability section in Server deployment guide for more details.

@r4victor
r4victor merged commit 5b12312 into master Jul 16, 2026
24 checks passed
@r4victor
r4victor deleted the issue_4029_otel branch July 16, 2026 11:10
from opentelemetry.instrumentation.requests import RequestsInstrumentor
from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor
from opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@r4victor, should we do anything about these warnings from pytest? And is the import from a private module expected?

=============================== warnings summary ===============================
src/tests/_internal/server/utils/test_tracing.py::TestBuildLogHandler::test_exports_records_with_trace_context
src/tests/_internal/server/utils/test_tracing.py::TestBuildLogHandler::test_does_not_export_otel_sdk_records
  /home/runner/work/dstack/dstack/.venv/lib/python3.13/site-packages/opentelemetry/sdk/_logs/_internal/__init__.py:548: DeprecationWarning: `LoggingHandler` in `opentelemetry-sdk` is deprecated. Use the handler from `opentelemetry-instrumentation-logging` instead.
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========== 4132 passed, 2 skipped, 2 warnings in 288.60s (0:04:48) ============

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the warning: #4050

The private module means unstable in OTel. That's the documented sdk: https://github.com/open-telemetry/opentelemetry-python/blob/stable/docs/examples/logs/example.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support vendor-agnostic server observability

2 participants