Skip to content

POC: Add request path to the current request Context

Matthias Käppler requested to merge mk-wh-request-path-context into master

What does this MR do and why?

This is a proof of concept for how we can include the current request path in every log line we emit from Workhorse.

We currently log in various places in Workhorse; while we always have a correlation ID, this does not allow us to answer global questions such as:

"Which paths resulted in log lines with field f"

In Kibana, that would require us to join log events so we can correlate paths with e.g. upload client modes. By simply logging the path everywhere, we do not need to join events to begin with.

This is just a POC. It should probably live in labkit instead, since a remaining issue is that log.WithContextFields only adds a hard-coded list of context fields. We would need to add path to that list.

Screenshots or screen recordings

Logs from object storage uploads now include the path:

workhorse_1         | time="2022-03-23T10:05:51Z" level=info msg="saved file" client_mode=multipart copied_bytes=3480 correlation_id=01FYV3TSRJ9RJP9CNF6Z7GJ3N8 is_local=false is_multipart=true is_remote=true path=/flightjs/Flight/uploads remote_id=1648029951-79-0003-0126-215f41df87ad07bcd06dc4462a60d072 remote_temp_object=tmp/uploads/1648029951-79-0003-0126-215f41df87ad07bcd06dc4462a60d072 temp_file_prefix=format.js

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Matthias Käppler

Merge request reports