Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions maestro_worker_python/request_logging.py

This file was deleted.

2 changes: 0 additions & 2 deletions maestro_worker_python/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from .health import get_health_metadata
from .kill_process import kill_child_processes, terminate_current_process
from .load_worker import load_worker
from .request_logging import register_client_safe_request_extractor
from .response import FatalWorkerError, ValidationError, WorkerResponse


Expand Down Expand Up @@ -88,7 +87,6 @@ async def lifespan(_app: FastAPI) -> AsyncIterator[None]:
logging.basicConfig(level=settings.log_level.upper())

if settings.enable_json_logging:
register_client_safe_request_extractor()
# json_logging pins its own logger to DEBUG at import, and init logs at DEBUG before
# the root handler is JSON, leaking a plain-text line that Cloud Logging files as ERROR.
logging.getLogger("json_logging").setLevel(logging.INFO)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT"
authors = [{ name = "Moises.ai" }]
dependencies = [
"fastapi>=0.139.2,<0.140",
"json-logging>=1.3,<2",
"json-logging>=1.6,<2",
"nvidia-ml-py>=12.535,<14",
"psutil>=6.0.0,<7.1",
"pydantic>=2.9,<3",
Expand Down
87 changes: 0 additions & 87 deletions tests/test_request_logging.py

This file was deleted.

31 changes: 31 additions & 0 deletions tests/test_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,34 @@ def test_json_logging_keeps_reporting_its_own_warnings(tmp_path):
assert result.returncode == 0, result.stderr
records = [json.loads(line) for line in _log_lines(result) if line.startswith("{")]
assert any(r["msg"] == "probe" and r["level"] == "WARNING" for r in records), records


SERVE_A_REQUEST_WITHOUT_A_PEER = """
import asyncio, sys

scope = {
"type": "http", "asgi": {"version": "3.0"}, "http_version": "1.1", "scheme": "http",
"method": "GET", "path": "/health", "raw_path": b"/health", "query_string": b"",
"root_path": "", "headers": [], "client": None, "server": ("testserver", 80),
}

async def receive():
return {"type": "http.request", "body": b"", "more_body": False}

messages = []

async def send(message):
messages.append(message)

asyncio.run(serve.app(scope, receive, send))
print([m["status"] for m in messages if m["type"] == "http.response.start"], file=sys.stderr)
"""


def test_json_logging_serves_a_request_without_a_peer_cleanly(tmp_path):
# A kubelet resetting a timed-out readiness probe leaves Request.client as None.
result = _start_with_json_logging(tmp_path, SERVE_A_REQUEST_WITHOUT_A_PEER)

assert result.returncode == 0, result.stderr
assert "[200]" in result.stderr
assert "Logging error" not in result.stderr, result.stderr
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading