Official steps from the documentation: https://go-zero.dev/docs/tutorials/monitor/index
Health Checks
Name: user-api
Host: 0.0.0.0
Port: 8002
DevServer:
Enabled: true
Port: 6470
HealthPath: "/healthz"
Default health check port:
6470
, default path:/healthz
You can use Alibaba Cloud’s Site Monitoring or similar services to periodically request this endpoint and ensure service availability.
Log Collection
- Logs can be written to stdout and aggregated using services like Alibaba Cloud SLS.
Distributed Tracing
-
Integration with Alibaba Cloud ARMS: https://arms.console.aliyun.com/
1.png -
Important configuration note: Do NOT select
Jaeger
forBatcher
in go-zero’s config:
Name: xxxx
# Distributed tracing configuration - use otlgrpc as other upload methods don't support custom headers
Telemetry:
Name: xxxx
Endpoint: [ARMS Endpoint]
Sampler: 1.0
Batcher: otlpgrpc
OtlpHeaders:
Authentication: [ARMS Token]
Implementation Results
Metrics Monitoring
Name: user-api
Host: 0.0.0.0
Port: 8002
DevServer:
Enabled: true
Port: 6470
MetricsPath: "/metrics"
EnableMetrics: true
- Metrics can then be collected by Prometheus or similar monitoring systems.