-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
feat: migrate logging log
-> tracing
#1720
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
log
-> tracing
log
-> tracing
serde::Serialize, | ||
serde::Deserialize, | ||
)] | ||
pub enum LogFormatOptions { |
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.
@nyurik how would you want me to split this up? |
During #1720 I noticed that there are a few places in the CLI where a few more line breaks and handling markdown better could help readability. Yes, this adds the `unstable-markdown` feature of clap, but given that removal would only impact the CLI-Formatting, I think here the risk is okay. Tracking issue: - clap-rs/clap#5900 Hidden rationale: I have one place in #1720 where making it readable without markdown formatting is nearly impossible --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
During maplibre#1720 I noticed that there are a few places in the CLI where a few more line breaks and handling markdown better could help readability. Yes, this adds the `unstable-markdown` feature of clap, but given that removal would only impact the CLI-Formatting, I think here the risk is okay. Tracking issue: - clap-rs/clap#5900 Hidden rationale: I have one place in maplibre#1720 where making it readable without markdown formatting is nearly impossible --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…re#1727) Bumps [axios](https://github.com/axios/axios) from 1.7.7 to 1.8.2. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/axios/axios/releases">axios's releases</a>.</em></p> <blockquote> <h2>Release v1.8.2</h2> <h2>Release notes:</h2> <h3>Bug Fixes</h3> <ul> <li><strong>http-adapter:</strong> add allowAbsoluteUrls to path building (<a href="https://redirect.github.com/axios/axios/issues/6810">#6810</a>) (<a href="https://github.com/axios/axios/commit/fb8eec214ce7744b5ca787f2c3b8339b2f54b00f">fb8eec2</a>)</li> </ul> <h3>Contributors to this release</h3> <ul> <li><!-- raw HTML omitted --> <a href="https://github.com/lexcorp16" title="+1/-1 ([#6810](axios/axios#6810) )">Fasoro-Joseph Alexander</a></li> </ul> <h2>Release v1.8.1</h2> <h2>Release notes:</h2> <h3>Bug Fixes</h3> <ul> <li><strong>utils:</strong> move <code>generateString</code> to platform utils to avoid importing crypto module into client builds; (<a href="https://redirect.github.com/axios/axios/issues/6789">#6789</a>) (<a href="https://github.com/axios/axios/commit/36a5a620bec0b181451927f13ac85b9888b86cec">36a5a62</a>)</li> </ul> <h3>Contributors to this release</h3> <ul> <li><!-- raw HTML omitted --> <a href="https://github.com/DigitalBrainJS" title="+51/-47 ([#6789](axios/axios#6789) )">Dmitriy Mozgovoy</a></li> </ul> <h2>Release v1.8.0</h2> <h2>Release notes:</h2> <h3>Bug Fixes</h3> <ul> <li><strong>examples:</strong> application crashed when navigating examples in browser (<a href="https://redirect.github.com/axios/axios/issues/5938">#5938</a>) (<a href="https://github.com/axios/axios/commit/1260ded634ec101dd5ed05d3b70f8e8f899dba6c">1260ded</a>)</li> <li>missing word in SUPPORT_QUESTION.yml (<a href="https://redirect.github.com/axios/axios/issues/6757">#6757</a>) (<a href="https://github.com/axios/axios/commit/1f890b13f2c25a016f3c84ae78efb769f244133e">1f890b1</a>)</li> <li><strong>utils:</strong> replace getRandomValues with crypto module (<a href="https://redirect.github.com/axios/axios/issues/6788">#6788</a>) (<a href="https://github.com/axios/axios/commit/23a25af0688d1db2c396deb09229d2271cc24f6c">23a25af</a>)</li> </ul> <h3>Features</h3> <ul> <li>Add config for ignoring absolute URLs (<a href="https://redirect.github.com/axios/axios/issues/5902">#5902</a>) (<a href="https://redirect.github.com/axios/axios/issues/6192">#6192</a>) (<a href="https://github.com/axios/axios/commit/32c7bcc0f233285ba27dec73a4b1e81fb7a219b3">32c7bcc</a>)</li> </ul> <h3>Reverts</h3> <ul> <li>Revert "chore: expose fromDataToStream to be consumable (<a href="https://redirect.github.com/axios/axios/issues/6731">#6731</a>)" (<a href="https://redirect.github.com/axios/axios/issues/6732">#6732</a>) (<a href="https://github.com/axios/axios/commit/1317261125e9c419fe9f126867f64d28f9c1efda">1317261</a>), closes <a href="https://redirect.github.com/axios/axios/issues/6731">#6731</a> <a href="https://redirect.github.com/axios/axios/issues/6732">#6732</a></li> </ul> <h3>BREAKING CHANGES</h3> <ul> <li> <p>code relying on the above will now combine the URLs instead of prefer request URL</p> </li> <li> <p>feat: add config option for allowing absolute URLs</p> </li> <li> <p>fix: add default value for allowAbsoluteUrls in buildFullPath</p> </li> <li> <p>fix: typo in flow control when setting allowAbsoluteUrls</p> </li> </ul> <h3>Contributors to this release</h3> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/axios/axios/blob/v1.x/CHANGELOG.md">axios's changelog</a>.</em></p> <blockquote> <h2><a href="https://github.com/axios/axios/compare/v1.8.1...v1.8.2">1.8.2</a> (2025-03-07)</h2> <h3>Bug Fixes</h3> <ul> <li><strong>http-adapter:</strong> add allowAbsoluteUrls to path building (<a href="https://redirect.github.com/axios/axios/issues/6810">#6810</a>) (<a href="https://github.com/axios/axios/commit/fb8eec214ce7744b5ca787f2c3b8339b2f54b00f">fb8eec2</a>)</li> </ul> <h3>Contributors to this release</h3> <ul> <li><!-- raw HTML omitted --> <a href="https://github.com/lexcorp16" title="+1/-1 ([#6810](axios/axios#6810) )">Fasoro-Joseph Alexander</a></li> </ul> <h2><a href="https://github.com/axios/axios/compare/v1.8.0...v1.8.1">1.8.1</a> (2025-02-26)</h2> <h3>Bug Fixes</h3> <ul> <li><strong>utils:</strong> move <code>generateString</code> to platform utils to avoid importing crypto module into client builds; (<a href="https://redirect.github.com/axios/axios/issues/6789">#6789</a>) (<a href="https://github.com/axios/axios/commit/36a5a620bec0b181451927f13ac85b9888b86cec">36a5a62</a>)</li> </ul> <h3>Contributors to this release</h3> <ul> <li><!-- raw HTML omitted --> <a href="https://github.com/DigitalBrainJS" title="+51/-47 ([#6789](axios/axios#6789) )">Dmitriy Mozgovoy</a></li> </ul> <h1><a href="https://github.com/axios/axios/compare/v1.7.9...v1.8.0">1.8.0</a> (2025-02-25)</h1> <h3>Bug Fixes</h3> <ul> <li><strong>examples:</strong> application crashed when navigating examples in browser (<a href="https://redirect.github.com/axios/axios/issues/5938">#5938</a>) (<a href="https://github.com/axios/axios/commit/1260ded634ec101dd5ed05d3b70f8e8f899dba6c">1260ded</a>)</li> <li>missing word in SUPPORT_QUESTION.yml (<a href="https://redirect.github.com/axios/axios/issues/6757">#6757</a>) (<a href="https://github.com/axios/axios/commit/1f890b13f2c25a016f3c84ae78efb769f244133e">1f890b1</a>)</li> <li><strong>utils:</strong> replace getRandomValues with crypto module (<a href="https://redirect.github.com/axios/axios/issues/6788">#6788</a>) (<a href="https://github.com/axios/axios/commit/23a25af0688d1db2c396deb09229d2271cc24f6c">23a25af</a>)</li> </ul> <h3>Features</h3> <ul> <li>Add config for ignoring absolute URLs (<a href="https://redirect.github.com/axios/axios/issues/5902">#5902</a>) (<a href="https://redirect.github.com/axios/axios/issues/6192">#6192</a>) (<a href="https://github.com/axios/axios/commit/32c7bcc0f233285ba27dec73a4b1e81fb7a219b3">32c7bcc</a>)</li> </ul> <h3>Reverts</h3> <ul> <li>Revert "chore: expose fromDataToStream to be consumable (<a href="https://redirect.github.com/axios/axios/issues/6731">#6731</a>)" (<a href="https://redirect.github.com/axios/axios/issues/6732">#6732</a>) (<a href="https://github.com/axios/axios/commit/1317261125e9c419fe9f126867f64d28f9c1efda">1317261</a>), closes <a href="https://redirect.github.com/axios/axios/issues/6731">#6731</a> <a href="https://redirect.github.com/axios/axios/issues/6732">#6732</a></li> </ul> <h3>BREAKING CHANGES</h3> <ul> <li> <p>code relying on the above will now combine the URLs instead of prefer request URL</p> </li> <li> <p>feat: add config option for allowing absolute URLs</p> </li> <li> <p>fix: add default value for allowAbsoluteUrls in buildFullPath</p> </li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/axios/axios/commit/a9f7689b0c4b6d68c7f587c3aa376860da509d94"><code>a9f7689</code></a> chore(release): v1.8.2 (<a href="https://redirect.github.com/axios/axios/issues/6812">#6812</a>)</li> <li><a href="https://github.com/axios/axios/commit/fb8eec214ce7744b5ca787f2c3b8339b2f54b00f"><code>fb8eec2</code></a> fix(http-adapter): add allowAbsoluteUrls to path building (<a href="https://redirect.github.com/axios/axios/issues/6810">#6810</a>)</li> <li><a href="https://github.com/axios/axios/commit/98120457559e573024862e2925d56295a965ad7e"><code>9812045</code></a> chore(sponsor): update sponsor block (<a href="https://redirect.github.com/axios/axios/issues/6804">#6804</a>)</li> <li><a href="https://github.com/axios/axios/commit/72acf759373ef4e211d5299818d19e50e08c02f8"><code>72acf75</code></a> chore(sponsor): update sponsor block (<a href="https://redirect.github.com/axios/axios/issues/6794">#6794</a>)</li> <li><a href="https://github.com/axios/axios/commit/2e64afdff5c41e38284a6fb8312f2745072513a1"><code>2e64afd</code></a> chore(release): v1.8.1 (<a href="https://redirect.github.com/axios/axios/issues/6800">#6800</a>)</li> <li><a href="https://github.com/axios/axios/commit/36a5a620bec0b181451927f13ac85b9888b86cec"><code>36a5a62</code></a> fix(utils): move <code>generateString</code> to platform utils to avoid importing crypto...</li> <li><a href="https://github.com/axios/axios/commit/cceb7b1e154fbf294135c93d3f91921643bbe49f"><code>cceb7b1</code></a> chore(release): v1.8.0 (<a href="https://redirect.github.com/axios/axios/issues/6795">#6795</a>)</li> <li><a href="https://github.com/axios/axios/commit/23a25af0688d1db2c396deb09229d2271cc24f6c"><code>23a25af</code></a> fix(utils): replace getRandomValues with crypto module (<a href="https://redirect.github.com/axios/axios/issues/6788">#6788</a>)</li> <li><a href="https://github.com/axios/axios/commit/32c7bcc0f233285ba27dec73a4b1e81fb7a219b3"><code>32c7bcc</code></a> feat: Add config for ignoring absolute URLs (<a href="https://redirect.github.com/axios/axios/issues/5902">#5902</a>) (<a href="https://redirect.github.com/axios/axios/issues/6192">#6192</a>)</li> <li><a href="https://github.com/axios/axios/commit/4a3e26cf65bb040b7eb4577d5fd62199b0f3d017"><code>4a3e26c</code></a> chore(config): adjust rollup config to preserve license header to minified Ja...</li> <li>Additional commits viewable in <a href="https://github.com/axios/axios/compare/v1.7.7...v1.8.2">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/maplibre/martin/network/alerts). </details> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
During #1720 I noticed that these fields are missing This PR adds them for completeness ^^
Good question, I wish i knew the best way to proceed. Thinking out loud:
What do you think? |
I think there is some misunderstanding. There is no TUI involved and adding that would involve quite a bit more code than I think we should add for now (bigger issues and stuff ^^). About naming: Thinking about it: |
Above I was talking about making this PR reviewable by splitting it up into smaller PRs. I will split this up into:
Alternative would be
|
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
, ...