telemetry: add tracing spans to cache and databroker (#987)

This commit is contained in:
Travis Groth 2020-06-23 13:08:21 -04:00 committed by GitHub
parent 4ca0189524
commit eaa0c980d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 1 deletions

5
cache/session.go vendored
View file

@ -10,6 +10,7 @@ import (
"github.com/pomerium/pomerium/internal/grpc/databroker"
"github.com/pomerium/pomerium/internal/grpc/session"
"github.com/pomerium/pomerium/internal/log"
"github.com/pomerium/pomerium/internal/telemetry/trace"
)
// SessionServer implements the session service interface for adding and syncing sessions.
@ -28,6 +29,8 @@ func NewSessionServer(grpcServer *grpc.Server, dataBrokerClient databroker.DataB
// Delete deletes a session from the session server.
func (srv *SessionServer) Delete(ctx context.Context, req *session.DeleteRequest) (*emptypb.Empty, error) {
ctx, span := trace.StartSpan(ctx, "session.grpc.Delete")
defer span.End()
log.Info().
Str("service", "session").
Str("session_id", req.GetId()).
@ -46,6 +49,8 @@ func (srv *SessionServer) Delete(ctx context.Context, req *session.DeleteRequest
// Add adds a session to the session server.
func (srv *SessionServer) Add(ctx context.Context, req *session.AddRequest) (*session.AddResponse, error) {
ctx, span := trace.StartSpan(ctx, "session.grpc.Add")
defer span.End()
log.Info().
Str("service", "session").
Str("session_id", req.GetSession().GetId()).