Skip to content

Commit

Permalink
Fixed new issues
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Tisnovsky <[email protected]>
  • Loading branch information
tisnik committed Dec 18, 2024
1 parent 097b336 commit 791f59c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions ols/utils/pyroscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def start_with_pyroscope_enabled(
response = requests.get(config.dev_config.pyroscope_url, timeout=60)
if response.status_code == requests.codes.ok:
logger.info(
f"Pyroscope server is reachable at {config.dev_config.pyroscope_url}"
"Pyroscope server is reachable at %s", config.dev_config.pyroscope_url
)
import pyroscope

Expand All @@ -39,7 +39,8 @@ def start_with_pyroscope_enabled(
start_uvicorn(config)
else:
logger.info(
f"Failed to reach Pyroscope server. Status code: {response.status_code}"
"Failed to reach Pyroscope server. Status code: %d",
response.status_code,
)
except requests.exceptions.RequestException as e:
logger.info(f"Error connecting to Pyroscope server: {e}")
logger.info("Error connecting to Pyroscope server: %s", str(e))
6 changes: 3 additions & 3 deletions tests/unit/utils/test_pyroscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_pyroscope_server_reachable(mock_config, mock_logger):
start_with_pyroscope_enabled(mock_config, mock_logger)

mock_logger.info.assert_any_call(
f"Pyroscope server is reachable at {mock_config.dev_config.pyroscope_url}"
"Pyroscope server is reachable at %s", mock_config.dev_config.pyroscope_url
)
mock_pyroscope.configure.assert_called_once()
mock_run.assert_called_once()
Expand All @@ -65,7 +65,7 @@ def test_pyroscope_server_unreachable(mock_config, mock_logger):
start_with_pyroscope_enabled(mock_config, mock_logger)

mock_logger.info.assert_any_call(
"Failed to reach Pyroscope server. Status code: 500"
"Failed to reach Pyroscope server. Status code: %d", 500
)


Expand All @@ -78,5 +78,5 @@ def test_pyroscope_connection_error(mock_config, mock_logger):
start_with_pyroscope_enabled(mock_config, mock_logger)

mock_logger.info.assert_any_call(
"Error connecting to Pyroscope server: Connection error"
"Error connecting to Pyroscope server: %s", "Connection error"
)

0 comments on commit 791f59c

Please sign in to comment.