adding and passing logMarkers to (almost) all logging in media-api#4529
Merged
andrew-nowak merged 1 commit intomainfrom Sep 29, 2025
Merged
adding and passing logMarkers to (almost) all logging in media-api#4529andrew-nowak merged 1 commit intomainfrom
andrew-nowak merged 1 commit intomainfrom
Conversation
twrichards
approved these changes
Sep 25, 2025
Contributor
twrichards
left a comment
There was a problem hiding this comment.
brilliant stuff @andrew-nowak
code looks 👍
(I haven't tested on TEST, but I trust you have 🙏 )
| elasticSearch.getImageById(id) flatMap { | ||
| case Some(image) if hasPermission(request.user, image) => { | ||
| val apiKey = request.user.accessor | ||
| logger.info(s"Download optimised image: $id from user: ${Authentication.getIdentity(request.user)}", apiKey, id) |
Contributor
There was a problem hiding this comment.
🫨 - was apiKey actually getting logged??
| "user" -> r.user.accessor.identity | ||
| ) | ||
| "requestId" -> RequestLoggingFilter.getRequestId(request) | ||
| ) ++ RequestLoggingFilter.loggablePrincipal(request.user) |
|
Seen on auth, usage, image-loader, metadata-editor, thrall, leases, cropper, collections, media-api, kahuna (merged by @andrew-nowak 8 minutes and 40 seconds ago) Please check your changes! |
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.
What does this change?
One of my occasional passes through a service, setting up better log markers and passing them to all the log statements that I can find. This time focusing on media-api.
(Of passing interest here, play does have an internal request-id, but it's a monotonically increasing integer starting from 1 for each instance, which means that those request-ids will be non-unique which isn't helpful for us :( BUT we should follow playframework/playframework#10273 where these may be switched to UUIDv7 in the future!)
How should a reviewer test this change?
Deploy to TEST and perform some interactions with media-api (searches, retrieving a single image, etc.). Is there a stable request ID, allowing you to find all the log messages associated with this request?
How can success be measured?
Who should look at this?
Tested? Documented?