English | 中文
Ensure Docker has been installed.
docker-compose up -d
go run server/main.go
go run client/main.go
You can then navigate to http://localhost:16686 to access the Jaeger UI. (You can visit Monitor Jaeger for details)
You can then navigate to http://localhost:3000 to access the Grafana UI. (You can visit Monitor Grafana for metrics)
Http URL:
http://victoriametrics:8428/
- RPC Metrics
- Runtime Metrics
import (
kitexlogrus "github.com/kitex-contrib/obs-opentelemetry/logging/logrus"
)
func init() {
klog.SetLogger(kitexlogrus.NewLogger())
klog.SetLevel(klog.LevelDebug)
}
// Echo implements the Echo interface.
func (s *EchoImpl) Echo(ctx context.Context, req *api.Request) (resp *api.Response, err error) {
klog.CtxDebugf(ctx, "echo called: %s", req.GetMessage())
return &api.Response{Message: req.Message}, nil
}
{"level":"debug","msg":"echo called: my request 1","span_id":"056e0cf9a8b2cec3","time":"2022-03-09T02:47:28+08:00","trace_flags":"01","trace_id":"33bdd3c81c9eb6cbc0fbb59c57ce088b"}
Jaeger natively supports OTLP protocol, and we can send data directly to Jaeger without OpenTelemetry Collector
Image from jaeger
version: "3.7"
services:
# Jaeger
jaeger-all-in-one:
image: jaegertracing/all-in-one:latest
environment:
- COLLECTOR_OTLP_ENABLED=true
ports:
- "4317:4317" # OTLP gRPC receiver
export OTEL_EXPORTER_OTLP_ENDPOINT=http://host.docker.internal:4317
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc