Skip to content

Commit bc1decd

Browse files
committed
[Feature]support trace part1
1 parent 80efe98 commit bc1decd

File tree

29 files changed

+4927
-477
lines changed

29 files changed

+4927
-477
lines changed

docs/observability/README.md

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
## Observability Example Configuration (`examples/observability`)
2+
3+
This directory provides a complete, Docker Compose–based observability example environment, including:
4+
5+
* **Prometheus**: Metrics collection
6+
* **Grafana**: Metrics visualization
7+
* **OpenTelemetry Collector**: Distributed tracing data ingestion and processing
8+
9+
Developers can use this example to **launch a local monitoring and tracing system with a single command**.
10+
11+
---
12+
13+
### Prerequisites
14+
15+
Please make sure the following components are installed in advance:
16+
17+
* Docker
18+
* Docker Compose (or a newer Docker CLI version that supports `docker compose`)
19+
20+
---
21+
22+
### Usage
23+
24+
#### Start All Services
25+
26+
Enter the directory:
27+
28+
```bash
29+
cd examples/observability
30+
```
31+
32+
Run the following command to start the complete monitoring and tracing stack:
33+
34+
```bash
35+
docker compose -f docker-compose.yaml up -d
36+
```
37+
38+
After startup, you can access:
39+
40+
* **Prometheus**: [http://localhost:9090](http://localhost:9090)
41+
* **Grafana**: [http://localhost:3000](http://localhost:3000)
42+
* **OTLP receiver**: Applications should send traces to the default ports of the OTel Collector (usually `4317` or `4318`)
43+
44+
* gRPC: `4317`
45+
* HTTP: `4318`
46+
* **Jaeger UI**: [http://localhost:16886](http://localhost:16886)
47+
48+
**Notes:**
49+
50+
* Update the Prometheus scrape targets to match your actual application endpoints.
51+
* Map Grafana’s service port to a port that is accessible on your machine.
52+
* Map the Jaeger UI port to a port that is accessible on your machine.
53+
* When starting the full stack, there is no need to start individual sub-services separately.
54+
55+
---
56+
57+
#### Start Metrics Services Only
58+
59+
Enter the directory:
60+
61+
```bash
62+
cd examples/observability/metrics
63+
```
64+
65+
Run the following command:
66+
67+
```bash
68+
docker compose -f prometheus_compose.yaml up -d
69+
```
70+
71+
After startup, you can access:
72+
73+
* **Grafana**: [http://localhost:3000](http://localhost:3000)
74+
75+
---
76+
77+
#### Start Tracing Services Only
78+
79+
Enter the directory:
80+
81+
```bash
82+
cd examples/observability/tracing
83+
```
84+
85+
Run the following command:
86+
87+
```bash
88+
docker compose -f tracing_compose.yaml up -d
89+
```
90+
91+
After startup, you can access:
92+
93+
* **OTLP receiver**: Applications should send traces to the default ports of the OTel Collector (usually `4317` or `4318`)
94+
95+
* gRPC: `4317`
96+
* HTTP: `4318`
97+
* **Jaeger UI**: [http://localhost:16886](http://localhost:16886)
98+
99+
---
100+
101+
### Directory Structure and File Descriptions
102+
103+
#### Core Startup File
104+
105+
| File Name | Purpose | Description |
106+
| --------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
107+
| `docker-compose.yaml` | Main entry | Defines and starts the full observability stack (Prometheus, Grafana, OTel Collector, and Jaeger). This is the single entry point to launch the entire environment. |
108+
109+
---
110+
111+
#### Metrics and Monitoring Configuration
112+
113+
| File / Directory | Purpose | Description |
114+
| --------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
115+
| `metrics` | Metrics root directory | Contains all Prometheus- and metrics-related configurations. |
116+
| `prometheus.yaml` | Prometheus main config | Defines scrape targets, global scrape parameters, and optional recording rules. All monitored endpoints are defined here. |
117+
| `prometheus_compose.yaml` | Prometheus Docker config | Defines the Prometheus container, volume mounts, and network settings. |
118+
| `grafana/datasources/datasource.yaml` | Datasource configuration | Configures how Grafana connects to Prometheus. |
119+
| `grafana/dashboards/config/dashboard.yaml` | Dashboard provisioning | Specifies the locations of dashboard JSON files to be loaded. |
120+
| `grafana/dashboards/json/fastdeploy-dashboard.json` | Dashboard definition | Contains visualization layouts and queries for `fastdeploy` monitoring metrics. |
121+
122+
---
123+
124+
#### Distributed Tracing Configuration
125+
126+
| File / Directory | Purpose | Description |
127+
| ------------------------------------------------------------------------------- | ---------------------- | ---------------------------------------------------------------------- |
128+
| `tracing` | Tracing root directory | Contains all configurations related to distributed tracing. |
129+
| `opentelemetry.yaml` | OTel Collector config | Defines the Collector data pipelines: |
130+
|**receivers**: receive OTLP data (traces, metrics, logs) | | |
131+
|**processors**: data processing and batching | | |
132+
|**exporters**: export data to tracing backends (such as Jaeger) or files | | |
133+
|**extensions**: health check, pprof, and zpages | | |
134+
|**pipelines**: define complete processing flows for traces, metrics, and logs | | |
135+
| `tracing_compose.yaml` | Tracing Docker config | Defines the container configuration for the OTel Collector and Jaeger. |
136+
137+
---
138+
139+
### Customization
140+
141+
#### 4.1 Modify Metrics Scrape Targets
142+
143+
If your application’s metrics endpoint, port, or path changes, edit:
144+
145+
```plain
146+
metrics/prometheus.yaml
147+
```
148+
149+
---
150+
151+
#### 4.2 Adjust Tracing Sampling Rate or Processing Logic
152+
153+
Edit:
154+
155+
```plain
156+
tracing/opentelemetry.yaml
157+
```
158+
159+
---
160+
161+
#### 4.3 Add Custom Grafana Dashboards
162+
163+
1. Add the new dashboard JSON file to:
164+
165+
```plain
166+
grafana/dashboards/json/
167+
```
168+
169+
2. Register the dashboard so Grafana can load it automatically by editing:
170+
171+
```plain
172+
grafana/dashboards/config/dashboard.yaml
173+
```

0 commit comments

Comments
 (0)