-
-
Notifications
You must be signed in to change notification settings - Fork 254
feat: migrate logging log
-> tracing
#1720
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
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # martin/src/cog/source.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs a few cleanups, but this might be ok... We should probably run some perf tests (we have that using oha in the justfile iirc) - to see if there are any significant slowdowns due to the switch
Okay.. So I got performance up there again. Was a good call to do benchmarks 😅 I think there are severe performance issues with my ssh-terminal and rendering special characters => I am going to discount the initial and only consider The rqs went down on some of these, but 170k -> 130k is likely not something that users will see in reality. |
This comment was marked as off-topic.
This comment was marked as off-topic.
So apparently some of our dependencys log via tracing (switch on the trace level to see it.. that is a lot). => I think performance is not a bottleneck anymore. Will investigate configurability next |
WOW! This is a very thorough job you did there! Thank you! Ideally, we should continue using the RUST_LOG env var for all the configuration, with the possible addition of CLI and Config params. If we need more values like output format (vs output filtering), that may go into separate params too. When doing performance, stdout + term + ssh is almost always a bad choice - there might be locking and syscall issues affecting it. Best to redirect it to |
#![doc = include_str!("../README.md")] | ||
|
||
#[derive(Default)] | ||
pub struct MartinObservability { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit unsure about the API/naming here..
I tried to make it less "magic", but unsure if this is the best way to handle it.
for more information, see https://pre-commit.ci
# Conflicts: # Cargo.lock # martin-observability-utils/Cargo.toml # martin-observability-utils/src/lib.rs
for more information, see https://pre-commit.ci
Resolves maplibre#1475 One possible concern is that i32 is now used as i64 with sqlx. This **might** impact `tile_xxh3_64_hash` value validity, but I don't see conclusive evidence of that. Note that the tests were incorrectly dumped as i32, thus had to be updated, but it does not seem to affect the actual storage or validation... --------- Co-authored-by: Frank Elsinga <[email protected]>
This reverts commit 462047c.
@@ -27,6 +27,10 @@ TEST_TEMP_DIR="$(dirname "$0")/mbtiles_temp_files" | |||
rm -rf "$TEST_TEMP_DIR" | |||
mkdir -p "$TEST_TEMP_DIR" | |||
|
|||
# by default, martin/.. do pretty up their output for terminals with colors | |||
# in CI, while comparing outputs, this makes testcases less readable | |||
export NO_COLOR=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This SHOULD work, but for some reason it does only locally.. no clue why..
This also just SOMETIMES does this.. so weird
Will have to look further into the code what is overriding this being active...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the logging functionality from the log crate to tracing throughout Martin’s codebase and updates the corresponding CLI help and documentation.
- Replace log imports with tracing equivalents in multiple modules
- Update CLI text and configuration documentation to reference tracing-subscriber instead of env_logger
- Add a new martin-observability-utils package for improved observability support
Reviewed Changes
Copilot reviewed 71 out of 71 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
martin/src/pg/pg_source.rs | Updated log::debug to tracing::debug |
martin/src/pg/config_table.rs | Replaced log macros with tracing macros |
martin/src/pg/config.rs | Replaced log::warn with tracing::warn |
martin/src/pg/builder.rs | Replaced log macros with tracing macros |
martin/src/mbtiles/mod.rs | Replaced log::trace with tracing::trace |
martin/src/fonts/mod.rs | Replaced log macros with tracing macros |
martin/src/file_config.rs | Replaced log macros with tracing macros |
martin/src/config.rs | Updated log::info to tracing::info |
martin/src/cog/source.rs | Reordered imports and replaced log::warn with tracing::warn |
martin/src/args/srv.rs | Updated use and derived order; added new CLI options for logging |
martin/src/args/root.rs | Updated after_help text with tracing-subscriber docs reference |
martin/src/args/pg.rs | Replaced log macros with tracing macros |
martin/src/args/environment.rs | Replaced log::warn with tracing::warn |
martin/Cargo.toml | Removed env_logger and log; added tracing dependencies |
martin-observability-utils/src/lib.rs | Introduced tracing-based observability utilities |
martin-observability-utils/README.md | Added initial README for logging utilities |
martin-observability-utils/Cargo.toml | Added package manifest for the observability utilities package |
docs/src/env-vars.md | Updated logging env var details to reference tracing-subscriber docs |
docs/src/config-file.md | Updated configuration examples to use tracing-based logging |
Cargo.toml | Updated workspace members and dependencies to include tracing-based crates |
Comments suppressed due to low confidence (1)
martin-observability-utils/src/lib.rs:51
- Consider clarifying this error message to more explicitly state that setting the global subscriber failed because a subscriber has already been set. For example, use: "Failed to set global subscriber: global subscriber already set."
.expect("since martin has not set the global_default, no global default is set");
Lets split this up into two PRs
Alternatively, we can keep this PR open and I am going to get back to this sometime on the weekend
Resolves #836
RUST_LOG
MARTIN_LOG_FORMAT
,MARTIN_LOG_LEVEL
, ...