# README
Tracing Middleware
The tracing middleware provides a way to trace the execution of a request through the application. It is based on the OpenTelemetry standard and can be used with any tracer that implements this standard.
The package is forked from tracing and optimized on this basis. Thanks to the original author for his contribution.
Usage Example
package main
import (
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/transport/http"
"github.com/go-kratos-ecosystem/components/v2/middleware/tracing"
)
func main() {
app := kratos.New(
kratos.Name("tracing"),
kratos.Server(
http.NewServer(
http.Address(":8001"),
http.Middleware(tracing.Server()),
),
),
)
if err := app.Run(); err != nil {
panic(err)
}
}
License
- The MIT License (MIT).
- Kratos License File: License File
# Functions
Client returns a new client middleware for OpenTelemetry.
NewTracer create tracer instance.
Server returns a new server middleware for OpenTelemetry.
SpanID returns a spanid valuer.
TraceID returns a traceid valuer.
WithPropagator with tracer propagator.
WithTracerName with tracer name.
WithTracerProvider with tracer provider.
# Structs
ClientHandler is tracing ClientHandler.
Metadata is tracing metadata propagator.
Tracer is otel span tracer.
# Type aliases
Option is tracing option.