snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
20
internal/middleware/otel.go
Normal file
20
internal/middleware/otel.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
)
|
||||
|
||||
type OpenTelemetryHandler struct {
|
||||
operation string
|
||||
opts []otelhttp.Option
|
||||
}
|
||||
|
||||
func NewOpenTelemetryHandler(operation string, opts []otelhttp.Option) *OpenTelemetryHandler {
|
||||
return &OpenTelemetryHandler{operation: operation, opts: opts}
|
||||
}
|
||||
|
||||
func (t *OpenTelemetryHandler) Middleware(h http.Handler) http.Handler {
|
||||
return otelhttp.NewHandler(h, t.operation, t.opts...)
|
||||
}
|
||||
Reference in New Issue
Block a user