Skip to content

Commit af4290a

Browse files
committed
Process feedback
1 parent c6af844 commit af4290a

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/core/logging.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ async def add_request_context_to_log(
3434
) -> Response:
3535
"""Add a unique request id to each log call."""
3636
identifier = uuid.uuid4().hex
37-
with logger.contextualize(request_id=identifier):
37+
with logger.contextualize(
38+
request_id=identifier,
39+
method=request.method,
40+
path=request.url.path,
41+
):
3842
return await call_next(request)
3943

4044

@@ -61,6 +65,7 @@ async def log_request_duration(
6165
process_ms=int(duration_process_ns / 1_000_000),
6266
wallclock_time_ns=duration_mono_ns,
6367
process_time_ns=duration_process_ns,
68+
status=response.status_code,
6469
)
6570
return response
6671

src/routers/dependencies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async def fetch_user(
3939
raise AuthenticationFailedError(msg)
4040

4141
logger.info(
42-
"User {identifier} authenticated in with api key ending in '{api_key}'.",
42+
"User {identifier} authenticated with api key ending in '{api_key}'.",
4343
identifier=user.user_id,
4444
api_key=masked_key,
4545
)

src/routers/openml/study.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ async def attach_to_study(
7575
if study.creator != user.user_id and not await user.is_admin():
7676
msg = f"Study {study_id} can only be edited by its creator."
7777
logger.warning(
78-
"User attempted to attach entities to study they do not own.",
78+
"User {user_id} attempted to attach entities to study they do not own.",
7979
study_id=study_id,
8080
entity_ids=entity_ids,
81+
user_id=user.user_id,
8182
)
8283
raise StudyNotEditableError(msg)
8384
if study.status != StudyStatus.IN_PREPARATION:

0 commit comments

Comments
 (0)