Skip to content

[ISSUE #8086]♻️Mark common logging helpers as compatibility-only#8087

Merged
mxsm merged 1 commit into
mainfrom
mxsm/common-log-compatibility-deprecation
Jul 6, 2026
Merged

[ISSUE #8086]♻️Mark common logging helpers as compatibility-only#8087
mxsm merged 1 commit into
mainfrom
mxsm/common-log-compatibility-deprecation

Conversation

@mxsm

@mxsm mxsm commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Which Issue(s) This PR Fixes(Closes)

Brief Description

This PR marks the legacy rocketmq-common::log initialization helpers as compatibility-only APIs.

Changes include:

  • Deprecate init_logger, init_logger_with_level, and init_logger_with_file with guidance to use rocketmq_observability::logging::install_global and TelemetryBootstrapConfig.
  • Document the legacy static file logger guard as compatibility-only so new runtime lifecycle work remains in rocketmq-observability.
  • Keep root workspace and standalone examples clippy-clean by explicitly allowing deprecated use where they still call the legacy helper.
  • Avoid adding a rocketmq-common -> rocketmq-observability dependency or new OpenTelemetry runtime behavior to rocketmq-common.

How Did You Test This Change?

  • From the repository root, cargo fmt --all passed.
  • From the repository root, cargo test -p rocketmq-common log passed.
  • From the repository root, cargo clippy -p rocketmq-client-rust --examples --all-features -- -D warnings passed.
  • From the repository root, cargo clippy --workspace --no-deps --all-targets --all-features -- -D warnings passed.
  • From rocketmq-example/, cargo fmt --all passed.
  • From rocketmq-example/, cargo clippy --all-targets -- -D warnings passed.

Summary by CodeRabbit

  • Bug Fixes

    • Suppressed deprecation warnings across many example entry points, resulting in cleaner builds and less console noise.
    • Updated logging guidance to steer users toward the newer global logging setup, with legacy logger helpers now clearly marked as deprecated.
  • Documentation

    • Clarified that the older log guard is kept for compatibility only and that new applications should use the recommended logging initialization path.

@mxsm mxsm merged commit e51705b into main Jul 6, 2026
8 of 10 checks passed
@mxsm mxsm deleted the mxsm/common-log-compatibility-deprecation branch July 6, 2026 17:07
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8f3c5650-89e2-4a9a-ad2a-1b30cad07b66

📥 Commits

Reviewing files that changed from the base of the PR and between af20cd6 and 33452e8.

📒 Files selected for processing (34)
  • rocketmq-client/examples/batch/callback_batch_producer.rs
  • rocketmq-client/examples/batch/simple_batch_producer.rs
  • rocketmq-client/examples/broadcast/push_consumer.rs
  • rocketmq-client/examples/consumer/pop_consumer.rs
  • rocketmq-client/examples/ordermessage/ordermessage_consumer.rs
  • rocketmq-client/examples/ordermessage/ordermessage_producer.rs
  • rocketmq-client/examples/producer/simple_producer.rs
  • rocketmq-client/examples/quickstart/consumer.rs
  • rocketmq-client/examples/quickstart/producer.rs
  • rocketmq-client/examples/rpc/request_callback_producer.rs
  • rocketmq-client/examples/rpc/request_producer.rs
  • rocketmq-client/examples/transaction/transaction_producer.rs
  • rocketmq-common/src/log.rs
  • rocketmq-example/examples/consumer/broadcast_consumer.rs
  • rocketmq-example/examples/consumer/consumer_cluster.rs
  • rocketmq-example/examples/consumer/lite_pull_consumer.rs
  • rocketmq-example/examples/consumer/orderly_consumer.rs
  • rocketmq-example/examples/consumer/pop_consumer.rs
  • rocketmq-example/examples/consumer/request_reply_responder.rs
  • rocketmq-example/examples/consumer/sql_filter_consumer.rs
  • rocketmq-example/examples/consumer/tag_filter_consumer.rs
  • rocketmq-example/examples/interop/request_code_smoke.rs
  • rocketmq-example/examples/producer/basic_send.rs
  • rocketmq-example/examples/producer/batch_send.rs
  • rocketmq-example/examples/producer/delay_send.rs
  • rocketmq-example/examples/producer/order_send.rs
  • rocketmq-example/examples/producer/producer_simple.rs
  • rocketmq-example/examples/producer/producer_with_timeout.rs
  • rocketmq-example/examples/producer/request_callback_send.rs
  • rocketmq-example/examples/producer/request_send.rs
  • rocketmq-example/examples/producer/send_to_queue.rs
  • rocketmq-example/examples/producer/send_with_selector.rs
  • rocketmq-example/examples/producer/send_with_selector_advanced.rs
  • rocketmq-example/examples/producer/transaction_send.rs

Walkthrough

Three public logger initialization functions in rocketmq-common/src/log.rs are marked deprecated in favor of rocketmq_observability::logging::install_global, and WORKER_GUARD documentation is clarified as compatibility-only. Numerous example files across rocketmq-client and rocketmq-example add #[allow(deprecated)] before #[rocketmq::main] entrypoints to suppress resulting warnings.

Changes

Legacy logging deprecation and example warning suppression

Layer / File(s) Summary
Deprecate legacy logger functions and update guard docs
rocketmq-common/src/log.rs
init_logger, init_logger_with_level, and init_logger_with_file are annotated with #[deprecated(since = "1.0.0", ...)] pointing to rocketmq_observability::logging::install_global; WORKER_GUARD docs are updated to note compatibility-only status.
Suppress deprecation warnings in client examples
rocketmq-client/examples/batch/*, .../broadcast/push_consumer.rs, .../consumer/pop_consumer.rs, .../ordermessage/*, .../producer/simple_producer.rs, .../quickstart/*, .../rpc/*, .../transaction/transaction_producer.rs
Each file adds #[allow(deprecated)] immediately before its #[rocketmq::main] entrypoint to silence warnings triggered by legacy logger usage.
Suppress deprecation warnings in example crate examples
rocketmq-example/examples/consumer/*, .../interop/request_code_smoke.rs, .../producer/*
Each file adds #[allow(deprecated)] immediately before its #[rocketmq::main] entrypoint for the same reason.

Estimated code review effort: 1 (Trivial) | ~10 minutes

Possibly related PRs

  • mxsm/rocketmq-rust#1018: Introduced the broadcast consumer example whose main entrypoint now receives the #[allow(deprecated)] attribute.
  • mxsm/rocketmq-rust#1034: Added the ordermessage consumer example whose entrypoint is similarly annotated.
  • mxsm/rocketmq-rust#7445: Added several example sources whose main entrypoints now receive matching #[allow(deprecated)] annotations.

Suggested labels: refactor♻️, approved, auto merge, AI review first

Suggested reviewers: SpaceXCN, TeslaRustor

Poem

A rabbit hops through logger code,
Marking old paths with a deprecated node.
Examples wear their allow cloak so neat,
While install_global takes the compat seat.
Hop hop, warnings hushed, the build stays clean and sweet! 🐇✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mxsm/common-log-compatibility-deprecation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rocketmq-rust-robot rocketmq-rust-robot added the refactor♻️ refactor code label Jul 6, 2026
@rocketmq-rust-bot

Copy link
Copy Markdown
Collaborator

🔊@mxsm 🚀Thanks for your contribution🎉!

💡CodeRabbit(AI) will review your code first🔥!

Note

🚨The code review suggestions from CodeRabbit are to be used as a reference only, and the PR submitter can decide whether to make changes based on their own judgment. Ultimately, the project management personnel will conduct the final code review💥.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI review first Ai review pr first approved PR has approved auto merge refactor♻️ refactor code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor♻️] Mark common logging helpers as compatibility-only

3 participants