Skip to content

[ISSUE #8098]♻️Use telemetry bootstrap in standalone examples#8099

Merged
mxsm merged 1 commit into
mainfrom
mxsm/standalone-examples-telemetry-bootstrap
Jul 6, 2026
Merged

[ISSUE #8098]♻️Use telemetry bootstrap in standalone examples#8099
mxsm merged 1 commit into
mainfrom
mxsm/standalone-examples-telemetry-bootstrap

Conversation

@mxsm

@mxsm mxsm commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Which Issue(s) This PR Fixes(Closes)

Brief Description

This PR migrates the standalone example project away from the compatibility logger and into the unified telemetry bootstrap.

Changes include:

  • Add rocketmq-observability as a dev dependency for the standalone example project.
  • Replace rocketmq_common::log::init_logger in standalone consumer, producer, and interop examples.
  • Keep a telemetry guard alive until normal example completion.
  • Explicitly shut down the telemetry guard before returning from migrated examples.
  • Keep root documentation files untouched.

How Did You Test This Change?

  • cargo fmt --all passed from rocketmq-example.
  • cargo clippy --all-targets -- -D warnings passed from rocketmq-example.

Summary by CodeRabbit

  • New Features

    • Example producer and consumer apps now start with unified observability telemetry and cleanly shut it down on exit.
    • Added telemetry support to the example project’s development dependencies so the examples can run with observability enabled.
  • Chores

    • Removed outdated startup logging setup from the examples to align them with the new telemetry-based runtime flow.

@mxsm mxsm merged commit 598d052 into main Jul 6, 2026
4 of 7 checks passed
@mxsm mxsm deleted the mxsm/standalone-examples-telemetry-bootstrap branch July 6, 2026 17:58
@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: 52440e9a-2dc2-4a46-9131-bf3a08f50c34

📥 Commits

Reviewing files that changed from the base of the PR and between 8411393 and 8098ac7.

⛔ Files ignored due to path filters (1)
  • rocketmq-example/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (22)
  • rocketmq-example/Cargo.toml
  • 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

The rocketmq-example crate adds a dev-dependency on rocketmq-observability. Across 21 consumer, producer, and interop example binaries, logger initialization via rocketmq_common::log::init_logger is replaced with rocketmq_observability::install_global telemetry bootstrap, with an explicit telemetry_guard.shutdown() call added before each example completes.

Changes

Telemetry bootstrap adoption in examples

Layer / File(s) Summary
Add observability dev-dependency
rocketmq-example/Cargo.toml
Adds rocketmq-observability (path ../rocketmq-observability) to [dev-dependencies].
Consumer examples telemetry migration
rocketmq-example/examples/consumer/broadcast_consumer.rs, .../consumer_cluster.rs, .../lite_pull_consumer.rs, .../orderly_consumer.rs, .../pop_consumer.rs, .../request_reply_responder.rs, .../sql_filter_consumer.rs, .../tag_filter_consumer.rs
Each consumer example installs global telemetry at startup (via install_global(...).expect(...)), removes prior logger init/#[allow(deprecated)], and explicitly shuts down the telemetry guard after consumer shutdown.
Interop smoke test telemetry migration
rocketmq-example/examples/interop/request_code_smoke.rs
Installs global telemetry before running the smoke test and shuts it down after capturing the smoke result, before returning.
Producer examples telemetry migration
rocketmq-example/examples/producer/basic_send.rs, .../batch_send.rs, .../delay_send.rs, .../order_send.rs, .../producer_simple.rs, .../producer_with_timeout.rs, .../request_callback_send.rs, .../request_send.rs, .../send_to_queue.rs, .../send_with_selector.rs, .../send_with_selector_advanced.rs, .../transaction_send.rs
Each producer example installs global telemetry at startup, removes prior logger init/#[allow(deprecated)], and explicitly shuts down the telemetry guard after producer shutdown.

Estimated code review effort: 2 (Simple) | ~12 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Main
  participant TelemetryGuard as rocketmq_observability
  participant Component as Consumer/Producer

  Main->>TelemetryGuard: install_global(config)
  TelemetryGuard-->>Main: telemetry_guard
  Main->>Component: start / run example logic
  Component-->>Main: completion / shutdown signal
  Main->>Component: shutdown()
  Main->>TelemetryGuard: telemetry_guard.shutdown()
Loading

Possibly related issues

Possibly related PRs

  • mxsm/rocketmq-rust#7445: Updates the same example entrypoints to replace init_logger with install_global and telemetry_guard.shutdown().
  • mxsm/rocketmq-rust#7477: Example binaries bootstrap and shut down rocketmq_observability via TelemetryGuard, building on the same lifecycle pattern.

Suggested labels: feature🚀, refactor♻️

Suggested reviewers: SpaceXCN, TeslaRustor, rocketmq-rust-bot

Poem

A rabbit hops through logs of old,
Trading dusty init for telemetry gold,
Each guard installed, then bid goodbye,
Twenty-one examples now standing high,
Shutdown clean beneath the sky. 🐇✨

✨ 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/standalone-examples-telemetry-bootstrap

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-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♻️] Use telemetry bootstrap in standalone examples

3 participants