From 0827d5233ddfe2d669846937b7521c2c516960c8 Mon Sep 17 00:00:00 2001 From: Dmitry Meyer Date: Wed, 29 Oct 2025 13:40:35 +0000 Subject: [PATCH] [shim] Log OK API calls with trace level Reduces log noise when DSTACK_SHIM_LOG_LEVEL is set to 5 or lower --- runner/internal/api/common.go | 8 ++++---- src/dstack/_internal/core/backends/base/compute.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/runner/internal/api/common.go b/runner/internal/api/common.go index ae15369d73..2f2f12d04c 100644 --- a/runner/internal/api/common.go +++ b/runner/internal/api/common.go @@ -113,11 +113,13 @@ func JSONResponseHandler(handler func(http.ResponseWriter, *http.Request) (inter if errors.As(err, &apiErr) { status = apiErr.Status errMsg = apiErr.Error() - log.Warning(r.Context(), "API error", "err", errMsg, "status", status) + log.Warning(r.Context(), "API error", "err", errMsg, "method", r.Method, "endpoint", r.URL.Path, "status", status) } else { status = http.StatusInternalServerError - log.Error(r.Context(), "Unexpected API error", "err", err, "status", status) + log.Error(r.Context(), "Unexpected API error", "err", err, "method", r.Method, "endpoint", r.URL.Path, "status", status) } + } else { + log.Trace(r.Context(), "", "method", r.Method, "endpoint", r.URL.Path, "status", status) } if status != 500 && body != nil { @@ -127,7 +129,5 @@ func JSONResponseHandler(handler func(http.ResponseWriter, *http.Request) (inter } else { http.Error(w, errMsg, status) } - - log.Debug(r.Context(), "", "method", r.Method, "endpoint", r.URL.Path, "status", status) } } diff --git a/src/dstack/_internal/core/backends/base/compute.py b/src/dstack/_internal/core/backends/base/compute.py index 7f70cddd5e..9598a52b0a 100644 --- a/src/dstack/_internal/core/backends/base/compute.py +++ b/src/dstack/_internal/core/backends/base/compute.py @@ -699,7 +699,7 @@ def get_shim_env( backend_shim_env: Optional[Dict[str, str]] = None, arch: Optional[str] = None, ) -> Dict[str, str]: - log_level = "6" # Trace + log_level = "5" # Debug envs = { "DSTACK_SHIM_HOME": get_dstack_working_dir(base_path), "DSTACK_SHIM_HTTP_PORT": str(DSTACK_SHIM_HTTP_PORT),