Skip to content

feat(E7): add OTel tracing to CLI command lifecycle#254

Open
KooshaPari wants to merge 6 commits into
mainfrom
feat/E7-otel-cli-trace
Open

feat(E7): add OTel tracing to CLI command lifecycle#254
KooshaPari wants to merge 6 commits into
mainfrom
feat/E7-otel-cli-trace

Conversation

@KooshaPari

Copy link
Copy Markdown
Owner

Summary

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@github-actions

Copy link
Copy Markdown

Legacy Tooling Scan Report

Severity Count
Critical 0
High 0
Medium 0
Low 0

No violations detected.

This is a WARN-mode scan. Fix before strict enforcement begins.

@socket-security

socket-security Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​futures@​0.3.3210010093100100
Addedcargo/​rayon@​1.10.010010093100100
Addedcargo/​tempfile@​3.27.09810093100100

View full report

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d7fd86c2b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +108 to +109
let _otel_guard = byteport_otel::init::init_default();
info!("byteport-cli starting");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep telemetry logs off command stdout

With init_default() the CLI uses the default telemetry config where stdout JSON logging is enabled, and the newly added info! calls now write log records into the same stream as command results. For scriptable commands such as codec encode or upload, callers no longer receive just the encoded value or upload instruction on stdout. Initialize CLI telemetry with stdout logging disabled or route logs to stderr.

Useful? React with 👍 / 👎.

Comment on lines +75 to +76
Ok(mp) => {
opentelemetry::global::set_meter_provider(mp);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain the meter provider so CLI metrics flush

When metrics are enabled, the MeterProvider is installed globally and then discarded; TelemetryGuard only retains and shuts down the tracer provider, while the PeriodicReader exports every 60 seconds. Short-lived CLI commands record invocation/error metrics and exit before that interval, so the new CLI metrics can be lost at shutdown. Keep the meter provider in the guard and force-flush/shut it down on drop.

Useful? React with 👍 / 👎.

Comment on lines +114 to +115
let _span = start_cli_command_span("codec");
run_codec(action);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Attach command spans before starting sub-spans

Storing the OpenTelemetry span in _span does not make it the current context. The run_* helpers call start_cli_sub_span(), which reads Context::current(), so for every CLI command the execute/operation spans are created as roots or siblings instead of children of the command lifecycle span. Attach or enter the command span for the duration of the run_* call.

Useful? React with 👍 / 👎.

Comment thread Cargo.toml
"crates/byteport-transport",
"crates/byteport-cli",
"crates/byteport-dag",
"crates/byteport-otel",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep workspace membership under the required task

AGENTS.md §7 marks Cargo.toml [workspace.members] as do-not-touch without an explicit L2 SOTA task; adding crates/byteport-otel here changes the workspace and CI surface for every cargo --workspace command despite that guardrail. Please split this under the required approval/task or avoid changing the root workspace membership.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown

Legacy Tooling Scan Report

Severity Count
Critical 0
High 0
Medium 0
Low 0

No violations detected.

This is a WARN-mode scan. Fix before strict enforcement begins.

@sonarqubecloud

Copy link
Copy Markdown

@KooshaPari KooshaPari added the area:compute-infra Phenotype compute/infra epic label Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:compute-infra Phenotype compute/infra epic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant