Skip to content

Commit b01645c

Browse files
Copilotwaynexia
andauthored
docs: add HTTP API for dynamic trace control (#2220)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: waynexia <[email protected]> Co-authored-by: Ruihang Xia <[email protected]>
1 parent 0552250 commit b01645c

File tree

4 files changed

+82
-0
lines changed

4 files changed

+82
-0
lines changed

docs/reference/http-endpoints.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,29 @@ This dashboard is packaged with the GreptimeDB server and provides a user-friend
111111

112112
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).
113113

114+
### Enable/Disable Trace
115+
116+
- **Path**: `/debug/enable_trace`
117+
- **Methods**: `POST`
118+
- **Description**: Dynamically enables or disables distributed tracing at runtime.
119+
- **Usage**: Send `true` to enable tracing or `false` to disable tracing.
120+
121+
Example to enable tracing:
122+
123+
```bash
124+
curl --data "true" http://127.0.0.1:4000/debug/enable_trace
125+
# Output: trace enabled
126+
```
127+
128+
Example to disable tracing:
129+
130+
```bash
131+
curl --data "false" http://127.0.0.1:4000/debug/enable_trace
132+
# Output: trace disabled
133+
```
134+
135+
For more information on tracing configuration, refer to the [tracing documentation](/user-guide/deployments-administration/monitoring/tracing.md).
136+
114137
### Profiling Tools
115138

116139
- **Base Path**: `/debug/prof/`

docs/user-guide/deployments-administration/monitoring/tracing.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@ GreptimeDB supports distributed tracing. GreptimeDB exports all collected spans
99

1010
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.
1111

12+
## Dynamic Tracing Control
13+
14+
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.
15+
16+
To enable tracing:
17+
18+
```bash
19+
curl --data "true" http://127.0.0.1:4000/debug/enable_trace
20+
# Output: trace enabled
21+
```
22+
23+
To disable tracing:
24+
25+
```bash
26+
curl --data "false" http://127.0.0.1:4000/debug/enable_trace
27+
# Output: trace disabled
28+
```
29+
1230
## Tutorial: Use Jaeger to trace GreptimeDB
1331

1432
[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.

i18n/zh/docusaurus-plugin-content-docs/current/reference/http-endpoints.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,29 @@ is_strict_mode = false
111111

112112
有关更多信息,请参阅[如何文档](https://github.com/GreptimeTeam/greptimedb/blob/main/docs/how-to/how-to-change-log-level-on-the-fly.md)
113113

114+
### 启用/禁用链路追踪
115+
116+
- **路径**: `/debug/enable_trace`
117+
- **方法**: `POST`
118+
- **描述**: 在运行时动态启用或禁用分布式链路追踪。
119+
- **用法**: 发送 `true` 启用链路追踪,或发送 `false` 禁用链路追踪。
120+
121+
启用链路追踪示例:
122+
123+
```bash
124+
curl --data "true" http://127.0.0.1:4000/debug/enable_trace
125+
# 输出: trace enabled
126+
```
127+
128+
禁用链路追踪示例:
129+
130+
```bash
131+
curl --data "false" http://127.0.0.1:4000/debug/enable_trace
132+
# 输出: trace disabled
133+
```
134+
135+
有关链路追踪配置的更多信息,请参阅[链路追踪文档](/user-guide/deployments-administration/monitoring/tracing.md)
136+
114137
### 性能分析工具
115138

116139
- **基础路径**: `/debug/prof/`

i18n/zh/docusaurus-plugin-content-docs/current/user-guide/deployments-administration/monitoring/tracing.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@ GreptimeDB 支持分布式链路追踪。GreptimeDB 使用基于 gRPC 的 OTLP
99

1010
在配置中的 [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 部分提供了参考配置项。
1111

12+
## 动态链路追踪控制
13+
14+
GreptimeDB 提供了通过 HTTP API 在运行时动态启用或禁用链路追踪的功能,无需重启服务器。这对于排查生产环境问题或临时启用追踪进行调试非常有用。
15+
16+
启用链路追踪:
17+
18+
```bash
19+
curl --data "true" http://127.0.0.1:4000/debug/enable_trace
20+
# 输出: trace enabled
21+
```
22+
23+
禁用链路追踪:
24+
25+
```bash
26+
curl --data "false" http://127.0.0.1:4000/debug/enable_trace
27+
# 输出: trace disabled
28+
```
29+
1230
## 教程:使用 Jaeger 追踪 GreptimeDB 调用链路
1331

1432
[Jaeger](https://www.jaegertracing.io/) 是一个开源的、端到端的分布式链路追踪系统,最初由 Uber 开发并开源。它的目标是帮助开发人员监测和调试复杂的微服务架构中的请求流程。

0 commit comments

Comments
 (0)