1
0
Fork 0

fix: otel not working without USER

This commit is contained in:
Michael 2025-10-03 14:48:04 +02:00 committed by GitHub
parent ad566ee9ef
commit c5ed376d5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
127 changed files with 347 additions and 305 deletions

View file

@ -19,9 +19,10 @@ import (
"github.com/rs/zerolog/log"
"github.com/sirupsen/logrus"
ptypes "github.com/traefik/paerser/types"
"github.com/traefik/traefik/v3/pkg/logs"
"github.com/traefik/traefik/v3/pkg/middlewares/capture"
"github.com/traefik/traefik/v3/pkg/middlewares/observability"
"github.com/traefik/traefik/v3/pkg/observability/logs"
otypes "github.com/traefik/traefik/v3/pkg/observability/types"
traefiktls "github.com/traefik/traefik/v3/pkg/tls"
"github.com/traefik/traefik/v3/pkg/types"
"go.opentelemetry.io/contrib/bridges/otellogrus"
@ -64,7 +65,7 @@ type handlerParams struct {
// Handler will write each request and its response to the access log.
type Handler struct {
config *types.AccessLog
config *otypes.AccessLog
logger *logrus.Logger
file io.WriteCloser
mu sync.Mutex
@ -88,7 +89,7 @@ func (h *Handler) AliceConstructor() alice.Constructor {
}
// NewHandler creates a new Handler.
func NewHandler(ctx context.Context, config *types.AccessLog) (*Handler, error) {
func NewHandler(ctx context.Context, config *otypes.AccessLog) (*Handler, error) {
var file io.WriteCloser = noopCloser{os.Stdout}
if len(config.FilePath) > 0 {
f, err := openAccessLogFile(config.FilePath)
@ -423,9 +424,9 @@ func (h *Handler) redactHeaders(headers http.Header, fields logrus.Fields, prefi
for k := range headers {
v := h.config.Fields.KeepHeader(k)
switch v {
case types.AccessLogKeep:
case otypes.AccessLogKeep:
fields[prefix+k] = strings.Join(headers.Values(k), ",")
case types.AccessLogRedact:
case otypes.AccessLogRedact:
fields[prefix+k] = "REDACTED"
}
}