-
Notifications
You must be signed in to change notification settings - Fork 42
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
Improve logs: add target, identify running service, identify request #600
Comments
I think proposal 2 works as well.
I don't see a reason either why someone would need multiple trackers with the same config. |
@da2ce7 suggested:
Instead of: 2024-01-12T09:14:39.458258441+00:00 [UDP Tracker][INFO] Starting on: udp://0.0.0.0:6969
2024-01-12T09:14:39.458310899+00:00 [UDP Tracker][INFO] Started on: udp://0.0.0.0:6969 We could do this: 2024-01-12T09:14:39.458258441+00:00 [UDP::0.0.0.0:6969][INFO] Starting on: udp://0.0.0.0:6969
2024-01-12T09:14:39.458310899+00:00 [UDP::0.0.0.0:6969][INFO] Started on: udp://0.0.0.0:6969
2024-02-08T13:48:26.816333312+00:00 [UDP::0.0.0.0:6969][INFO] "CONNECT REQ TxID -1874681766 RqID 43b09349-82fa-4196-9f8f-f33024d24c15
"
2024-02-08T13:48:26.818308560+00:00 [UDP::0.0.0.0:6969][INFO] "ANNOUNCE REQ TxID 896800714 IH f38a04e46bd9839be59f736742e3893e5f034fcf RqID 75fdf319-b073-4048-ae99-15bf68d610b5" Request IDs would be included in the responses. Currently, we are not logging responses. This is a proposal:
What do you think @da2ce7? |
In the end, I have used a param (
Instead of the "target". I think:
|
Implemented via:
Finally, the service identification is not done via the target but with a param (
|
Relates to: #387
When you run the tracker with
info
log level you see something like:Starting:
Finishing:
I have started replacing the context with the module namespace with a service ID.
[torrust_tracker::bootstrap::logging]
: this is what I call a namespaced context for the log.[UDP Tracker]
,[HTTP Tracker]
, [Health Check API]: those are permanent service identifiers.The main advantage is logs are not coupled with implementation details.
I've also added the URL when started services are listening on, for example:
2024-01-12T09:14:39.458310899+00:00 [UDP Tracker][INFO] Started on: udp://0.0.0.0:6969
This is also useful because allows easily identifying running services for developers or other services.
Some services like GitHub Codespaces use the log to auto-discover exposed ports and to automatically port forwarding.
There are still some logs that use the namespaced context like:
It would be convenient to change also those records.
There is also another extra critical improvement. The tracker can run multiple HTTP trackers and multiple UDP trackers. It's very important to identify which one the log line refers to. In some lines, I've added the socket address which, I think, is the best identifier for the service. Since all services are exposed via a socket. For example:
2024-01-12T09:14:39.458258441+00:00 [UDP Tracker][INFO] Starting on: udp://0.0.0.0:6969
However, not all lines identify the service the logs belong to. For example:
2024-01-12T09:14:39.458331488+00:00 [torrust_tracker::bootstrap::jobs][INFO] TLS not enabled
In this case, we don't know which service has not enabled TLS: the API, one of the HTTP trackers?
We should add, for example, the bind_address somewhere to the log line.
Proposals
Proposal 1
It could be the target:
Proposal 2
It could be in the main body like this:
Conclusion
I think I would use the proposal 2. I think the target should be used for things at compilation time and the body for things at runtime. But it's only my first impression.
Maybe we could use an enum for the body to force a certain format.
This could not be a priority since I don't think many people will run multiple trackers at the same time. In fact, I do not know if that's even a useful feature. Why would someone want to run multiple trackers with the same configuration and different ports @WarmBeer?
Tasks
info
log level.The text was updated successfully, but these errors were encountered: