keep trace span context (#3724)

This commit is contained in:
Denis Mishin 2022-11-04 17:52:13 -04:00 committed by GitHub
parent c178819875
commit a3cfe8fa42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 11 deletions

View file

@ -76,7 +76,7 @@ func (srv *Server) UpdateConfig(options ...ServerOption) {
// AcquireLease acquires a lease.
func (srv *Server) AcquireLease(ctx context.Context, req *databroker.AcquireLeaseRequest) (*databroker.AcquireLeaseResponse, error) {
_, span := trace.StartSpan(ctx, "databroker.grpc.AcquireLease")
ctx, span := trace.StartSpan(ctx, "databroker.grpc.AcquireLease")
defer span.End()
log.Info(ctx).
Str("name", req.GetName()).
@ -103,7 +103,7 @@ func (srv *Server) AcquireLease(ctx context.Context, req *databroker.AcquireLeas
// Get gets a record from the in-memory list.
func (srv *Server) Get(ctx context.Context, req *databroker.GetRequest) (*databroker.GetResponse, error) {
_, span := trace.StartSpan(ctx, "databroker.grpc.Get")
ctx, span := trace.StartSpan(ctx, "databroker.grpc.Get")
defer span.End()
log.Info(ctx).
Str("type", req.GetType()).
@ -130,7 +130,7 @@ func (srv *Server) Get(ctx context.Context, req *databroker.GetRequest) (*databr
// Query queries for records.
func (srv *Server) Query(ctx context.Context, req *databroker.QueryRequest) (*databroker.QueryResponse, error) {
_, span := trace.StartSpan(ctx, "databroker.grpc.Query")
ctx, span := trace.StartSpan(ctx, "databroker.grpc.Query")
defer span.End()
log.Info(ctx).
Str("type", req.GetType()).
@ -183,7 +183,7 @@ func (srv *Server) Query(ctx context.Context, req *databroker.QueryRequest) (*da
// Put updates an existing record or adds a new one.
func (srv *Server) Put(ctx context.Context, req *databroker.PutRequest) (*databroker.PutResponse, error) {
_, span := trace.StartSpan(ctx, "databroker.grpc.Put")
ctx, span := trace.StartSpan(ctx, "databroker.grpc.Put")
defer span.End()
records := req.GetRecords()
@ -222,7 +222,7 @@ func (srv *Server) Put(ctx context.Context, req *databroker.PutRequest) (*databr
// ReleaseLease releases a lease.
func (srv *Server) ReleaseLease(ctx context.Context, req *databroker.ReleaseLeaseRequest) (*emptypb.Empty, error) {
_, span := trace.StartSpan(ctx, "databroker.grpc.ReleaseLease")
ctx, span := trace.StartSpan(ctx, "databroker.grpc.ReleaseLease")
defer span.End()
log.Info(ctx).
Str("name", req.GetName()).
@ -244,7 +244,7 @@ func (srv *Server) ReleaseLease(ctx context.Context, req *databroker.ReleaseLeas
// RenewLease releases a lease.
func (srv *Server) RenewLease(ctx context.Context, req *databroker.RenewLeaseRequest) (*emptypb.Empty, error) {
_, span := trace.StartSpan(ctx, "databroker.grpc.RenewLease")
ctx, span := trace.StartSpan(ctx, "databroker.grpc.RenewLease")
defer span.End()
log.Debug(ctx).
Str("name", req.GetName()).
@ -269,7 +269,7 @@ func (srv *Server) RenewLease(ctx context.Context, req *databroker.RenewLeaseReq
// SetOptions sets options for a type in the databroker.
func (srv *Server) SetOptions(ctx context.Context, req *databroker.SetOptionsRequest) (*databroker.SetOptionsResponse, error) {
_, span := trace.StartSpan(ctx, "databroker.grpc.SetOptions")
ctx, span := trace.StartSpan(ctx, "databroker.grpc.SetOptions")
defer span.End()
backend, err := srv.getBackend()