Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log worker name in steno logger #4170

Merged
merged 1 commit into from
Jan 21, 2025
Merged

Log worker name in steno logger #4170

merged 1 commit into from
Jan 21, 2025

Conversation

johha
Copy link
Contributor

@johha johha commented Jan 14, 2025

Logging the worker name will make it easier to analyse the logs of particular worker process/thread.
The worker name will be added as an additional key in the data field where e.g. the request_id is already logged.
Example:

{"timestamp":"2025-01-14T09:51:48.249447000Z","message":"(0.001651s) (app/actions/organization_delete.rb:33:in `block (2 levels) in delete') (query_length=43) DELETE FROM \"organizations\" WHERE \"id\" = 32","log_level":"debug","source":"cc.background","data":{"worker_name":"cc_global_worker_generic thread:7","request_guid":"0728f0f0-7f96-420c-ab2d-1a3768bb7047"},"thread_id":39340,"fiber_id":39360,"process_id":68504,"file":"/Users/bommel/.rbenv/versions/3.2.6/lib/ruby/gems/3.2.0/gems/sequel-5.88.0/lib/sequel/database/logging.rb","lineno":88,"method":"public_send"}

Thanks for contributing to cloud_controller_ng. To speed up the process of reviewing your pull request please provide us with:

  • A short explanation of the proposed change:

  • An explanation of the use cases your change solves

  • Links to any other associated PRs

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

Logging the worker name will make it easier to analyse the logs of
particular worker process/thread.
The worker name will be added as an additional key in the data field
where e.g. the request_id is already logged.
Example:
```
{"timestamp":"2025-01-14T09:51:48.249447000Z","message":"(0.001651s) (app/actions/organization_delete.rb:33:in `block (2 levels) in delete') (query_length=43) DELETE FROM \"organizations\" WHERE \"id\" = 32","log_level":"debug","source":"cc.background","data":{"worker_name":"cc_global_worker_generic thread:7","request_guid":"0728f0f0-7f96-420c-ab2d-1a3768bb7047"},"thread_id":39340,"fiber_id":39360,"process_id":68504,"file":"/Users/bommel/.rbenv/versions/3.2.6/lib/ruby/gems/3.2.0/gems/sequel-5.88.0/lib/sequel/database/logging.rb","lineno":88,"method":"public_send"}
```
@johha johha merged commit 4d63ed2 into main Jan 21, 2025
8 checks passed
@johha johha deleted the worker-name-logging branch January 21, 2025 07:49
ari-wg-gitbot added a commit to cloudfoundry/capi-release that referenced this pull request Jan 21, 2025
Changes in cloud_controller_ng:

- Log worker name in steno logger
    PR: cloudfoundry/cloud_controller_ng#4170
    Author: Johannes Haass <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants