mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-26 06:28:18 +02:00
new tracing system
This commit is contained in:
parent
b87d940d11
commit
a6f43f3c3c
127 changed files with 7509 additions and 1454 deletions
|
@ -4,11 +4,17 @@
|
|||
package authenticateflow
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
oteltrace "go.opentelemetry.io/otel/trace"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/stats"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/telemetry/trace"
|
||||
"github.com/pomerium/pomerium/pkg/grpc"
|
||||
"github.com/pomerium/pomerium/pkg/grpc/user"
|
||||
"github.com/pomerium/pomerium/pkg/identity"
|
||||
|
@ -33,3 +39,23 @@ func populateUserFromClaims(u *user.User, claims map[string]any) {
|
|||
u.Claims[k] = vs
|
||||
}
|
||||
}
|
||||
|
||||
var outboundDatabrokerTraceClientOpts = []trace.ClientStatsHandlerOption{
|
||||
trace.WithStatsInterceptor(ignoreNotFoundErrors),
|
||||
}
|
||||
|
||||
func ignoreNotFoundErrors(ctx context.Context, rs stats.RPCStats) stats.RPCStats {
|
||||
if end, ok := rs.(*stats.End); ok && end.IsClient() {
|
||||
if status.Code(end.Error) == codes.NotFound {
|
||||
oteltrace.SpanFromContext(ctx).AddEvent("status code: NotFound")
|
||||
return &stats.End{
|
||||
Client: end.Client,
|
||||
BeginTime: end.BeginTime,
|
||||
EndTime: end.EndTime,
|
||||
Trailer: end.Trailer,
|
||||
Error: nil,
|
||||
}
|
||||
}
|
||||
}
|
||||
return rs
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue