Support server monitoring with OpenTelemetry #4034
Merged
Merged
Conversation
This was referenced Jul 17, 2026
jvstme
reviewed
Jul 20, 2026
| 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 |
Collaborator
There was a problem hiding this comment.
@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) ============
Collaborator
Author
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.