Skip to content

Conversation

@waynexia
Copy link
Member

@waynexia waynexia commented Jul 29, 2025

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

What's changed and what's your intention?

Add a new HTTP API /debug/enable_trace to enable or disable trace on the fly.

❯ curl --data "true" 0:4000/debug/enable_trace
trace enabled%

❯ curl --data "false" 0:4000/debug/enable_trace 
trace disabled%

PR Checklist

Please convert it to a draft if some of the following conditions are not met.

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.
  • API changes are backward compatible.
  • Schema or data changes are backward compatible.

Signed-off-by: Ruihang Xia <[email protected]>
@github-actions github-actions bot added size/XS docs-not-required This change does not impact docs. labels Jul 29, 2025
@github-actions github-actions bot added size/S and removed size/XS labels Aug 1, 2025
Signed-off-by: Ruihang Xia <[email protected]>
@waynexia waynexia marked this pull request as ready for review August 1, 2025 22:11
@waynexia waynexia requested a review from a team as a code owner August 1, 2025 22:11
@github-actions github-actions bot added docs-required This change requires docs update. and removed docs-not-required This change does not impact docs. labels Aug 1, 2025
@waynexia waynexia changed the title [WIP] feat: dynamic reload trace layer feat: dynamic enable or disable trace Aug 1, 2025
Copy link
Contributor

Copilot AI left a 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 introduces dynamic tracing control functionality, allowing administrators to enable or disable OpenTelemetry tracing at runtime through an HTTP API endpoint. The implementation refactors the existing tracing initialization to support reload capabilities and adds a new /debug/enable_trace endpoint.

  • Adds HTTP API /debug/enable_trace for runtime trace control
  • Refactors tracing initialization to support dynamic reload using tracing-subscriber's reload layer
  • Renames existing reload handle from RELOAD_HANDLE to LOG_RELOAD_HANDLE for clarity

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/servers/src/http/dyn_trace.rs New handler for dynamic trace control endpoint
src/servers/src/http/dyn_log.rs Updates variable name to use renamed LOG_RELOAD_HANDLE
src/servers/src/http.rs Registers new trace control endpoint and imports module
src/servers/Cargo.toml Adds tracing-opentelemetry dependency
src/common/telemetry/src/logging.rs Major refactor to support dynamic trace reload with new static handles
src/common/telemetry/src/lib.rs Exports new static handles for trace control
src/common/telemetry/Cargo.toml Uses workspace version for tracing-opentelemetry
docs/how-to/how-to-change-log-level-on-the-fly.md Documents new trace control API
Cargo.toml Adds tracing-opentelemetry to workspace dependencies

@waynexia waynexia marked this pull request as draft August 12, 2025 17:09
@waynexia waynexia marked this pull request as ready for review November 11, 2025 03:50
@waynexia waynexia requested a review from Copilot November 11, 2025 06:39
Copilot finished reviewing on behalf of waynexia November 11, 2025 06:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@evenyag evenyag left a comment

Choose a reason for hiding this comment

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

Others LGTM......

@killme2008
Copy link
Contributor

@waynexia Do you have time to address the comments reviewed by coplit?

Copy link
Contributor

@killme2008 killme2008 left a comment

Choose a reason for hiding this comment

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

Some comments reviewed by Copilot still need to be addressed.

LGTM overall.

Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
Signed-off-by: Ruihang Xia <[email protected]>
@waynexia waynexia enabled auto-merge November 17, 2025 11:55
@waynexia waynexia added this pull request to the merge queue Nov 17, 2025
Merged via the queue into main with commit cc61af7 Nov 17, 2025
54 checks passed
@waynexia waynexia deleted the dyn-trace branch November 17, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-required This change requires docs update. documentation size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants