diff --git a/docs/reference/http-endpoints.md b/docs/reference/http-endpoints.md index 2ce4678bd..40f5ad7b0 100644 --- a/docs/reference/http-endpoints.md +++ b/docs/reference/http-endpoints.md @@ -111,6 +111,29 @@ This dashboard is packaged with the GreptimeDB server and provides a user-friend For more information, refer to the [how-to documentation](https://github.com/GreptimeTeam/greptimedb/blob/main/docs/how-to/how-to-change-log-level-on-the-fly.md). +### Enable/Disable Trace + +- **Path**: `/debug/enable_trace` +- **Methods**: `POST` +- **Description**: Dynamically enables or disables distributed tracing at runtime. +- **Usage**: Send `true` to enable tracing or `false` to disable tracing. + +Example to enable tracing: + +```bash +curl --data "true" http://127.0.0.1:4000/debug/enable_trace +# Output: trace enabled +``` + +Example to disable tracing: + +```bash +curl --data "false" http://127.0.0.1:4000/debug/enable_trace +# Output: trace disabled +``` + +For more information on tracing configuration, refer to the [tracing documentation](/user-guide/deployments-administration/monitoring/tracing.md). + ### Profiling Tools - **Base Path**: `/debug/prof/` diff --git a/docs/user-guide/deployments-administration/monitoring/tracing.md b/docs/user-guide/deployments-administration/monitoring/tracing.md index 2d0db63c8..866736288 100644 --- a/docs/user-guide/deployments-administration/monitoring/tracing.md +++ b/docs/user-guide/deployments-administration/monitoring/tracing.md @@ -9,6 +9,24 @@ GreptimeDB supports distributed tracing. GreptimeDB exports all collected spans In the [logging section](/user-guide/deployments-administration/configuration.md#logging-options) in the configuration, there are descriptions of configuration items related to tracing, [standalone.example.toml](https://github.com/GreptimeTeam/greptimedb/blob/VAR::greptimedbVersion/config/standalone.example.toml) provide a reference configuration in the logging section. +## Dynamic Tracing Control + +GreptimeDB provides the ability to enable or disable tracing dynamically at runtime using the HTTP API without requiring a server restart. This is useful for troubleshooting production issues or temporarily enabling tracing for debugging purposes. + +To enable tracing: + +```bash +curl --data "true" http://127.0.0.1:4000/debug/enable_trace +# Output: trace enabled +``` + +To disable tracing: + +```bash +curl --data "false" http://127.0.0.1:4000/debug/enable_trace +# Output: trace disabled +``` + ## Tutorial: Use Jaeger to trace GreptimeDB [Jaeger](https://www.jaegertracing.io/) is an open source, end-to-end distributed tracing system, originally developed and open sourced by Uber. Its goal is to help developers monitor and debug the request flow in complex microservice architectures. diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/reference/http-endpoints.md b/i18n/zh/docusaurus-plugin-content-docs/current/reference/http-endpoints.md index 27c662906..10eecbdb9 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/reference/http-endpoints.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/reference/http-endpoints.md @@ -111,6 +111,29 @@ is_strict_mode = false 有关更多信息,请参阅[如何文档](https://github.com/GreptimeTeam/greptimedb/blob/main/docs/how-to/how-to-change-log-level-on-the-fly.md)。 +### 启用/禁用链路追踪 + +- **路径**: `/debug/enable_trace` +- **方法**: `POST` +- **描述**: 在运行时动态启用或禁用分布式链路追踪。 +- **用法**: 发送 `true` 启用链路追踪,或发送 `false` 禁用链路追踪。 + +启用链路追踪示例: + +```bash +curl --data "true" http://127.0.0.1:4000/debug/enable_trace +# 输出: trace enabled +``` + +禁用链路追踪示例: + +```bash +curl --data "false" http://127.0.0.1:4000/debug/enable_trace +# 输出: trace disabled +``` + +有关链路追踪配置的更多信息,请参阅[链路追踪文档](/user-guide/deployments-administration/monitoring/tracing.md)。 + ### 性能分析工具 - **基础路径**: `/debug/prof/` diff --git a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/deployments-administration/monitoring/tracing.md b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/deployments-administration/monitoring/tracing.md index 72a1a00ba..b86fedcab 100644 --- a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/deployments-administration/monitoring/tracing.md +++ b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/deployments-administration/monitoring/tracing.md @@ -9,6 +9,24 @@ GreptimeDB 支持分布式链路追踪。GreptimeDB 使用基于 gRPC 的 OTLP 在配置中的 [logging 部分](/user-guide/deployments-administration/configuration.md#logging-选项) 有对 tracing 的相关配置项说明,[standalone.example.toml](https://github.com/GreptimeTeam/greptimedb/blob/VAR::greptimedbVersion/config/standalone.example.toml) 的 logging 部分提供了参考配置项。 +## 动态链路追踪控制 + +GreptimeDB 提供了通过 HTTP API 在运行时动态启用或禁用链路追踪的功能,无需重启服务器。这对于排查生产环境问题或临时启用追踪进行调试非常有用。 + +启用链路追踪: + +```bash +curl --data "true" http://127.0.0.1:4000/debug/enable_trace +# 输出: trace enabled +``` + +禁用链路追踪: + +```bash +curl --data "false" http://127.0.0.1:4000/debug/enable_trace +# 输出: trace disabled +``` + ## 教程:使用 Jaeger 追踪 GreptimeDB 调用链路 [Jaeger](https://www.jaegertracing.io/) 是一个开源的、端到端的分布式链路追踪系统,最初由 Uber 开发并开源。它的目标是帮助开发人员监测和调试复杂的微服务架构中的请求流程。