From 92d2abac3ed92ae78f02687994bda4061873a891 Mon Sep 17 00:00:00 2001 From: Nick Schuch Date: Thu, 17 Sep 2026 17:30:19 +1000 Subject: [PATCH] chore(trace) Update to latest Compass spec --- internal/server/mock/trace/server.go | 33 ++ internal/server/mock/trace/server_test.go | 118 ++++ internal/server/mock/trace/set_threshold.go | 32 + internal/server/mock/trace/stream_traces.go | 55 +- pb/trace.pb.go | 621 +++++++++++++------- pb/trace_grpc.pb.go | 36 ++ trace.proto | 62 +- 7 files changed, 724 insertions(+), 233 deletions(-) create mode 100644 internal/server/mock/trace/server_test.go create mode 100644 internal/server/mock/trace/set_threshold.go diff --git a/internal/server/mock/trace/server.go b/internal/server/mock/trace/server.go index d4e9f6e..9eaddf6 100644 --- a/internal/server/mock/trace/server.go +++ b/internal/server/mock/trace/server.go @@ -2,16 +2,22 @@ package trace import ( "sync" + "time" "github.com/skpr/api/pb" ) +// DefaultThreshold is the tracing threshold an environment has until one is set +// for it, matching the default which Compass ships with. +const DefaultThreshold = time.Millisecond + // Server implements the GRPC "trace" definition. type Server struct { pb.UnimplementedTraceServer lock sync.Mutex suspended map[string]bool + threshold map[string]time.Duration } // SetSuspended marks tracing as suspended, or resumed, for an environment. @@ -33,3 +39,30 @@ func (s *Server) IsSuspended(environment string) bool { return s.suspended[environment] } + +// setThreshold records the minimum call duration which is traced for an environment. +func (s *Server) setThreshold(environment string, threshold time.Duration) { + s.lock.Lock() + defer s.lock.Unlock() + + if s.threshold == nil { + s.threshold = make(map[string]time.Duration) + } + + s.threshold[environment] = threshold +} + +// GetThreshold returns the minimum call duration which is traced for an +// environment, falling back to the default for an environment which has not had +// one set. +func (s *Server) GetThreshold(environment string) time.Duration { + s.lock.Lock() + defer s.lock.Unlock() + + threshold, ok := s.threshold[environment] + if !ok { + return DefaultThreshold + } + + return threshold +} diff --git a/internal/server/mock/trace/server_test.go b/internal/server/mock/trace/server_test.go new file mode 100644 index 0000000..746891d --- /dev/null +++ b/internal/server/mock/trace/server_test.go @@ -0,0 +1,118 @@ +package trace + +import ( + "context" + "testing" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/durationpb" + + "github.com/skpr/api/pb" +) + +// --- SetThreshold --- + +func TestSetThreshold(t *testing.T) { + cases := []struct { + name string + threshold *durationpb.Duration + wantCode codes.Code + want time.Duration + }{ + {"sets the threshold", durationpb.New(5 * time.Millisecond), codes.OK, 5 * time.Millisecond}, + {"zero traces every call", durationpb.New(0), codes.OK, 0}, + {"omitted is rejected", nil, codes.InvalidArgument, DefaultThreshold}, + {"negative is rejected", durationpb.New(-time.Millisecond), codes.InvalidArgument, DefaultThreshold}, + } + + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + srv := &Server{} + + _, err := srv.SetThreshold(context.TODO(), &pb.TraceSetThresholdRequest{ + Environment: "dev", + Threshold: c.threshold, + }) + + if got := status.Code(err); got != c.wantCode { + t.Errorf("got code %s, want %s", got, c.wantCode) + } + + if got := srv.GetThreshold("dev"); got != c.want { + t.Errorf("got threshold %s, want %s", got, c.want) + } + }) + } +} + +// An environment which has never had a threshold set still has to stream, so it +// falls back to the default rather than to zero, which would trace every call. +func TestGetThresholdDefaults(t *testing.T) { + srv := &Server{} + + if got := srv.GetThreshold("dev"); got != DefaultThreshold { + t.Errorf("got threshold %s, want %s", got, DefaultThreshold) + } +} + +// Thresholds are held per environment, so lowering one does not quietly start +// tracing every call on another. +func TestSetThresholdIsPerEnvironment(t *testing.T) { + srv := &Server{} + + if _, err := srv.SetThreshold(context.TODO(), &pb.TraceSetThresholdRequest{ + Environment: "dev", + Threshold: durationpb.New(0), + }); err != nil { + t.Fatalf("unexpected error: %v", err) + } + + if got := srv.GetThreshold("prod"); got != DefaultThreshold { + t.Errorf("got threshold %s for prod, want %s", got, DefaultThreshold) + } +} + +// --- aboveThreshold --- + +func TestAboveThreshold(t *testing.T) { + spans := []*pb.TraceSpan{ + {Name: "slow", Elapsed: durationpb.New(6 * time.Millisecond), Calls: 3}, + {Name: "exactly", Elapsed: durationpb.New(time.Millisecond), Calls: 2}, + {Name: "fast", Elapsed: durationpb.New(250 * time.Microsecond), Calls: 5}, + } + + cases := []struct { + name string + threshold time.Duration + want []string + }{ + {"everything is traced at zero", 0, []string{"slow", "exactly", "fast"}}, + {"the threshold itself is traced", time.Millisecond, []string{"slow", "exactly"}}, + {"a coarse threshold keeps the slowest", 5 * time.Millisecond, []string{"slow"}}, + {"nothing reaches an impossible threshold", time.Hour, nil}, + } + + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + retained, calls := aboveThreshold(spans, c.threshold) + + if len(retained) != len(c.want) { + t.Fatalf("got %d spans, want %d", len(retained), len(c.want)) + } + + for i, name := range c.want { + if retained[i].Name != name { + t.Errorf("got span %q at %d, want %q", retained[i].Name, i, name) + } + } + + // The request made these calls whether or not a span survived the + // threshold, so the count is the same at every threshold. + if calls != 10 { + t.Errorf("got %d calls, want 10", calls) + } + }) + } +} diff --git a/internal/server/mock/trace/set_threshold.go b/internal/server/mock/trace/set_threshold.go new file mode 100644 index 0000000..d894988 --- /dev/null +++ b/internal/server/mock/trace/set_threshold.go @@ -0,0 +1,32 @@ +package trace + +import ( + "context" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/skpr/api/pb" +) + +// SetThreshold sets the minimum call duration which is traced for a specific environment. +func (s *Server) SetThreshold(_ context.Context, req *pb.TraceSetThresholdRequest) (*pb.TraceSetThresholdResponse, error) { + // An omitted threshold is not the same as a zero one: zero traces every call, + // which is expensive enough that a caller has to ask for it rather than get + // it by leaving the field out. + if req.Threshold == nil { + return nil, status.Error(codes.InvalidArgument, "threshold is required") + } + + threshold := req.Threshold.AsDuration() + + // A negative threshold would trace nothing at all, which is not what a caller + // asking for less tracing means. Suspend is how tracing gets turned off. + if threshold < 0 { + return nil, status.Errorf(codes.InvalidArgument, "threshold cannot be negative: %s", threshold) + } + + s.setThreshold(req.Environment, threshold) + + return &pb.TraceSetThresholdResponse{}, nil +} diff --git a/internal/server/mock/trace/stream_traces.go b/internal/server/mock/trace/stream_traces.go index df498b8..56e56a5 100644 --- a/internal/server/mock/trace/stream_traces.go +++ b/internal/server/mock/trace/stream_traces.go @@ -24,36 +24,50 @@ func (s *Server) StreamTraces(req *pb.StreamTracesRequest, server pb.Trace_Strea return status.Errorf(codes.FailedPrecondition, "tracing is suspended for environment: %s", req.Environment) } + threshold := s.GetThreshold(req.Environment) + now := time.Now() // ~6ms realistic function execution time latency := 6 * time.Millisecond - // Function calls generator, placed relative to the start of the request. - makeFunctionCalls := func() []*pb.TraceFunctionCall { - return []*pb.TraceFunctionCall{ + // Spans generator, placed relative to the start of the request. Each span is + // the calls of one function during one slice of the request, so it carries + // how many there were, the longest of them, and what they cost altogether. + makeSpans := func() []*pb.TraceSpan { + return []*pb.TraceSpan{ { Name: "PDOStatement::execute", Offset: durationpb.New(0), Elapsed: durationpb.New(latency), + Total: durationpb.New(3 * latency), + Calls: 3, Memory: 1048576, }, { Name: "Drupal\\Core\\Database\\StatementPrefetchIterator::execute", Offset: durationpb.New(500 * time.Microsecond), Elapsed: durationpb.New(latency), + Total: durationpb.New(2 * latency), + Calls: 2, Memory: 2097152, }, { Name: "Drupal\\sqlite\\Driver\\Database\\sqlite\\Statement::execute", Offset: durationpb.New(1 * time.Millisecond), Elapsed: durationpb.New(latency), + Total: durationpb.New(latency), + Calls: 1, Memory: 524288, }, { + // Below the default threshold, so it only appears for an + // environment which has asked for a finer one. Name: "Drupal\\Core\\Database\\Query\\Upsert::execute", Offset: durationpb.New(1500 * time.Microsecond), - Elapsed: durationpb.New(latency), + Elapsed: durationpb.New(250 * time.Microsecond), + Total: durationpb.New(500 * time.Microsecond), + Calls: 2, Memory: 786432, }, } @@ -93,6 +107,8 @@ func (s *Server) StreamTraces(req *pb.StreamTracesRequest, server pb.Trace_Strea start := now.Add(time.Duration(i*250) * time.Millisecond) end := start.Add(50 * time.Millisecond) + spans, calls := aboveThreshold(makeSpans(), threshold) + traces = append(traces, &pb.Trace{ Metadata: &pb.TraceMetadata{ RequestId: gofakeit.UUID(), @@ -105,8 +121,11 @@ func (s *Server) StreamTraces(req *pb.StreamTracesRequest, server pb.Trace_Strea Uri: "/sites/default/files/styles/scale_crop_7_3_wide/public/veggie-pasta-bake-hero-umami.jpg.webp?itok=CYsHBUlX", }, }, - FunctionCalls: makeFunctionCalls(), - FunctionCallsDropped: 0, + Spans: spans, + // The call count is exact whether or not a span represents the calls, + // so it stays the same no matter where the threshold sits. + Calls: calls, + CallsDropped: 0, ResourceUtilisation: &pb.TraceResourceUtilisation{ MaxMemory: 33554432, }, @@ -123,3 +142,27 @@ func (s *Server) StreamTraces(req *pb.StreamTracesRequest, server pb.Trace_Strea time.Sleep(time.Second) } } + +// aboveThreshold keeps the spans whose longest call ran for at least the +// environment's threshold, which is what the extension's probe does, and returns +// them along with the total number of calls the request made. The call count +// covers every span, including those the threshold filtered out, because the +// request made those calls either way. +func aboveThreshold(spans []*pb.TraceSpan, threshold time.Duration) ([]*pb.TraceSpan, int64) { + var ( + retained []*pb.TraceSpan + calls int64 + ) + + for _, span := range spans { + calls += span.Calls + + if span.Elapsed.AsDuration() < threshold { + continue + } + + retained = append(retained, span) + } + + return retained, calls +} diff --git a/pb/trace.pb.go b/pb/trace.pb.go index 2109ebf..af9d36f 100644 --- a/pb/trace.pb.go +++ b/pb/trace.pb.go @@ -352,6 +352,108 @@ func (*TraceResumeResponse) Descriptor() ([]byte, []int) { return file_trace_proto_rawDescGZIP(), []int{3} } +// * +// Request that the tracing threshold be set for an environment +type TraceSetThresholdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Environment string `protobuf:"bytes,1,opt,name=Environment,proto3" json:"Environment,omitempty"` // Name of the environment + // Minimum duration a function call has to run for before it is traced. + // + // Compass only fires a probe for calls above this, so it is the main control + // over how much a traced environment pays for tracing. A threshold of zero + // traces every call, which is expensive on a busy environment. + Threshold *durationpb.Duration `protobuf:"bytes,2,opt,name=Threshold,proto3" json:"Threshold,omitempty"` +} + +func (x *TraceSetThresholdRequest) Reset() { + *x = TraceSetThresholdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_trace_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TraceSetThresholdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceSetThresholdRequest) ProtoMessage() {} + +func (x *TraceSetThresholdRequest) ProtoReflect() protoreflect.Message { + mi := &file_trace_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TraceSetThresholdRequest.ProtoReflect.Descriptor instead. +func (*TraceSetThresholdRequest) Descriptor() ([]byte, []int) { + return file_trace_proto_rawDescGZIP(), []int{4} +} + +func (x *TraceSetThresholdRequest) GetEnvironment() string { + if x != nil { + return x.Environment + } + return "" +} + +func (x *TraceSetThresholdRequest) GetThreshold() *durationpb.Duration { + if x != nil { + return x.Threshold + } + return nil +} + +// * +// Response if setting the tracing threshold was successful +type TraceSetThresholdResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *TraceSetThresholdResponse) Reset() { + *x = TraceSetThresholdResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_trace_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TraceSetThresholdResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TraceSetThresholdResponse) ProtoMessage() {} + +func (x *TraceSetThresholdResponse) ProtoReflect() protoreflect.Message { + mi := &file_trace_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TraceSetThresholdResponse.ProtoReflect.Descriptor instead. +func (*TraceSetThresholdResponse) Descriptor() ([]byte, []int) { + return file_trace_proto_rawDescGZIP(), []int{5} +} + // * // Input for StreamTraces. type StreamTracesRequest struct { @@ -365,7 +467,7 @@ type StreamTracesRequest struct { func (x *StreamTracesRequest) Reset() { *x = StreamTracesRequest{} if protoimpl.UnsafeEnabled { - mi := &file_trace_proto_msgTypes[4] + mi := &file_trace_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -378,7 +480,7 @@ func (x *StreamTracesRequest) String() string { func (*StreamTracesRequest) ProtoMessage() {} func (x *StreamTracesRequest) ProtoReflect() protoreflect.Message { - mi := &file_trace_proto_msgTypes[4] + mi := &file_trace_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -391,7 +493,7 @@ func (x *StreamTracesRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StreamTracesRequest.ProtoReflect.Descriptor instead. func (*StreamTracesRequest) Descriptor() ([]byte, []int) { - return file_trace_proto_rawDescGZIP(), []int{4} + return file_trace_proto_rawDescGZIP(), []int{6} } func (x *StreamTracesRequest) GetEnvironment() string { @@ -414,7 +516,7 @@ type StreamTracesResponse struct { func (x *StreamTracesResponse) Reset() { *x = StreamTracesResponse{} if protoimpl.UnsafeEnabled { - mi := &file_trace_proto_msgTypes[5] + mi := &file_trace_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -427,7 +529,7 @@ func (x *StreamTracesResponse) String() string { func (*StreamTracesResponse) ProtoMessage() {} func (x *StreamTracesResponse) ProtoReflect() protoreflect.Message { - mi := &file_trace_proto_msgTypes[5] + mi := &file_trace_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -440,7 +542,7 @@ func (x *StreamTracesResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use StreamTracesResponse.ProtoReflect.Descriptor instead. func (*StreamTracesResponse) Descriptor() ([]byte, []int) { - return file_trace_proto_rawDescGZIP(), []int{5} + return file_trace_proto_rawDescGZIP(), []int{7} } func (x *StreamTracesResponse) GetTraces() []*Trace { @@ -457,17 +559,23 @@ type Trace struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Metadata *TraceMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` // Metadata about the trace. - FunctionCalls []*TraceFunctionCall `protobuf:"bytes,2,rep,name=function_calls,json=functionCalls,proto3" json:"function_calls,omitempty"` // List of function calls in the trace. - ResourceUtilisation *TraceResourceUtilisation `protobuf:"bytes,3,opt,name=resource_utilisation,json=resourceUtilisation,proto3" json:"resource_utilisation,omitempty"` // Resources consumed by the request. - Drupal *TraceDrupal `protobuf:"bytes,4,opt,name=drupal,proto3,oneof" json:"drupal,omitempty"` // Drupal specific data. Only populated for PHP traces which called into the Drupal APIs. - FunctionCallsDropped int64 `protobuf:"varint,5,opt,name=function_calls_dropped,json=functionCallsDropped,proto3" json:"function_calls_dropped,omitempty"` // How many function events were not retained because the trace reached its configured limit. Reported so that a truncated trace is not mistaken for a complete one. + Metadata *TraceMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` // Metadata about the trace. + Spans []*TraceSpan `protobuf:"bytes,2,rep,name=spans,proto3" json:"spans,omitempty"` // Function calls made by the request, aggregated into spans. + ResourceUtilisation *TraceResourceUtilisation `protobuf:"bytes,3,opt,name=resource_utilisation,json=resourceUtilisation,proto3" json:"resource_utilisation,omitempty"` // Resources consumed by the request. + Drupal *TraceDrupal `protobuf:"bytes,4,opt,name=drupal,proto3,oneof" json:"drupal,omitempty"` // Drupal specific data. Only populated for PHP traces which called into the Drupal APIs. + // How many function calls the request made, including any which no span + // represents. It is an exact count either way. + Calls int64 `protobuf:"varint,5,opt,name=calls,proto3" json:"calls,omitempty"` + // How many of those calls no span represents, because the trace had already + // reached its span limit when they arrived. Reported so that a truncated + // trace is not mistaken for a complete one. + CallsDropped int64 `protobuf:"varint,6,opt,name=calls_dropped,json=callsDropped,proto3" json:"calls_dropped,omitempty"` } func (x *Trace) Reset() { *x = Trace{} if protoimpl.UnsafeEnabled { - mi := &file_trace_proto_msgTypes[6] + mi := &file_trace_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -480,7 +588,7 @@ func (x *Trace) String() string { func (*Trace) ProtoMessage() {} func (x *Trace) ProtoReflect() protoreflect.Message { - mi := &file_trace_proto_msgTypes[6] + mi := &file_trace_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -493,7 +601,7 @@ func (x *Trace) ProtoReflect() protoreflect.Message { // Deprecated: Use Trace.ProtoReflect.Descriptor instead. func (*Trace) Descriptor() ([]byte, []int) { - return file_trace_proto_rawDescGZIP(), []int{6} + return file_trace_proto_rawDescGZIP(), []int{8} } func (x *Trace) GetMetadata() *TraceMetadata { @@ -503,9 +611,9 @@ func (x *Trace) GetMetadata() *TraceMetadata { return nil } -func (x *Trace) GetFunctionCalls() []*TraceFunctionCall { +func (x *Trace) GetSpans() []*TraceSpan { if x != nil { - return x.FunctionCalls + return x.Spans } return nil } @@ -524,9 +632,16 @@ func (x *Trace) GetDrupal() *TraceDrupal { return nil } -func (x *Trace) GetFunctionCallsDropped() int64 { +func (x *Trace) GetCalls() int64 { + if x != nil { + return x.Calls + } + return 0 +} + +func (x *Trace) GetCallsDropped() int64 { if x != nil { - return x.FunctionCallsDropped + return x.CallsDropped } return 0 } @@ -556,7 +671,7 @@ type TraceMetadata struct { func (x *TraceMetadata) Reset() { *x = TraceMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_trace_proto_msgTypes[7] + mi := &file_trace_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -569,7 +684,7 @@ func (x *TraceMetadata) String() string { func (*TraceMetadata) ProtoMessage() {} func (x *TraceMetadata) ProtoReflect() protoreflect.Message { - mi := &file_trace_proto_msgTypes[7] + mi := &file_trace_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -582,7 +697,7 @@ func (x *TraceMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use TraceMetadata.ProtoReflect.Descriptor instead. func (*TraceMetadata) Descriptor() ([]byte, []int) { - return file_trace_proto_rawDescGZIP(), []int{7} + return file_trace_proto_rawDescGZIP(), []int{9} } func (x *TraceMetadata) GetRequestId() string { @@ -648,7 +763,7 @@ type TraceMetadataHTTP struct { func (x *TraceMetadataHTTP) Reset() { *x = TraceMetadataHTTP{} if protoimpl.UnsafeEnabled { - mi := &file_trace_proto_msgTypes[8] + mi := &file_trace_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -661,7 +776,7 @@ func (x *TraceMetadataHTTP) String() string { func (*TraceMetadataHTTP) ProtoMessage() {} func (x *TraceMetadataHTTP) ProtoReflect() protoreflect.Message { - mi := &file_trace_proto_msgTypes[8] + mi := &file_trace_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -674,7 +789,7 @@ func (x *TraceMetadataHTTP) ProtoReflect() protoreflect.Message { // Deprecated: Use TraceMetadataHTTP.ProtoReflect.Descriptor instead. func (*TraceMetadataHTTP) Descriptor() ([]byte, []int) { - return file_trace_proto_rawDescGZIP(), []int{8} + return file_trace_proto_rawDescGZIP(), []int{10} } func (x *TraceMetadataHTTP) GetMethod() string { @@ -704,7 +819,7 @@ type TraceMetadataCLI struct { func (x *TraceMetadataCLI) Reset() { *x = TraceMetadataCLI{} if protoimpl.UnsafeEnabled { - mi := &file_trace_proto_msgTypes[9] + mi := &file_trace_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -717,7 +832,7 @@ func (x *TraceMetadataCLI) String() string { func (*TraceMetadataCLI) ProtoMessage() {} func (x *TraceMetadataCLI) ProtoReflect() protoreflect.Message { - mi := &file_trace_proto_msgTypes[9] + mi := &file_trace_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -730,7 +845,7 @@ func (x *TraceMetadataCLI) ProtoReflect() protoreflect.Message { // Deprecated: Use TraceMetadataCLI.ProtoReflect.Descriptor instead. func (*TraceMetadataCLI) Descriptor() ([]byte, []int) { - return file_trace_proto_rawDescGZIP(), []int{9} + return file_trace_proto_rawDescGZIP(), []int{11} } func (x *TraceMetadataCLI) GetCommand() string { @@ -753,7 +868,7 @@ type TraceResourceUtilisation struct { func (x *TraceResourceUtilisation) Reset() { *x = TraceResourceUtilisation{} if protoimpl.UnsafeEnabled { - mi := &file_trace_proto_msgTypes[10] + mi := &file_trace_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -766,7 +881,7 @@ func (x *TraceResourceUtilisation) String() string { func (*TraceResourceUtilisation) ProtoMessage() {} func (x *TraceResourceUtilisation) ProtoReflect() protoreflect.Message { - mi := &file_trace_proto_msgTypes[10] + mi := &file_trace_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -779,7 +894,7 @@ func (x *TraceResourceUtilisation) ProtoReflect() protoreflect.Message { // Deprecated: Use TraceResourceUtilisation.ProtoReflect.Descriptor instead. func (*TraceResourceUtilisation) Descriptor() ([]byte, []int) { - return file_trace_proto_rawDescGZIP(), []int{10} + return file_trace_proto_rawDescGZIP(), []int{12} } func (x *TraceResourceUtilisation) GetMaxMemory() int64 { @@ -790,35 +905,47 @@ func (x *TraceResourceUtilisation) GetMaxMemory() int64 { } // * -// Function call data within a trace. -type TraceFunctionCall struct { +// The calls of one function during one slice of a request. +// +// A request can make more than a million function calls, and no reader looks at +// those one at a time: what a reader asks of a trace is where the time went, +// which is an aggregate. Compass collects calls into spans as their events +// arrive, which is what lets a trace of a million calls stay a few hundred +// kilobytes. +// +// A span is placed by how far into the request it started rather than by the +// instant it started at, because an absolute time says nothing on its own - +// every consumer immediately subtracts the request start to get back to this. +type TraceSpan struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Name of the function being traced. - Offset *durationpb.Duration `protobuf:"bytes,2,opt,name=offset,proto3" json:"offset,omitempty"` // Offset from the start of the request at which the call began. - Elapsed *durationpb.Duration `protobuf:"bytes,3,opt,name=elapsed,proto3" json:"elapsed,omitempty"` // How long the call ran for. - Memory int64 `protobuf:"varint,4,opt,name=memory,proto3" json:"memory,omitempty"` // Memory used by the call, in bytes. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Name of the function which was called. + Offset *durationpb.Duration `protobuf:"bytes,2,opt,name=offset,proto3" json:"offset,omitempty"` // Offset from the start of the request at which the earliest call in this span began. + Elapsed *durationpb.Duration `protobuf:"bytes,3,opt,name=elapsed,proto3" json:"elapsed,omitempty"` // How long the longest single call in this span ran for. + Total *durationpb.Duration `protobuf:"bytes,4,opt,name=total,proto3" json:"total,omitempty"` // How long the calls in this span ran for altogether. Exceeds the request duration where a function called its way back into itself. + Calls int64 `protobuf:"varint,5,opt,name=calls,proto3" json:"calls,omitempty"` // How many calls were aggregated into this span. + Memory int64 `protobuf:"varint,6,opt,name=memory,proto3" json:"memory,omitempty"` // The highest memory reported by any call in this span, in bytes. } -func (x *TraceFunctionCall) Reset() { - *x = TraceFunctionCall{} +func (x *TraceSpan) Reset() { + *x = TraceSpan{} if protoimpl.UnsafeEnabled { - mi := &file_trace_proto_msgTypes[11] + mi := &file_trace_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *TraceFunctionCall) String() string { +func (x *TraceSpan) String() string { return protoimpl.X.MessageStringOf(x) } -func (*TraceFunctionCall) ProtoMessage() {} +func (*TraceSpan) ProtoMessage() {} -func (x *TraceFunctionCall) ProtoReflect() protoreflect.Message { - mi := &file_trace_proto_msgTypes[11] +func (x *TraceSpan) ProtoReflect() protoreflect.Message { + mi := &file_trace_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -829,33 +956,47 @@ func (x *TraceFunctionCall) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use TraceFunctionCall.ProtoReflect.Descriptor instead. -func (*TraceFunctionCall) Descriptor() ([]byte, []int) { - return file_trace_proto_rawDescGZIP(), []int{11} +// Deprecated: Use TraceSpan.ProtoReflect.Descriptor instead. +func (*TraceSpan) Descriptor() ([]byte, []int) { + return file_trace_proto_rawDescGZIP(), []int{13} } -func (x *TraceFunctionCall) GetName() string { +func (x *TraceSpan) GetName() string { if x != nil { return x.Name } return "" } -func (x *TraceFunctionCall) GetOffset() *durationpb.Duration { +func (x *TraceSpan) GetOffset() *durationpb.Duration { if x != nil { return x.Offset } return nil } -func (x *TraceFunctionCall) GetElapsed() *durationpb.Duration { +func (x *TraceSpan) GetElapsed() *durationpb.Duration { if x != nil { return x.Elapsed } return nil } -func (x *TraceFunctionCall) GetMemory() int64 { +func (x *TraceSpan) GetTotal() *durationpb.Duration { + if x != nil { + return x.Total + } + return nil +} + +func (x *TraceSpan) GetCalls() int64 { + if x != nil { + return x.Calls + } + return 0 +} + +func (x *TraceSpan) GetMemory() int64 { if x != nil { return x.Memory } @@ -880,7 +1021,7 @@ type TraceDrupal struct { func (x *TraceDrupal) Reset() { *x = TraceDrupal{} if protoimpl.UnsafeEnabled { - mi := &file_trace_proto_msgTypes[12] + mi := &file_trace_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -893,7 +1034,7 @@ func (x *TraceDrupal) String() string { func (*TraceDrupal) ProtoMessage() {} func (x *TraceDrupal) ProtoReflect() protoreflect.Message { - mi := &file_trace_proto_msgTypes[12] + mi := &file_trace_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -906,7 +1047,7 @@ func (x *TraceDrupal) ProtoReflect() protoreflect.Message { // Deprecated: Use TraceDrupal.ProtoReflect.Descriptor instead. func (*TraceDrupal) Descriptor() ([]byte, []int) { - return file_trace_proto_rawDescGZIP(), []int{12} + return file_trace_proto_rawDescGZIP(), []int{14} } func (x *TraceDrupal) GetCacheEvents() []*TraceDrupalCacheEvent { @@ -947,7 +1088,7 @@ type TraceDrupalCacheEvent struct { func (x *TraceDrupalCacheEvent) Reset() { *x = TraceDrupalCacheEvent{} if protoimpl.UnsafeEnabled { - mi := &file_trace_proto_msgTypes[13] + mi := &file_trace_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -960,7 +1101,7 @@ func (x *TraceDrupalCacheEvent) String() string { func (*TraceDrupalCacheEvent) ProtoMessage() {} func (x *TraceDrupalCacheEvent) ProtoReflect() protoreflect.Message { - mi := &file_trace_proto_msgTypes[13] + mi := &file_trace_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -973,7 +1114,7 @@ func (x *TraceDrupalCacheEvent) ProtoReflect() protoreflect.Message { // Deprecated: Use TraceDrupalCacheEvent.ProtoReflect.Descriptor instead. func (*TraceDrupalCacheEvent) Descriptor() ([]byte, []int) { - return file_trace_proto_rawDescGZIP(), []int{13} + return file_trace_proto_rawDescGZIP(), []int{15} } func (x *TraceDrupalCacheEvent) GetOrigin() TraceDrupalCacheOrigin { @@ -1050,34 +1191,42 @@ var file_trace_proto_rawDesc = []byte{ 0x20, 0x0a, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x15, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x0a, 0x13, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x20, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, - 0x74, 0x22, 0x3f, 0x0a, 0x14, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x65, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x06, 0x54, 0x72, 0x61, - 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, - 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x06, 0x54, 0x72, 0x61, 0x63, - 0x65, 0x73, 0x22, 0xcc, 0x02, 0x0a, 0x05, 0x54, 0x72, 0x61, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x08, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, - 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x12, 0x42, 0x0a, 0x0e, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, - 0x6c, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x77, 0x6f, 0x72, 0x6b, - 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x0d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x12, 0x55, 0x0a, 0x14, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x5f, 0x75, 0x74, 0x69, 0x6c, 0x69, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, - 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x74, 0x69, 0x6c, - 0x69, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x13, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x55, 0x74, 0x69, 0x6c, 0x69, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x0a, 0x06, - 0x64, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x77, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x44, 0x72, 0x75, - 0x70, 0x61, 0x6c, 0x48, 0x00, 0x52, 0x06, 0x64, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x88, 0x01, 0x01, - 0x12, 0x34, 0x0a, 0x16, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x61, 0x6c, - 0x6c, 0x73, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x14, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x44, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x75, 0x0a, 0x18, 0x54, 0x72, 0x61, 0x63, + 0x65, 0x53, 0x65, 0x74, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x6e, 0x76, 0x69, 0x72, + 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x09, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, + 0x6f, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x22, + 0x1b, 0x0a, 0x19, 0x54, 0x72, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x54, 0x68, 0x72, 0x65, 0x73, + 0x68, 0x6f, 0x6c, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x37, 0x0a, 0x13, + 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, + 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x3f, 0x0a, 0x14, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, + 0x72, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, + 0x06, 0x54, 0x72, 0x61, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, + 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x06, + 0x54, 0x72, 0x61, 0x63, 0x65, 0x73, 0x22, 0xb8, 0x02, 0x0a, 0x05, 0x54, 0x72, 0x61, 0x63, 0x65, + 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, + 0x61, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x29, 0x0a, 0x05, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, + 0x54, 0x72, 0x61, 0x63, 0x65, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x05, 0x73, 0x70, 0x61, 0x6e, 0x73, + 0x12, 0x55, 0x0a, 0x14, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x75, 0x74, 0x69, + 0x6c, 0x69, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x74, 0x69, 0x6c, 0x69, 0x73, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x13, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x74, 0x69, 0x6c, + 0x69, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x32, 0x0a, 0x06, 0x64, 0x72, 0x75, 0x70, 0x61, + 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, + 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x44, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x48, 0x00, + 0x52, 0x06, 0x64, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x14, 0x0a, 0x05, 0x63, + 0x61, 0x6c, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x61, 0x6c, 0x6c, + 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x70, + 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x44, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x64, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x22, 0xfb, 0x02, 0x0a, 0x0d, 0x54, 0x72, 0x61, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x69, @@ -1113,81 +1262,91 @@ var file_trace_proto_rawDesc = []byte{ 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x55, 0x74, 0x69, 0x6c, 0x69, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6d, 0x61, - 0x78, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x22, 0xa7, 0x01, 0x0a, 0x11, 0x54, 0x72, 0x61, 0x63, - 0x65, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x31, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x12, 0x33, 0x0a, 0x07, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x07, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, - 0x6f, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, - 0x79, 0x22, 0x83, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x63, 0x65, 0x44, 0x72, 0x75, 0x70, 0x61, - 0x6c, 0x12, 0x42, 0x0a, 0x0c, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, - 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x44, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x43, 0x61, - 0x63, 0x68, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x0b, 0x63, 0x61, 0x63, 0x68, 0x65, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x65, - 0x76, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x12, 0x63, 0x61, 0x63, 0x68, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, - 0x44, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x22, 0x9c, 0x02, 0x0a, 0x15, 0x54, 0x72, 0x61, 0x63, - 0x65, 0x44, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x43, 0x61, 0x63, 0x68, 0x65, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x12, 0x38, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x20, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, - 0x63, 0x65, 0x44, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x63, - 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x6c, - 0x6c, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x61, 0x78, 0x41, 0x67, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, - 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x18, 0x06, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x12, 0x31, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x78, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x22, 0xe6, 0x01, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x63, + 0x65, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x33, 0x0a, 0x07, + 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x12, 0x14, 0x0a, 0x05, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x05, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2a, 0x58, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x63, 0x65, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x53, - 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x4f, 0x55, - 0x52, 0x43, 0x45, 0x5f, 0x48, 0x54, 0x54, 0x50, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x52, - 0x41, 0x43, 0x45, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x43, 0x4c, 0x49, 0x10, 0x02, - 0x2a, 0x5c, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, - 0x12, 0x1d, 0x0a, 0x19, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, - 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x15, 0x0a, 0x11, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, - 0x5f, 0x50, 0x48, 0x50, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, - 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x5f, 0x4e, 0x4f, 0x44, 0x45, 0x10, 0x02, 0x2a, 0x95, - 0x01, 0x0a, 0x16, 0x54, 0x72, 0x61, 0x63, 0x65, 0x44, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x43, 0x61, - 0x63, 0x68, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x29, 0x0a, 0x25, 0x54, 0x52, 0x41, - 0x43, 0x45, 0x5f, 0x44, 0x52, 0x55, 0x50, 0x41, 0x4c, 0x5f, 0x43, 0x41, 0x43, 0x48, 0x45, 0x5f, - 0x4f, 0x52, 0x49, 0x47, 0x49, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x2a, 0x0a, 0x26, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x44, 0x52, - 0x55, 0x50, 0x41, 0x4c, 0x5f, 0x43, 0x41, 0x43, 0x48, 0x45, 0x5f, 0x4f, 0x52, 0x49, 0x47, 0x49, - 0x4e, 0x5f, 0x52, 0x45, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x01, - 0x12, 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x44, 0x52, 0x55, 0x50, 0x41, 0x4c, - 0x5f, 0x43, 0x41, 0x43, 0x48, 0x45, 0x5f, 0x4f, 0x52, 0x49, 0x47, 0x49, 0x4e, 0x5f, 0x4f, 0x42, - 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x32, 0xef, 0x01, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, - 0x12, 0x4a, 0x0a, 0x07, 0x53, 0x75, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x12, 0x1d, 0x2e, 0x77, 0x6f, - 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x53, 0x75, 0x73, 0x70, - 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x77, 0x6f, 0x72, + 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, + 0x64, 0x12, 0x2f, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x05, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, + 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, + 0x22, 0x83, 0x01, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x63, 0x65, 0x44, 0x72, 0x75, 0x70, 0x61, 0x6c, + 0x12, 0x42, 0x0a, 0x0c, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, + 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x44, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x43, 0x61, 0x63, + 0x68, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x0b, 0x63, 0x61, 0x63, 0x68, 0x65, 0x45, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x12, 0x63, 0x61, 0x63, 0x68, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x44, + 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x22, 0x9c, 0x02, 0x0a, 0x15, 0x54, 0x72, 0x61, 0x63, 0x65, + 0x44, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x43, 0x61, 0x63, 0x68, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x12, 0x38, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x20, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, + 0x65, 0x44, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, + 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x6c, 0x6c, + 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x61, 0x78, 0x41, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, + 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x12, 0x31, 0x0a, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, + 0x14, 0x0a, 0x05, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x2a, 0x58, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x63, 0x65, 0x53, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x4f, + 0x55, 0x52, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x53, 0x4f, 0x55, 0x52, + 0x43, 0x45, 0x5f, 0x48, 0x54, 0x54, 0x50, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x52, 0x41, + 0x43, 0x45, 0x5f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x43, 0x4c, 0x49, 0x10, 0x02, 0x2a, + 0x5c, 0x0a, 0x0c, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x12, + 0x1d, 0x0a, 0x19, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, + 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, + 0x0a, 0x11, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x5f, + 0x50, 0x48, 0x50, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x52, + 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x5f, 0x4e, 0x4f, 0x44, 0x45, 0x10, 0x02, 0x2a, 0x95, 0x01, + 0x0a, 0x16, 0x54, 0x72, 0x61, 0x63, 0x65, 0x44, 0x72, 0x75, 0x70, 0x61, 0x6c, 0x43, 0x61, 0x63, + 0x68, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x29, 0x0a, 0x25, 0x54, 0x52, 0x41, 0x43, + 0x45, 0x5f, 0x44, 0x52, 0x55, 0x50, 0x41, 0x4c, 0x5f, 0x43, 0x41, 0x43, 0x48, 0x45, 0x5f, 0x4f, + 0x52, 0x49, 0x47, 0x49, 0x4e, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x2a, 0x0a, 0x26, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x44, 0x52, 0x55, + 0x50, 0x41, 0x4c, 0x5f, 0x43, 0x41, 0x43, 0x48, 0x45, 0x5f, 0x4f, 0x52, 0x49, 0x47, 0x49, 0x4e, + 0x5f, 0x52, 0x45, 0x4e, 0x44, 0x45, 0x52, 0x5f, 0x41, 0x52, 0x52, 0x41, 0x59, 0x10, 0x01, 0x12, + 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x44, 0x52, 0x55, 0x50, 0x41, 0x4c, 0x5f, + 0x43, 0x41, 0x43, 0x48, 0x45, 0x5f, 0x4f, 0x52, 0x49, 0x47, 0x49, 0x4e, 0x5f, 0x4f, 0x42, 0x4a, + 0x45, 0x43, 0x54, 0x10, 0x02, 0x32, 0xca, 0x02, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x12, + 0x4a, 0x0a, 0x07, 0x53, 0x75, 0x73, 0x70, 0x65, 0x6e, 0x64, 0x12, 0x1d, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x53, 0x75, 0x73, 0x70, 0x65, - 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x06, - 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, - 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, - 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x51, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, - 0x72, 0x61, 0x63, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, - 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x77, 0x6f, 0x72, 0x6b, + 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x53, 0x75, 0x73, 0x70, 0x65, 0x6e, + 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x06, 0x52, + 0x65, 0x73, 0x75, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x54, + 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x59, 0x0a, 0x0c, 0x53, 0x65, 0x74, 0x54, 0x68, 0x72, 0x65, 0x73, + 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x22, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, + 0x54, 0x72, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x54, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, + 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x53, 0x65, 0x74, 0x54, 0x68, 0x72, 0x65, + 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x51, 0x0a, 0x0c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x54, 0x72, 0x61, 0x63, 0x65, 0x73, 0x12, + 0x1d, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, + 0x6d, 0x54, 0x72, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, + 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, + 0x54, 0x72, 0x61, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x30, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -1203,56 +1362,62 @@ func file_trace_proto_rawDescGZIP() []byte { } var file_trace_proto_enumTypes = make([]protoimpl.EnumInfo, 3) -var file_trace_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_trace_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_trace_proto_goTypes = []interface{}{ - (TraceSource)(0), // 0: workflow.TraceSource - (TraceRuntime)(0), // 1: workflow.TraceRuntime - (TraceDrupalCacheOrigin)(0), // 2: workflow.TraceDrupalCacheOrigin - (*TraceSuspendRequest)(nil), // 3: workflow.TraceSuspendRequest - (*TraceSuspendResponse)(nil), // 4: workflow.TraceSuspendResponse - (*TraceResumeRequest)(nil), // 5: workflow.TraceResumeRequest - (*TraceResumeResponse)(nil), // 6: workflow.TraceResumeResponse - (*StreamTracesRequest)(nil), // 7: workflow.StreamTracesRequest - (*StreamTracesResponse)(nil), // 8: workflow.StreamTracesResponse - (*Trace)(nil), // 9: workflow.Trace - (*TraceMetadata)(nil), // 10: workflow.TraceMetadata - (*TraceMetadataHTTP)(nil), // 11: workflow.TraceMetadataHTTP - (*TraceMetadataCLI)(nil), // 12: workflow.TraceMetadataCLI - (*TraceResourceUtilisation)(nil), // 13: workflow.TraceResourceUtilisation - (*TraceFunctionCall)(nil), // 14: workflow.TraceFunctionCall - (*TraceDrupal)(nil), // 15: workflow.TraceDrupal - (*TraceDrupalCacheEvent)(nil), // 16: workflow.TraceDrupalCacheEvent - (*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp - (*durationpb.Duration)(nil), // 18: google.protobuf.Duration + (TraceSource)(0), // 0: workflow.TraceSource + (TraceRuntime)(0), // 1: workflow.TraceRuntime + (TraceDrupalCacheOrigin)(0), // 2: workflow.TraceDrupalCacheOrigin + (*TraceSuspendRequest)(nil), // 3: workflow.TraceSuspendRequest + (*TraceSuspendResponse)(nil), // 4: workflow.TraceSuspendResponse + (*TraceResumeRequest)(nil), // 5: workflow.TraceResumeRequest + (*TraceResumeResponse)(nil), // 6: workflow.TraceResumeResponse + (*TraceSetThresholdRequest)(nil), // 7: workflow.TraceSetThresholdRequest + (*TraceSetThresholdResponse)(nil), // 8: workflow.TraceSetThresholdResponse + (*StreamTracesRequest)(nil), // 9: workflow.StreamTracesRequest + (*StreamTracesResponse)(nil), // 10: workflow.StreamTracesResponse + (*Trace)(nil), // 11: workflow.Trace + (*TraceMetadata)(nil), // 12: workflow.TraceMetadata + (*TraceMetadataHTTP)(nil), // 13: workflow.TraceMetadataHTTP + (*TraceMetadataCLI)(nil), // 14: workflow.TraceMetadataCLI + (*TraceResourceUtilisation)(nil), // 15: workflow.TraceResourceUtilisation + (*TraceSpan)(nil), // 16: workflow.TraceSpan + (*TraceDrupal)(nil), // 17: workflow.TraceDrupal + (*TraceDrupalCacheEvent)(nil), // 18: workflow.TraceDrupalCacheEvent + (*durationpb.Duration)(nil), // 19: google.protobuf.Duration + (*timestamppb.Timestamp)(nil), // 20: google.protobuf.Timestamp } var file_trace_proto_depIdxs = []int32{ - 9, // 0: workflow.StreamTracesResponse.Traces:type_name -> workflow.Trace - 10, // 1: workflow.Trace.metadata:type_name -> workflow.TraceMetadata - 14, // 2: workflow.Trace.function_calls:type_name -> workflow.TraceFunctionCall - 13, // 3: workflow.Trace.resource_utilisation:type_name -> workflow.TraceResourceUtilisation - 15, // 4: workflow.Trace.drupal:type_name -> workflow.TraceDrupal - 17, // 5: workflow.TraceMetadata.start_time:type_name -> google.protobuf.Timestamp - 17, // 6: workflow.TraceMetadata.end_time:type_name -> google.protobuf.Timestamp - 0, // 7: workflow.TraceMetadata.source:type_name -> workflow.TraceSource - 1, // 8: workflow.TraceMetadata.runtime:type_name -> workflow.TraceRuntime - 11, // 9: workflow.TraceMetadata.http:type_name -> workflow.TraceMetadataHTTP - 12, // 10: workflow.TraceMetadata.cli:type_name -> workflow.TraceMetadataCLI - 18, // 11: workflow.TraceFunctionCall.offset:type_name -> google.protobuf.Duration - 18, // 12: workflow.TraceFunctionCall.elapsed:type_name -> google.protobuf.Duration - 16, // 13: workflow.TraceDrupal.cache_events:type_name -> workflow.TraceDrupalCacheEvent - 2, // 14: workflow.TraceDrupalCacheEvent.origin:type_name -> workflow.TraceDrupalCacheOrigin - 18, // 15: workflow.TraceDrupalCacheEvent.offset:type_name -> google.protobuf.Duration - 3, // 16: workflow.trace.Suspend:input_type -> workflow.TraceSuspendRequest - 5, // 17: workflow.trace.Resume:input_type -> workflow.TraceResumeRequest - 7, // 18: workflow.trace.StreamTraces:input_type -> workflow.StreamTracesRequest - 4, // 19: workflow.trace.Suspend:output_type -> workflow.TraceSuspendResponse - 6, // 20: workflow.trace.Resume:output_type -> workflow.TraceResumeResponse - 8, // 21: workflow.trace.StreamTraces:output_type -> workflow.StreamTracesResponse - 19, // [19:22] is the sub-list for method output_type - 16, // [16:19] is the sub-list for method input_type - 16, // [16:16] is the sub-list for extension type_name - 16, // [16:16] is the sub-list for extension extendee - 0, // [0:16] is the sub-list for field type_name + 19, // 0: workflow.TraceSetThresholdRequest.Threshold:type_name -> google.protobuf.Duration + 11, // 1: workflow.StreamTracesResponse.Traces:type_name -> workflow.Trace + 12, // 2: workflow.Trace.metadata:type_name -> workflow.TraceMetadata + 16, // 3: workflow.Trace.spans:type_name -> workflow.TraceSpan + 15, // 4: workflow.Trace.resource_utilisation:type_name -> workflow.TraceResourceUtilisation + 17, // 5: workflow.Trace.drupal:type_name -> workflow.TraceDrupal + 20, // 6: workflow.TraceMetadata.start_time:type_name -> google.protobuf.Timestamp + 20, // 7: workflow.TraceMetadata.end_time:type_name -> google.protobuf.Timestamp + 0, // 8: workflow.TraceMetadata.source:type_name -> workflow.TraceSource + 1, // 9: workflow.TraceMetadata.runtime:type_name -> workflow.TraceRuntime + 13, // 10: workflow.TraceMetadata.http:type_name -> workflow.TraceMetadataHTTP + 14, // 11: workflow.TraceMetadata.cli:type_name -> workflow.TraceMetadataCLI + 19, // 12: workflow.TraceSpan.offset:type_name -> google.protobuf.Duration + 19, // 13: workflow.TraceSpan.elapsed:type_name -> google.protobuf.Duration + 19, // 14: workflow.TraceSpan.total:type_name -> google.protobuf.Duration + 18, // 15: workflow.TraceDrupal.cache_events:type_name -> workflow.TraceDrupalCacheEvent + 2, // 16: workflow.TraceDrupalCacheEvent.origin:type_name -> workflow.TraceDrupalCacheOrigin + 19, // 17: workflow.TraceDrupalCacheEvent.offset:type_name -> google.protobuf.Duration + 3, // 18: workflow.trace.Suspend:input_type -> workflow.TraceSuspendRequest + 5, // 19: workflow.trace.Resume:input_type -> workflow.TraceResumeRequest + 7, // 20: workflow.trace.SetThreshold:input_type -> workflow.TraceSetThresholdRequest + 9, // 21: workflow.trace.StreamTraces:input_type -> workflow.StreamTracesRequest + 4, // 22: workflow.trace.Suspend:output_type -> workflow.TraceSuspendResponse + 6, // 23: workflow.trace.Resume:output_type -> workflow.TraceResumeResponse + 8, // 24: workflow.trace.SetThreshold:output_type -> workflow.TraceSetThresholdResponse + 10, // 25: workflow.trace.StreamTraces:output_type -> workflow.StreamTracesResponse + 22, // [22:26] is the sub-list for method output_type + 18, // [18:22] is the sub-list for method input_type + 18, // [18:18] is the sub-list for extension type_name + 18, // [18:18] is the sub-list for extension extendee + 0, // [0:18] is the sub-list for field type_name } func init() { file_trace_proto_init() } @@ -1310,7 +1475,7 @@ func file_trace_proto_init() { } } file_trace_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamTracesRequest); i { + switch v := v.(*TraceSetThresholdRequest); i { case 0: return &v.state case 1: @@ -1322,7 +1487,7 @@ func file_trace_proto_init() { } } file_trace_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamTracesResponse); i { + switch v := v.(*TraceSetThresholdResponse); i { case 0: return &v.state case 1: @@ -1334,7 +1499,7 @@ func file_trace_proto_init() { } } file_trace_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Trace); i { + switch v := v.(*StreamTracesRequest); i { case 0: return &v.state case 1: @@ -1346,7 +1511,7 @@ func file_trace_proto_init() { } } file_trace_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TraceMetadata); i { + switch v := v.(*StreamTracesResponse); i { case 0: return &v.state case 1: @@ -1358,7 +1523,7 @@ func file_trace_proto_init() { } } file_trace_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TraceMetadataHTTP); i { + switch v := v.(*Trace); i { case 0: return &v.state case 1: @@ -1370,7 +1535,7 @@ func file_trace_proto_init() { } } file_trace_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TraceMetadataCLI); i { + switch v := v.(*TraceMetadata); i { case 0: return &v.state case 1: @@ -1382,7 +1547,7 @@ func file_trace_proto_init() { } } file_trace_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TraceResourceUtilisation); i { + switch v := v.(*TraceMetadataHTTP); i { case 0: return &v.state case 1: @@ -1394,7 +1559,7 @@ func file_trace_proto_init() { } } file_trace_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TraceFunctionCall); i { + switch v := v.(*TraceMetadataCLI); i { case 0: return &v.state case 1: @@ -1406,7 +1571,7 @@ func file_trace_proto_init() { } } file_trace_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TraceDrupal); i { + switch v := v.(*TraceResourceUtilisation); i { case 0: return &v.state case 1: @@ -1418,6 +1583,30 @@ func file_trace_proto_init() { } } file_trace_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TraceSpan); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trace_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TraceDrupal); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_trace_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TraceDrupalCacheEvent); i { case 0: return &v.state @@ -1430,15 +1619,15 @@ func file_trace_proto_init() { } } } - file_trace_proto_msgTypes[6].OneofWrappers = []interface{}{} - file_trace_proto_msgTypes[7].OneofWrappers = []interface{}{} + file_trace_proto_msgTypes[8].OneofWrappers = []interface{}{} + file_trace_proto_msgTypes[9].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_trace_proto_rawDesc, NumEnums: 3, - NumMessages: 14, + NumMessages: 16, NumExtensions: 0, NumServices: 1, }, diff --git a/pb/trace_grpc.pb.go b/pb/trace_grpc.pb.go index 8276326..6f59266 100644 --- a/pb/trace_grpc.pb.go +++ b/pb/trace_grpc.pb.go @@ -24,6 +24,7 @@ const _ = grpc.SupportPackageIsVersion7 type TraceClient interface { Suspend(ctx context.Context, in *TraceSuspendRequest, opts ...grpc.CallOption) (*TraceSuspendResponse, error) Resume(ctx context.Context, in *TraceResumeRequest, opts ...grpc.CallOption) (*TraceResumeResponse, error) + SetThreshold(ctx context.Context, in *TraceSetThresholdRequest, opts ...grpc.CallOption) (*TraceSetThresholdResponse, error) StreamTraces(ctx context.Context, in *StreamTracesRequest, opts ...grpc.CallOption) (Trace_StreamTracesClient, error) } @@ -53,6 +54,15 @@ func (c *traceClient) Resume(ctx context.Context, in *TraceResumeRequest, opts . return out, nil } +func (c *traceClient) SetThreshold(ctx context.Context, in *TraceSetThresholdRequest, opts ...grpc.CallOption) (*TraceSetThresholdResponse, error) { + out := new(TraceSetThresholdResponse) + err := c.cc.Invoke(ctx, "/workflow.trace/SetThreshold", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *traceClient) StreamTraces(ctx context.Context, in *StreamTracesRequest, opts ...grpc.CallOption) (Trace_StreamTracesClient, error) { stream, err := c.cc.NewStream(ctx, &Trace_ServiceDesc.Streams[0], "/workflow.trace/StreamTraces", opts...) if err != nil { @@ -91,6 +101,7 @@ func (x *traceStreamTracesClient) Recv() (*StreamTracesResponse, error) { type TraceServer interface { Suspend(context.Context, *TraceSuspendRequest) (*TraceSuspendResponse, error) Resume(context.Context, *TraceResumeRequest) (*TraceResumeResponse, error) + SetThreshold(context.Context, *TraceSetThresholdRequest) (*TraceSetThresholdResponse, error) StreamTraces(*StreamTracesRequest, Trace_StreamTracesServer) error mustEmbedUnimplementedTraceServer() } @@ -105,6 +116,9 @@ func (UnimplementedTraceServer) Suspend(context.Context, *TraceSuspendRequest) ( func (UnimplementedTraceServer) Resume(context.Context, *TraceResumeRequest) (*TraceResumeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Resume not implemented") } +func (UnimplementedTraceServer) SetThreshold(context.Context, *TraceSetThresholdRequest) (*TraceSetThresholdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetThreshold not implemented") +} func (UnimplementedTraceServer) StreamTraces(*StreamTracesRequest, Trace_StreamTracesServer) error { return status.Errorf(codes.Unimplemented, "method StreamTraces not implemented") } @@ -157,6 +171,24 @@ func _Trace_Resume_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Trace_SetThreshold_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TraceSetThresholdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TraceServer).SetThreshold(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/workflow.trace/SetThreshold", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TraceServer).SetThreshold(ctx, req.(*TraceSetThresholdRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Trace_StreamTraces_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(StreamTracesRequest) if err := stream.RecvMsg(m); err != nil { @@ -193,6 +225,10 @@ var Trace_ServiceDesc = grpc.ServiceDesc{ MethodName: "Resume", Handler: _Trace_Resume_Handler, }, + { + MethodName: "SetThreshold", + Handler: _Trace_SetThreshold_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/trace.proto b/trace.proto index 30ca317..1fda9ad 100644 --- a/trace.proto +++ b/trace.proto @@ -11,6 +11,7 @@ option go_package = "./pb"; service trace { rpc Suspend (TraceSuspendRequest) returns (TraceSuspendResponse) {} rpc Resume (TraceResumeRequest) returns (TraceResumeResponse) {} + rpc SetThreshold (TraceSetThresholdRequest) returns (TraceSetThresholdResponse) {} rpc StreamTraces (StreamTracesRequest) returns (stream StreamTracesResponse) {} } @@ -38,6 +39,25 @@ message TraceResumeRequest { */ message TraceResumeResponse {} +/** + * Request that the tracing threshold be set for an environment + */ +message TraceSetThresholdRequest { + string Environment = 1; // Name of the environment + + // Minimum duration a function call has to run for before it is traced. + // + // Compass only fires a probe for calls above this, so it is the main control + // over how much a traced environment pays for tracing. A threshold of zero + // traces every call, which is expensive on a busy environment. + google.protobuf.Duration Threshold = 2; +} + +/** + * Response if setting the tracing threshold was successful + */ +message TraceSetThresholdResponse {} + /** * Input for StreamTraces. */ @@ -70,11 +90,19 @@ enum TraceRuntime { * Trace data provided by Compass. */ message Trace { - TraceMetadata metadata = 1; // Metadata about the trace. - repeated TraceFunctionCall function_calls = 2; // List of function calls in the trace. - TraceResourceUtilisation resource_utilisation = 3; // Resources consumed by the request. - optional TraceDrupal drupal = 4; // Drupal specific data. Only populated for PHP traces which called into the Drupal APIs. - int64 function_calls_dropped = 5; // How many function events were not retained because the trace reached its configured limit. Reported so that a truncated trace is not mistaken for a complete one. + TraceMetadata metadata = 1; // Metadata about the trace. + repeated TraceSpan spans = 2; // Function calls made by the request, aggregated into spans. + TraceResourceUtilisation resource_utilisation = 3; // Resources consumed by the request. + optional TraceDrupal drupal = 4; // Drupal specific data. Only populated for PHP traces which called into the Drupal APIs. + + // How many function calls the request made, including any which no span + // represents. It is an exact count either way. + int64 calls = 5; + + // How many of those calls no span represents, because the trace had already + // reached its span limit when they arrived. Reported so that a truncated + // trace is not mistaken for a complete one. + int64 calls_dropped = 6; } /** @@ -119,13 +147,25 @@ message TraceResourceUtilisation { } /** - * Function call data within a trace. + * The calls of one function during one slice of a request. + * + * A request can make more than a million function calls, and no reader looks at + * those one at a time: what a reader asks of a trace is where the time went, + * which is an aggregate. Compass collects calls into spans as their events + * arrive, which is what lets a trace of a million calls stay a few hundred + * kilobytes. + * + * A span is placed by how far into the request it started rather than by the + * instant it started at, because an absolute time says nothing on its own - + * every consumer immediately subtracts the request start to get back to this. */ -message TraceFunctionCall { - string name = 1; // Name of the function being traced. - google.protobuf.Duration offset = 2; // Offset from the start of the request at which the call began. - google.protobuf.Duration elapsed = 3; // How long the call ran for. - int64 memory = 4; // Memory used by the call, in bytes. +message TraceSpan { + string name = 1; // Name of the function which was called. + google.protobuf.Duration offset = 2; // Offset from the start of the request at which the earliest call in this span began. + google.protobuf.Duration elapsed = 3; // How long the longest single call in this span ran for. + google.protobuf.Duration total = 4; // How long the calls in this span ran for altogether. Exceeds the request duration where a function called its way back into itself. + int64 calls = 5; // How many calls were aggregated into this span. + int64 memory = 6; // The highest memory reported by any call in this span, in bytes. } // Which Drupal API produced a cache event.