mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-04 12:56:02 +02:00
* update tracing config definitions * new tracing system * performance improvements * only configure tracing in envoy if it is enabled in pomerium * [tracing] refactor to use custom extension for trace id editing (#5420) refactor to use custom extension for trace id editing * set default tracing sample rate to 1.0 * fix proxy service http middleware * improve some existing auth related traces * test fixes * bump envoyproxy/go-control-plane * code cleanup * test fixes * Fix missing spans for well-known endpoints * import extension apis from pomerium/envoy-custom
64 lines
1.9 KiB
Go
64 lines
1.9 KiB
Go
package upstreams
|
|
|
|
import (
|
|
oteltrace "go.opentelemetry.io/otel/trace"
|
|
"go.opentelemetry.io/otel/trace/noop"
|
|
)
|
|
|
|
type CommonUpstreamOptions struct {
|
|
displayName string
|
|
clientTracerProviderOverride oteltrace.TracerProvider
|
|
serverTracerProviderOverride oteltrace.TracerProvider
|
|
delayShutdown bool
|
|
}
|
|
|
|
type CommonUpstreamOption interface {
|
|
GRPCUpstreamOption
|
|
HTTPUpstreamOption
|
|
}
|
|
|
|
type commonUpstreamOption func(o *CommonUpstreamOptions)
|
|
|
|
// applyGRPC implements CommonUpstreamOption.
|
|
func (c commonUpstreamOption) applyGRPC(o *GRPCUpstreamOptions) { c(&o.CommonUpstreamOptions) }
|
|
|
|
// applyHTTP implements CommonUpstreamOption.
|
|
func (c commonUpstreamOption) applyHTTP(o *HTTPUpstreamOptions) { c(&o.CommonUpstreamOptions) }
|
|
|
|
func WithDisplayName(displayName string) CommonUpstreamOption {
|
|
return commonUpstreamOption(func(o *CommonUpstreamOptions) {
|
|
o.displayName = displayName
|
|
})
|
|
}
|
|
|
|
func WithNoClientTracing() CommonUpstreamOption {
|
|
return commonUpstreamOption(func(o *CommonUpstreamOptions) {
|
|
o.clientTracerProviderOverride = noop.NewTracerProvider()
|
|
})
|
|
}
|
|
|
|
func WithNoServerTracing() CommonUpstreamOption {
|
|
return commonUpstreamOption(func(o *CommonUpstreamOptions) {
|
|
o.serverTracerProviderOverride = noop.NewTracerProvider()
|
|
})
|
|
}
|
|
|
|
func WithClientTracerProvider(tp oteltrace.TracerProvider) CommonUpstreamOption {
|
|
return commonUpstreamOption(func(o *CommonUpstreamOptions) {
|
|
o.clientTracerProviderOverride = tp
|
|
})
|
|
}
|
|
|
|
func WithServerTracerProvider(tp oteltrace.TracerProvider) CommonUpstreamOption {
|
|
return commonUpstreamOption(func(o *CommonUpstreamOptions) {
|
|
o.serverTracerProviderOverride = tp
|
|
})
|
|
}
|
|
|
|
// WithDelayedShutdown keeps the server alive until the test environment has
|
|
// fully shut down, instead of stopping it during the shutdown sequence.
|
|
func WithDelayedShutdown() CommonUpstreamOption {
|
|
return commonUpstreamOption(func(o *CommonUpstreamOptions) {
|
|
o.delayShutdown = true
|
|
})
|
|
}
|