From d00b4d3888475cb86668849b75246616fe3cb389 Mon Sep 17 00:00:00 2001 From: rim99 Date: Sun, 3 Nov 2024 13:07:20 +0800 Subject: [PATCH 1/3] Add optinal time window in TraceGetParameters Signed-off-by: rim99 --- Makefile.Protobuf.mk | 7 +- cmd/anonymizer/app/flags.go | 14 + cmd/anonymizer/app/query/query.go | 19 +- cmd/anonymizer/app/query/query_test.go | 22 +- cmd/anonymizer/main.go | 2 +- .../storageexporter/exporter_test.go | 3 +- .../factoryadapter/writer_test.go | 4 +- .../internal/integration/span_reader.go | 6 +- cmd/query/app/apiv3/gateway_test.go | 15 +- cmd/query/app/apiv3/grpc_handler.go | 7 +- cmd/query/app/apiv3/grpc_handler_test.go | 25 +- cmd/query/app/apiv3/http_gateway.go | 26 +- cmd/query/app/apiv3/http_gateway_test.go | 28 +- cmd/query/app/grpc_handler.go | 14 +- cmd/query/app/grpc_handler_test.go | 35 +- cmd/query/app/handler_archive_test.go | 16 +- cmd/query/app/http_handler.go | 19 +- cmd/query/app/http_handler_test.go | 46 +- .../app/internal/api_v3/query_service.pb.go | 471 +++++++++++++++--- cmd/query/app/query_parser.go | 71 ++- cmd/query/app/querysvc/query_service.go | 10 +- cmd/query/app/querysvc/query_service_test.go | 37 +- idl | 2 +- jaeger-ui | 2 +- .../badger/spanstore/read_write_test.go | 10 +- plugin/storage/badger/spanstore/reader.go | 4 +- .../badger/spanstore/rw_internal_test.go | 4 +- plugin/storage/blackhole/blackhole.go | 2 +- plugin/storage/blackhole/blackhole_test.go | 2 +- .../storage/cassandra/savetracetest/main.go | 2 +- plugin/storage/cassandra/spanstore/reader.go | 6 +- .../cassandra/spanstore/reader_test.go | 4 +- plugin/storage/es/spanstore/reader.go | 4 +- plugin/storage/es/spanstore/reader_test.go | 26 +- plugin/storage/grpc/proto/storage.proto | 8 + plugin/storage/grpc/shared/archive.go | 6 +- plugin/storage/grpc/shared/archive_test.go | 8 +- plugin/storage/grpc/shared/grpc_client.go | 6 +- .../storage/grpc/shared/grpc_client_test.go | 42 +- plugin/storage/grpc/shared/grpc_handler.go | 12 +- .../storage/grpc/shared/grpc_handler_test.go | 14 +- plugin/storage/integration/integration.go | 8 +- plugin/storage/integration/kafka_test.go | 4 +- plugin/storage/memory/memory.go | 4 +- plugin/storage/memory/memory_test.go | 26 +- proto-gen/api_v2/query.pb.go | 127 ++--- proto-gen/storage_v1/storage.pb.go | 297 +++++++---- storage/spanstore/interface.go | 9 +- storage/spanstore/metrics/decorator.go | 4 +- storage/spanstore/metrics/decorator_test.go | 8 +- storage/spanstore/mocks/Reader.go | 18 +- 51 files changed, 1151 insertions(+), 415 deletions(-) diff --git a/Makefile.Protobuf.mk b/Makefile.Protobuf.mk index 875ab90b0da..ea70bea2329 100644 --- a/Makefile.Protobuf.mk +++ b/Makefile.Protobuf.mk @@ -14,9 +14,10 @@ # instead of the go_package's declared by the imported protof files. # -DOCKER_PROTOBUF_VERSION=0.5.0 -DOCKER_PROTOBUF=jaegertracing/protobuf:$(DOCKER_PROTOBUF_VERSION) -PROTOC := docker run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD} ${DOCKER_PROTOBUF} --proto_path=${PWD} +CONTAINER=docker +CONTAINER_PROTOBUF_VERSION=0.5.0 +CONTAINER_PROTOBUF=jaegertracing/protobuf:$(CONTAINER_PROTOBUF_VERSION) +PROTOC := ${CONTAINER} run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD} ${CONTAINER_PROTOBUF} --proto_path=${PWD} PATCHED_OTEL_PROTO_DIR = proto-gen/.patched-otel-proto diff --git a/cmd/anonymizer/app/flags.go b/cmd/anonymizer/app/flags.go index 51b14d88a07..b4ad5d7a073 100644 --- a/cmd/anonymizer/app/flags.go +++ b/cmd/anonymizer/app/flags.go @@ -17,6 +17,8 @@ type Options struct { HashCustomTags bool HashLogs bool HashProcess bool + StartTime int64 + EndTime int64 } const ( @@ -28,6 +30,8 @@ const ( hashLogsFlag = "hash-logs" hashProcessFlag = "hash-process" maxSpansCount = "max-spans-count" + startTime = "start-time" + endTime = "end-time" ) // AddFlags adds flags for anonymizer main program @@ -72,6 +76,16 @@ func (o *Options) AddFlags(command *cobra.Command) { maxSpansCount, -1, "The maximum number of spans to anonymize") + command.Flags().Int64Var( + &o.StartTime, + startTime, + -1, + "The start time of time window for searching trace, timestampe in unix microseconds") + command.Flags().Int64Var( + &o.EndTime, + endTime, + -1, + "The end time of time window for searching trace, timestampe in unix microseconds") // mark traceid flag as mandatory command.MarkFlagRequired(traceIDFlag) diff --git a/cmd/anonymizer/app/query/query.go b/cmd/anonymizer/app/query/query.go index 755d8317d19..575889fc84b 100644 --- a/cmd/anonymizer/app/query/query.go +++ b/cmd/anonymizer/app/query/query.go @@ -9,6 +9,7 @@ import ( "fmt" "io" "strings" + "time" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -49,15 +50,27 @@ func unwrapNotFoundErr(err error) error { } // QueryTrace queries for a trace and returns all spans inside it -func (q *Query) QueryTrace(traceID string) ([]model.Span, error) { +func (q *Query) QueryTrace(traceID string, startTime int64, endTime int64) ([]model.Span, error) { mTraceID, err := model.TraceIDFromString(traceID) if err != nil { return nil, fmt.Errorf("failed to convert the provided trace id: %w", err) } - stream, err := q.client.GetTrace(context.Background(), &api_v2.GetTraceRequest{ + request := api_v2.GetTraceRequest{ TraceID: mTraceID, - }) + } + + if startTime != -1 { + t := time.UnixMicro(startTime) + request.StartTime = &t + } + + if endTime != -1 { + t := time.UnixMicro(endTime) + request.EndTime = &t + } + + stream, err := q.client.GetTrace(context.Background(), &request) if err != nil { return nil, unwrapNotFoundErr(err) } diff --git a/cmd/anonymizer/app/query/query_test.go b/cmd/anonymizer/app/query/query_test.go index 86b7fd55ed8..f51de5de7e9 100644 --- a/cmd/anonymizer/app/query/query_test.go +++ b/cmd/anonymizer/app/query/query_test.go @@ -7,6 +7,7 @@ import ( "net" "sync" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -24,8 +25,8 @@ import ( ) var ( - matchContext = mock.AnythingOfType("*context.valueCtx") - matchTraceID = mock.AnythingOfType("model.TraceID") + matchContext = mock.AnythingOfType("*context.valueCtx") + matchTraceGetParameters = mock.AnythingOfType("spanstore.TraceGetParameters") mockInvalidTraceID = "xyz" mockTraceID = model.NewTraceID(0, 123456) @@ -106,24 +107,31 @@ func TestQueryTrace(t *testing.T) { defer q.Close() t.Run("No error", func(t *testing.T) { - s.spanReader.On("GetTrace", matchContext, matchTraceID).Return( + startTime := time.Date(1970, time.January, 1, 0, 0, 0, 1000, time.UTC) + endTime := time.Date(1970, time.January, 1, 0, 0, 0, 2000, time.UTC) + expectedTraceGetParameters := spanstore.TraceGetParameters{ + TraceID: mockTraceID, + StartTime: &startTime, + EndTime: &endTime, + } + s.spanReader.On("GetTrace", matchContext, expectedTraceGetParameters).Return( mockTraceGRPC, nil).Once() - spans, err := q.QueryTrace(mockTraceID.String()) + spans, err := q.QueryTrace(mockTraceID.String(), 1, 2) require.NoError(t, err) assert.Equal(t, len(spans), len(mockTraceGRPC.Spans)) }) t.Run("Invalid TraceID", func(t *testing.T) { - _, err := q.QueryTrace(mockInvalidTraceID) + _, err := q.QueryTrace(mockInvalidTraceID, -1, -1) assert.ErrorContains(t, err, "failed to convert the provided trace id") }) t.Run("Trace not found", func(t *testing.T) { - s.spanReader.On("GetTrace", matchContext, matchTraceID).Return( + s.spanReader.On("GetTrace", matchContext, matchTraceGetParameters).Return( nil, spanstore.ErrTraceNotFound).Once() - spans, err := q.QueryTrace(mockTraceID.String()) + spans, err := q.QueryTrace(mockTraceID.String(), -1, -1) assert.Nil(t, spans) assert.ErrorIs(t, err, spanstore.ErrTraceNotFound) }) diff --git a/cmd/anonymizer/main.go b/cmd/anonymizer/main.go index 6f5e27c620b..01f1a08483c 100644 --- a/cmd/anonymizer/main.go +++ b/cmd/anonymizer/main.go @@ -53,7 +53,7 @@ func main() { logger.Fatal("error while creating query object", zap.Error(err)) } - spans, err := query.QueryTrace(options.TraceID) + spans, err := query.QueryTrace(options.TraceID, options.StartTime, options.EndTime) if err != nil { logger.Fatal("error while querying for trace", zap.Error(err)) } diff --git a/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go b/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go index 628eae6dfb3..94673740452 100644 --- a/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go +++ b/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go @@ -27,6 +27,7 @@ import ( "github.com/jaegertracing/jaeger/plugin/storage/memory" "github.com/jaegertracing/jaeger/storage" factoryMocks "github.com/jaegertracing/jaeger/storage/mocks" + "github.com/jaegertracing/jaeger/storage/spanstore" ) type mockStorageExt struct { @@ -154,7 +155,7 @@ func TestExporter(t *testing.T) { spanReader, err := storageFactory.CreateSpanReader() require.NoError(t, err) requiredTraceID := model.NewTraceID(0, 1) // 00000000000000000000000000000001 - requiredTrace, err := spanReader.GetTrace(ctx, requiredTraceID) + requiredTrace, err := spanReader.GetTrace(ctx, spanstore.TraceGetParameters{TraceID: requiredTraceID}) require.NoError(t, err) assert.Equal(t, spanID.String(), requiredTrace.Spans[0].SpanID.String()) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/factoryadapter/writer_test.go b/cmd/jaeger/internal/extension/jaegerstorage/factoryadapter/writer_test.go index df5966cd33f..e053d6af710 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/factoryadapter/writer_test.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/factoryadapter/writer_test.go @@ -16,6 +16,7 @@ import ( "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/plugin/storage/memory" + "github.com/jaegertracing/jaeger/storage/spanstore" spanstoreMocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" ) @@ -32,7 +33,8 @@ func TestWriteTraces(t *testing.T) { tdID := td.ResourceSpans().At(0).ScopeSpans().At(0).Spans().At(0).TraceID() traceID, err := model.TraceIDFromBytes(tdID[:]) require.NoError(t, err) - trace, err := memstore.GetTrace(context.Background(), traceID) + query := spanstore.TraceGetParameters{TraceID: traceID} + trace, err := memstore.GetTrace(context.Background(), query) require.NoError(t, err) require.NotNil(t, trace) assert.Len(t, trace.Spans, 1) diff --git a/cmd/jaeger/internal/integration/span_reader.go b/cmd/jaeger/internal/integration/span_reader.go index abd98ecd6aa..943d985c86d 100644 --- a/cmd/jaeger/internal/integration/span_reader.go +++ b/cmd/jaeger/internal/integration/span_reader.go @@ -66,9 +66,11 @@ func unwrapNotFoundErr(err error) error { return err } -func (r *spanReader) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { +func (r *spanReader) GetTrace(ctx context.Context, query spanstore.TraceGetParameters) (*model.Trace, error) { stream, err := r.client.GetTrace(ctx, &api_v2.GetTraceRequest{ - TraceID: traceID, + TraceID: query.TraceID, + StartTime: query.StartTime, + EndTime: query.EndTime, }) if err != nil { return nil, unwrapNotFoundErr(err) diff --git a/cmd/query/app/apiv3/gateway_test.go b/cmd/query/app/apiv3/gateway_test.go index 6c942fcfb0f..b8a5269b3be 100644 --- a/cmd/query/app/apiv3/gateway_test.go +++ b/cmd/query/app/apiv3/gateway_test.go @@ -80,8 +80,9 @@ func parseResponse(t *testing.T, body []byte, obj gogoproto.Message) { require.NoError(t, gogojsonpb.Unmarshal(bytes.NewBuffer(body), obj)) } -func makeTestTrace() (*model.Trace, model.TraceID) { +func makeTestTrace() (*model.Trace, spanstore.TraceGetParameters) { traceID := model.NewTraceID(150, 160) + query := spanstore.TraceGetParameters{TraceID: traceID} return &model.Trace{ Spans: []*model.Span{ { @@ -94,7 +95,7 @@ func makeTestTrace() (*model.Trace, model.TraceID) { }, }, }, - }, traceID + }, query } func runGatewayTests( @@ -140,18 +141,18 @@ func (gw *testGateway) runGatewayGetOperations(t *testing.T) { } func (gw *testGateway) runGatewayGetTrace(t *testing.T) { - trace, traceID := makeTestTrace() - gw.reader.On("GetTrace", matchContext, traceID).Return(trace, nil).Once() - gw.getTracesAndVerify(t, "/api/v3/traces/"+traceID.String(), traceID) + trace, query := makeTestTrace() + gw.reader.On("GetTrace", matchContext, query).Return(trace, nil).Once() + gw.getTracesAndVerify(t, "/api/v3/traces/"+query.TraceID.String(), query.TraceID) } func (gw *testGateway) runGatewayFindTraces(t *testing.T) { - trace, traceID := makeTestTrace() + trace, query := makeTestTrace() q, qp := mockFindQueries() gw.reader. On("FindTraces", matchContext, qp). Return([]*model.Trace{trace}, nil).Once() - gw.getTracesAndVerify(t, "/api/v3/traces?"+q.Encode(), traceID) + gw.getTracesAndVerify(t, "/api/v3/traces?"+q.Encode(), query.TraceID) } func (gw *testGateway) getTracesAndVerify(t *testing.T, url string, expectedTraceID model.TraceID) { diff --git a/cmd/query/app/apiv3/grpc_handler.go b/cmd/query/app/apiv3/grpc_handler.go index ffe597f8d06..6e82ae6cbf9 100644 --- a/cmd/query/app/apiv3/grpc_handler.go +++ b/cmd/query/app/apiv3/grpc_handler.go @@ -33,7 +33,12 @@ func (h *Handler) GetTrace(request *api_v3.GetTraceRequest, stream api_v3.QueryS return fmt.Errorf("malform trace ID: %w", err) } - trace, err := h.QueryService.GetTrace(stream.Context(), traceID) + query := spanstore.TraceGetParameters{ + TraceID: traceID, + StartTime: request.GetStartTime(), + EndTime: request.GetEndTime(), + } + trace, err := h.QueryService.GetTrace(stream.Context(), query) if err != nil { return fmt.Errorf("cannot retrieve trace: %w", err) } diff --git a/cmd/query/app/apiv3/grpc_handler_test.go b/cmd/query/app/apiv3/grpc_handler_test.go index c66646a6480..ad6e0c61cec 100644 --- a/cmd/query/app/apiv3/grpc_handler_test.go +++ b/cmd/query/app/apiv3/grpc_handler_test.go @@ -8,6 +8,7 @@ import ( "fmt" "net" "testing" + "time" "github.com/gogo/protobuf/types" "github.com/stretchr/testify/assert" @@ -26,8 +27,8 @@ import ( ) var ( - matchContext = mock.AnythingOfType("*context.valueCtx") - matchTraceID = mock.AnythingOfType("model.TraceID") + matchContext = mock.AnythingOfType("*context.valueCtx") + matchTraceGetParameters = mock.AnythingOfType("spanstore.TraceGetParameters") ) func newGrpcServer(t *testing.T, handler *Handler) (*grpc.Server, net.Addr) { @@ -79,7 +80,17 @@ func newTestServerClient(t *testing.T) *testServerClient { func TestGetTrace(t *testing.T) { tsc := newTestServerClient(t) - tsc.reader.On("GetTrace", matchContext, matchTraceID).Return( + traceIdLiteral := "156" + traceId, _ := model.TraceIDFromString(traceIdLiteral) + startTime := time.Date(2020, time.January, 1, 13, 0, 0, 0, time.UTC) + endTime := time.Date(2020, time.January, 1, 14, 0, 0, 0, time.UTC) + + expectedTraceGetParameters := spanstore.TraceGetParameters{ + TraceID: traceId, + StartTime: &startTime, + EndTime: &endTime, + } + tsc.reader.On("GetTrace", matchContext, expectedTraceGetParameters).Return( &model.Trace{ Spans: []*model.Span{ { @@ -90,7 +101,9 @@ func TestGetTrace(t *testing.T) { getTraceStream, err := tsc.client.GetTrace(context.Background(), &api_v3.GetTraceRequest{ - TraceId: "156", + TraceId: traceIdLiteral, + StartTime: &startTime, + EndTime: &endTime, }, ) require.NoError(t, err) @@ -104,7 +117,7 @@ func TestGetTrace(t *testing.T) { func TestGetTraceStorageError(t *testing.T) { tsc := newTestServerClient(t) - tsc.reader.On("GetTrace", matchContext, matchTraceID).Return( + tsc.reader.On("GetTrace", matchContext, matchTraceGetParameters).Return( nil, fmt.Errorf("storage_error")).Once() getTraceStream, err := tsc.client.GetTrace(context.Background(), &api_v3.GetTraceRequest{ @@ -119,7 +132,7 @@ func TestGetTraceStorageError(t *testing.T) { func TestGetTraceTraceIDError(t *testing.T) { tsc := newTestServerClient(t) - tsc.reader.On("GetTrace", matchContext, matchTraceID).Return( + tsc.reader.On("GetTrace", matchContext, matchTraceGetParameters).Return( &model.Trace{ Spans: []*model.Span{}, }, nil).Once() diff --git a/cmd/query/app/apiv3/http_gateway.go b/cmd/query/app/apiv3/http_gateway.go index 1abbcece1f8..c28919ea1e4 100644 --- a/cmd/query/app/apiv3/http_gateway.go +++ b/cmd/query/app/apiv3/http_gateway.go @@ -27,7 +27,9 @@ import ( ) const ( - paramTraceID = "trace_id" // get trace by ID + paramTraceID = "trace_id" // get trace by ID + paramStartTime = "start_time" + paramEndTime = "end_time" paramServiceName = "query.service_name" // find traces paramOperationName = "query.operation_name" paramTimeMin = "query.start_time_min" @@ -136,7 +138,27 @@ func (h *HTTPGateway) getTrace(w http.ResponseWriter, r *http.Request) { if h.tryParamError(w, err, paramTraceID) { return } - trc, err := h.QueryService.GetTrace(r.Context(), traceID) + query := spanstore.TraceGetParameters{ + TraceID: traceID, + } + http_query := r.URL.Query() + startTime := http_query.Get(paramStartTime) + if startTime != "" { + timeParsed, err := time.Parse(time.RFC3339Nano, startTime) + if h.tryParamError(w, err, paramStartTime) { + return + } + query.StartTime = &timeParsed + } + endTime := http_query.Get(paramEndTime) + if endTime != "" { + timeParsed, err := time.Parse(time.RFC3339Nano, endTime) + if h.tryParamError(w, err, paramEndTime) { + return + } + query.EndTime = &timeParsed + } + trc, err := h.QueryService.GetTrace(r.Context(), query) if h.tryHandleError(w, err, http.StatusInternalServerError) { return } diff --git a/cmd/query/app/apiv3/http_gateway_test.go b/cmd/query/app/apiv3/http_gateway_test.go index 6feaba989c6..ba1b0729968 100644 --- a/cmd/query/app/apiv3/http_gateway_test.go +++ b/cmd/query/app/apiv3/http_gateway_test.go @@ -118,7 +118,7 @@ func TestHTTPGatewayGetTraceErrors(t *testing.T) { // error from span reader const simErr = "simulated error" gw.reader. - On("GetTrace", matchContext, matchTraceID). + On("GetTrace", matchContext, matchTraceGetParameters). Return(nil, errors.New(simErr)).Once() r, err = http.NewRequest(http.MethodGet, "/api/v3/traces/123", nil) @@ -128,6 +128,32 @@ func TestHTTPGatewayGetTraceErrors(t *testing.T) { assert.Contains(t, w.Body.String(), simErr) } +func TestHTTPGatewayGetTraceWithTimeWindowErrors(t *testing.T) { + gw := setupHTTPGatewayNoServer(t, "") + + // error from span reader + const simErr = "simulated error" + startTime := time.Date(2020, time.January, 1, 12, 0, 0, 0, time.UTC) + endTime := time.Date(2020, time.January, 1, 13, 0, 0, 0, time.UTC) + expectedTraceGetParameters := spanstore.TraceGetParameters{ + TraceID: model.TraceID{High: 0, Low: 0x123}, + StartTime: &startTime, + EndTime: &endTime, + } + gw.reader. + On("GetTrace", matchContext, expectedTraceGetParameters). + Return(nil, errors.New(simErr)).Once() + + q := url.Values{} + q.Set(paramStartTime, startTime.Format(time.RFC3339Nano)) + q.Set(paramEndTime, endTime.Format(time.RFC3339Nano)) + r, err := http.NewRequest(http.MethodGet, "/api/v3/traces/123?"+q.Encode(), nil) + require.NoError(t, err) + w := httptest.NewRecorder() + gw.router.ServeHTTP(w, r) + assert.Contains(t, w.Body.String(), simErr) +} + func mockFindQueries() (url.Values, *spanstore.TraceQueryParameters) { // mock performs deep comparison of the timestamps and can fail // if they are different in the timezone or the monotonic clocks. diff --git a/cmd/query/app/grpc_handler.go b/cmd/query/app/grpc_handler.go index 6f70750e98f..d5320daeead 100644 --- a/cmd/query/app/grpc_handler.go +++ b/cmd/query/app/grpc_handler.go @@ -89,7 +89,12 @@ func (g *GRPCHandler) GetTrace(r *api_v2.GetTraceRequest, stream api_v2.QuerySer if r.TraceID == (model.TraceID{}) { return errUninitializedTraceID } - trace, err := g.queryService.GetTrace(stream.Context(), r.TraceID) + query := spanstore.TraceGetParameters{ + TraceID: r.TraceID, + StartTime: r.StartTime, + EndTime: r.EndTime, + } + trace, err := g.queryService.GetTrace(stream.Context(), query) if errors.Is(err, spanstore.ErrTraceNotFound) { g.logger.Warn(msgTraceNotFound, zap.Stringer("id", r.TraceID), zap.Error(err)) return status.Errorf(codes.NotFound, "%s: %v", msgTraceNotFound, err) @@ -109,7 +114,12 @@ func (g *GRPCHandler) ArchiveTrace(ctx context.Context, r *api_v2.ArchiveTraceRe if r.TraceID == (model.TraceID{}) { return nil, errUninitializedTraceID } - err := g.queryService.ArchiveTrace(ctx, r.TraceID) + query := spanstore.TraceGetParameters{ + TraceID: r.TraceID, + StartTime: r.StartTime, + EndTime: r.EndTime, + } + err := g.queryService.ArchiveTrace(ctx, query) if errors.Is(err, spanstore.ErrTraceNotFound) { g.logger.Warn(msgTraceNotFound, zap.Stringer("id", r.TraceID), zap.Error(err)) return nil, status.Errorf(codes.NotFound, "%s: %v", msgTraceNotFound, err) diff --git a/cmd/query/app/grpc_handler_test.go b/cmd/query/app/grpc_handler_test.go index 6c83f01efec..17144d6ffcc 100644 --- a/cmd/query/app/grpc_handler_test.go +++ b/cmd/query/app/grpc_handler_test.go @@ -198,11 +198,20 @@ func withServerAndClient(t *testing.T, actualTest func(server *grpcServer, clien func TestGetTraceSuccessGRPC(t *testing.T) { withServerAndClient(t, func(server *grpcServer, client *grpcClient) { - server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + startTime := time.Date(2020, time.January, 1, 13, 0, 0, 0, time.UTC) + endTime := time.Date(2020, time.January, 1, 14, 0, 0, 0, time.UTC) + expectedTraceGetParameters := spanstore.TraceGetParameters{ + TraceID: mockTraceID, + StartTime: &startTime, + EndTime: &endTime, + } + server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), expectedTraceGetParameters). Return(mockTrace, nil).Once() res, err := client.GetTrace(context.Background(), &api_v2.GetTraceRequest{ - TraceID: mockTraceID, + TraceID: mockTraceID, + StartTime: &startTime, + EndTime: &endTime, }) spanResChunk, _ := res.Recv() @@ -221,7 +230,7 @@ func assertGRPCError(t *testing.T, err error, code codes.Code, msg string) { func TestGetTraceEmptyTraceIDFailure_GRPC(t *testing.T) { withServerAndClient(t, func(server *grpcServer, client *grpcClient) { - server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() res, err := client.GetTrace(context.Background(), &api_v2.GetTraceRequest{ @@ -238,7 +247,7 @@ func TestGetTraceEmptyTraceIDFailure_GRPC(t *testing.T) { func TestGetTraceDBFailureGRPC(t *testing.T) { withServerAndClient(t, func(server *grpcServer, client *grpcClient) { - server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, errStorageGRPC).Once() res, err := client.GetTrace(context.Background(), &api_v2.GetTraceRequest{ @@ -254,10 +263,10 @@ func TestGetTraceDBFailureGRPC(t *testing.T) { func TestGetTraceNotFoundGRPC(t *testing.T) { withServerAndClient(t, func(server *grpcServer, client *grpcClient) { - server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() - server.archiveSpanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + server.archiveSpanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() res, err := client.GetTrace(context.Background(), &api_v2.GetTraceRequest{ @@ -279,7 +288,7 @@ func TestGetTraceNilRequestOnHandlerGRPC(t *testing.T) { func TestArchiveTraceSuccessGRPC(t *testing.T) { withServerAndClient(t, func(server *grpcServer, client *grpcClient) { - server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() server.archiveSpanWriter.On("WriteSpan", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("*model.Span")). Return(nil).Times(2) @@ -294,9 +303,9 @@ func TestArchiveTraceSuccessGRPC(t *testing.T) { func TestArchiveTraceNotFoundGRPC(t *testing.T) { withServerAndClient(t, func(server *grpcServer, client *grpcClient) { - server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() - server.archiveSpanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + server.archiveSpanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() _, err := client.ArchiveTrace(context.Background(), &api_v2.ArchiveTraceRequest{ @@ -325,7 +334,7 @@ func TestArchiveTraceNilRequestOnHandlerGRPC(t *testing.T) { func TestArchiveTraceFailureGRPC(t *testing.T) { withServerAndClient(t, func(server *grpcServer, client *grpcClient) { - server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() server.archiveSpanWriter.On("WriteSpan", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("*model.Span")). Return(errStorageGRPC).Times(2) @@ -956,7 +965,7 @@ func TestSearchTenancyGRPC(t *testing.T) { Enabled: true, }) withTenantedServerAndClient(t, tm, func(server *grpcServer, client *grpcClient) { - server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() // First try without tenancy header @@ -1013,7 +1022,7 @@ func TestSearchTenancyGRPCExplicitList(t *testing.T) { Tenants: []string{"mercury", "venus", "mars"}, }) withTenantedServerAndClient(t, tm, func(server *grpcServer, client *grpcClient) { - server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + server.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() for _, tc := range []struct { @@ -1125,7 +1134,7 @@ func TestTenancyContextFlowGRPC(t *testing.T) { return false } return true - }), mock.AnythingOfType("model.TraceID")).Return(trace, err).Once() + }), mock.AnythingOfType("spanstore.TraceGetParameters")).Return(trace, err).Once() } for tenant, expected := range allExpectedResults { diff --git a/cmd/query/app/handler_archive_test.go b/cmd/query/app/handler_archive_test.go index 78a0afba11f..9649bdc1aa9 100644 --- a/cmd/query/app/handler_archive_test.go +++ b/cmd/query/app/handler_archive_test.go @@ -20,7 +20,7 @@ import ( func TestGetArchivedTrace_NotFound(t *testing.T) { mockReader := &spanstoremocks.Reader{} - mockReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + mockReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() for _, tc := range []struct { name string @@ -37,7 +37,7 @@ func TestGetArchivedTrace_NotFound(t *testing.T) { } { t.Run(tc.name, func(t *testing.T) { withTestServer(t, func(ts *testServer) { - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() var response structuredResponse err := getJSON(ts.server.URL+"/api/traces/"+mockTraceID.String(), &response) @@ -52,11 +52,11 @@ func TestGetArchivedTrace_NotFound(t *testing.T) { func TestGetArchivedTraceSuccess(t *testing.T) { traceID := model.NewTraceID(0, 123456) mockReader := &spanstoremocks.Reader{} - mockReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + mockReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() withTestServer(t, func(ts *testServer) { // make main reader return NotFound - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() var response structuredTraceResponse err := getJSON(ts.server.URL+"/api/traces/"+mockTraceID.String(), &response) @@ -79,13 +79,13 @@ func TestArchiveTrace_BadTraceID(t *testing.T) { // Test return of 404 when trace is not found in APIHandler.archive func TestArchiveTrace_TraceNotFound(t *testing.T) { mockReader := &spanstoremocks.Reader{} - mockReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + mockReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() mockWriter := &spanstoremocks.Writer{} // Not actually going to write the trace, so no need to define mockWriter action withTestServer(t, func(ts *testServer) { // make main reader return NotFound - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() var response structuredResponse err := postJSON(ts.server.URL+"/api/archive/"+mockTraceID.String(), []string{}, &response) @@ -106,7 +106,7 @@ func TestArchiveTrace_Success(t *testing.T) { mockWriter.On("WriteSpan", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("*model.Span")). Return(nil).Times(2) withTestServer(t, func(ts *testServer) { - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() var response structuredResponse err := postJSON(ts.server.URL+"/api/archive/"+mockTraceID.String(), []string{}, &response) @@ -119,7 +119,7 @@ func TestArchiveTrace_WriteErrors(t *testing.T) { mockWriter.On("WriteSpan", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("*model.Span")). Return(errors.New("cannot save")).Times(2) withTestServer(t, func(ts *testServer) { - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() var response structuredResponse err := postJSON(ts.server.URL+"/api/archive/"+mockTraceID.String(), []string{}, &response) diff --git a/cmd/query/app/http_handler.go b/cmd/query/app/http_handler.go index 3eec204720e..5b7849310bb 100644 --- a/cmd/query/app/http_handler.go +++ b/cmd/query/app/http_handler.go @@ -266,7 +266,10 @@ func (aH *APIHandler) tracesByIDs(ctx context.Context, traceIDs []model.TraceID) var traceErrors []structuredError retMe := make([]*model.Trace, 0, len(traceIDs)) for _, traceID := range traceIDs { - if trc, err := aH.queryService.GetTrace(ctx, traceID); err != nil { + query := spanstore.TraceGetParameters{ + TraceID: traceID, + } + if trc, err := aH.queryService.GetTrace(ctx, query); err != nil { if !errors.Is(err, spanstore.ErrTraceNotFound) { return nil, nil, err } @@ -429,7 +432,14 @@ func (aH *APIHandler) getTrace(w http.ResponseWriter, r *http.Request) { if !ok { return } - trc, err := aH.queryService.GetTrace(r.Context(), traceID) + query := spanstore.TraceGetParameters{ + TraceID: traceID, + } + err := aH.queryParser.parseTraceGetParams(r, &query) + if err != nil { + return + } + trc, err := aH.queryService.GetTrace(r.Context(), query) if errors.Is(err, spanstore.ErrTraceNotFound) { aH.handleError(w, err, http.StatusNotFound) return @@ -458,7 +468,10 @@ func (aH *APIHandler) archiveTrace(w http.ResponseWriter, r *http.Request) { } // QueryService.ArchiveTrace can now archive this traceID. - err := aH.queryService.ArchiveTrace(r.Context(), traceID) + query := spanstore.TraceGetParameters{ + TraceID: traceID, + } + err := aH.queryService.ArchiveTrace(r.Context(), query) if errors.Is(err, spanstore.ErrTraceNotFound) { aH.handleError(w, err, http.StatusNotFound) return diff --git a/cmd/query/app/http_handler_test.go b/cmd/query/app/http_handler_test.go index 54ebd5ea732..415395da5f1 100644 --- a/cmd/query/app/http_handler_test.go +++ b/cmd/query/app/http_handler_test.go @@ -153,7 +153,7 @@ func withTestServer(t *testing.T, doTest func(s *testServer), queryOptions query func TestGetTraceSuccess(t *testing.T) { ts := initializeTestServer(t) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() var response structuredResponse @@ -180,7 +180,7 @@ func TestGetTraceDedupeSuccess(t *testing.T) { } ts := initializeTestServer(t) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(dupedMockTrace, nil).Once() var response structuredResponse @@ -194,6 +194,22 @@ func TestGetTraceDedupeSuccess(t *testing.T) { } } +func TestGetTraceWithTimeWindowSuccess(t *testing.T) { + ts := initializeTestServer(t) + start_time := time.Date(1970, time.January, 1, 0, 0, 0, 1000, time.UTC).Local() + end_time := time.Date(1970, time.January, 1, 0, 0, 0, 2000, time.UTC).Local() + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), spanstore.TraceGetParameters{ + TraceID: model.TraceID{High: 0, Low: 0x123456}, + StartTime: &start_time, + EndTime: &end_time, + }).Return(mockTrace, nil).Once() + + var response structuredResponse + err := getJSON(ts.server.URL+`/api/traces/123456?start=1&end=2`, &response) + require.NoError(t, err) + assert.Empty(t, response.Errors) +} + func TestLogOnServerError(t *testing.T) { zapCore, logs := observer.New(zap.InfoLevel) logger := zap.New(zapCore) @@ -321,7 +337,7 @@ func TestGetTrace(t *testing.T) { ts := initializeTestServer(t, HandlerOptions.Tracer(jTracer.OTEL)) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), model.NewTraceID(0, 0x123456abc)). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), spanstore.TraceGetParameters{TraceID: model.NewTraceID(0, 0x123456abc)}). Return(makeMockTrace(t), nil).Once() var response structuredResponse @@ -338,7 +354,7 @@ func TestGetTrace(t *testing.T) { func TestGetTraceDBFailure(t *testing.T) { ts := initializeTestServer(t) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, errStorage).Once() var response structuredResponse @@ -348,7 +364,7 @@ func TestGetTraceDBFailure(t *testing.T) { func TestGetTraceNotFound(t *testing.T) { ts := initializeTestServer(t) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() var response structuredResponse @@ -365,7 +381,7 @@ func TestGetTraceAdjustmentFailure(t *testing.T) { }), }, ) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() var response structuredResponse @@ -396,7 +412,7 @@ func TestSearchSuccess(t *testing.T) { func TestSearchByTraceIDSuccess(t *testing.T) { ts := initializeTestServer(t) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Twice() var response structuredResponse @@ -411,9 +427,9 @@ func TestSearchByTraceIDSuccessWithArchive(t *testing.T) { ts := initializeTestServerWithOptions(t, &tenancy.Manager{}, querysvc.QueryServiceOptions{ ArchiveSpanReader: archiveReadMock, }) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Twice() - archiveReadMock.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + archiveReadMock.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Twice() var response structuredResponse @@ -425,7 +441,7 @@ func TestSearchByTraceIDSuccessWithArchive(t *testing.T) { func TestSearchByTraceIDNotFound(t *testing.T) { ts := initializeTestServer(t) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() var response structuredResponse @@ -438,7 +454,7 @@ func TestSearchByTraceIDNotFound(t *testing.T) { func TestSearchByTraceIDFailure(t *testing.T) { ts := initializeTestServer(t) whatsamattayou := "whatsamattayou" - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, errors.New(whatsamattayou)).Once() var response structuredResponse @@ -914,7 +930,7 @@ func TestSearchTenancyHTTP(t *testing.T) { ts := initializeTestServerWithOptions(t, tenancy.NewManager(&tenancyOptions), querysvc.QueryServiceOptions{}) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Twice() var response structuredResponse @@ -938,7 +954,7 @@ func TestSearchTenancyRejectionHTTP(t *testing.T) { Enabled: true, } ts := initializeTestServerWithOptions(t, tenancy.NewManager(&tenancyOptions), querysvc.QueryServiceOptions{}) - ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + ts.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Twice() req, err := http.NewRequest(http.MethodGet, ts.server.URL+`/api/traces?traceID=1&traceID=2`, nil) @@ -970,14 +986,14 @@ func TestSearchTenancyFlowTenantHTTP(t *testing.T) { return false } return true - }), mock.AnythingOfType("model.TraceID")).Return(mockTrace, nil).Twice() + }), mock.AnythingOfType("spanstore.TraceGetParameters")).Return(mockTrace, nil).Twice() ts.spanReader.On("GetTrace", mock.MatchedBy(func(v any) bool { ctx, ok := v.(context.Context) if !ok || tenancy.GetTenant(ctx) != "megacorp" { return false } return true - }), mock.AnythingOfType("model.TraceID")).Return(nil, errStorage).Once() + }), mock.AnythingOfType("spanstore.TraceGetParameters")).Return(nil, errStorage).Once() var responseAcme structuredResponse err := getJSONCustomHeaders( diff --git a/cmd/query/app/internal/api_v3/query_service.pb.go b/cmd/query/app/internal/api_v3/query_service.pb.go index 2226d7f1b25..3b836093c6c 100644 --- a/cmd/query/app/internal/api_v3/query_service.pb.go +++ b/cmd/query/app/internal/api_v3/query_service.pb.go @@ -8,12 +8,15 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" time "time" ) @@ -49,16 +52,25 @@ func (*GetTraceRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{0} } func (m *GetTraceRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetTraceRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetTraceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetTraceRequest.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_GetTraceRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *GetTraceRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetTraceRequest.Merge(m, src) } func (m *GetTraceRequest) XXX_Size() int { - return xxx_messageInfo_GetTraceRequest.Size(m) + return m.Size() } func (m *GetTraceRequest) XXX_DiscardUnknown() { xxx_messageInfo_GetTraceRequest.DiscardUnknown(m) @@ -98,7 +110,6 @@ func (m *GetTraceRequest) GetEndTime() *time.Time { // that match the conditions, and the resulting number of traces can be less. // // Note: some storage implementations do not guarantee the correct implementation of all parameters. -// type TraceQueryParameters struct { ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` OperationName string `protobuf:"bytes,2,opt,name=operation_name,json=operationName,proto3" json:"operation_name,omitempty"` @@ -555,15 +566,15 @@ func (m *GRPCGatewayError_GRPCGatewayErrorDetails) GetHttpStatus() string { // In case of errors, GRPCGatewayError above is used. // // Example: -// {"result": {"resourceSpans": ...}} // -// See https://github.com/grpc-ecosystem/grpc-gateway/issues/2189 +// {"result": {"resourceSpans": ...}} // +// See https://github.com/grpc-ecosystem/grpc-gateway/issues/2189 type GRPCGatewayWrapper struct { Result *TracesData `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GRPCGatewayWrapper) Reset() { *m = GRPCGatewayWrapper{} } @@ -615,59 +626,60 @@ func init() { func init() { proto.RegisterFile("query_service.proto", fileDescriptor_5fcb6756dc1afb8d) } var fileDescriptor_5fcb6756dc1afb8d = []byte{ - // 819 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x6e, 0xdc, 0x44, - 0x14, 0xae, 0x77, 0xb3, 0xc9, 0xfa, 0x6c, 0xd2, 0x96, 0xe9, 0xa2, 0xba, 0x46, 0xa4, 0x1b, 0x17, - 0xa4, 0xbd, 0x72, 0xc8, 0xe6, 0x82, 0x02, 0x45, 0x94, 0x36, 0x65, 0x85, 0x50, 0x4a, 0x3b, 0xa9, - 0x0a, 0x42, 0x95, 0xac, 0x49, 0x7c, 0x30, 0xa6, 0xeb, 0xb1, 0x3b, 0x33, 0x5e, 0xb2, 0xcf, 0xc0, - 0x0d, 0x12, 0x6f, 0xc1, 0x4b, 0xf1, 0x08, 0xbc, 0x00, 0x17, 0xc8, 0x33, 0x63, 0x77, 0xd7, 0x0b, - 0x21, 0xb9, 0xb2, 0xcf, 0x99, 0xef, 0x3b, 0x3f, 0xdf, 0x9c, 0x33, 0x70, 0xeb, 0x4d, 0x89, 0x62, - 0x11, 0x49, 0x14, 0xf3, 0xf4, 0x0c, 0xc3, 0x42, 0xe4, 0x2a, 0x27, 0x3b, 0x3f, 0x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, 0x08, 0xd7, 0xf3, 0x02, 0x4d, 0xef, 0x06, 0xd4, 0xd1, 0xa0, 0x9d, 0xc6, - 0xab, 0x61, 0x27, 0x00, 0x4c, 0x29, 0x91, 0x9e, 0x96, 0x0a, 0xa5, 0xd7, 0x1d, 0x75, 0xc7, 0x83, - 0xc9, 0x61, 0xb8, 0x72, 0x69, 0xe1, 0xbf, 0x95, 0x10, 0x7e, 0xd9, 0xb0, 0x9e, 0x70, 0x25, 0x16, - 0x74, 0x29, 0x0c, 0x79, 0x08, 0xd7, 0xdf, 0xaa, 0x16, 0x65, 0x29, 0xf7, 0x36, 0xfe, 0xaf, 0x75, - 0xba, 0xdd, 0x68, 0x76, 0x9c, 0xf2, 0x76, 0x04, 0x76, 0xee, 0xf5, 0xae, 0x12, 0x81, 0x9d, 0x93, - 0x07, 0xb0, 0x5d, 0x5f, 0xbd, 0xae, 0x60, 0x53, 0xf3, 0xef, 0xac, 0xf1, 0x8f, 0x2c, 0x88, 0x0e, - 0x6a, 0x78, 0x95, 0x7f, 0x85, 0xcd, 0xce, 0xbd, 0xad, 0xcb, 0xb3, 0xd9, 0x39, 0x79, 0x1f, 0x80, - 0x97, 0x59, 0xa4, 0x87, 0x48, 0x7a, 0xfd, 0x91, 0x33, 0xee, 0x51, 0x97, 0x97, 0x99, 0x16, 0x52, - 0xfa, 0x9f, 0xc3, 0x8d, 0x96, 0x7a, 0xe4, 0x26, 0x74, 0x5f, 0xe3, 0xc2, 0xde, 0x63, 0xf5, 0x4b, - 0x86, 0xd0, 0x9b, 0xb3, 0x59, 0x59, 0x5f, 0x9b, 0x31, 0x3e, 0xed, 0xdc, 0x77, 0x82, 0xa7, 0xf0, - 0xce, 0x57, 0x29, 0x8f, 0x4d, 0xb0, 0x7a, 0x86, 0x3f, 0x81, 0x9e, 0x5e, 0x3f, 0x1d, 0x62, 0x30, - 0xb9, 0x77, 0x89, 0x2b, 0xa4, 0x86, 0x11, 0x0c, 0x81, 0x4c, 0x51, 0x9d, 0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 0x28, 0xa6, 0x4a, 0xa9, 0x97, 0xd4, 0xa5, 0x4b, 0x9e, 0xe0, 0x25, 0x90, 0xa5, 0x62, - 0xbe, 0x13, 0xac, 0x28, 0x50, 0x90, 0x87, 0xb0, 0x29, 0x50, 0x96, 0x33, 0x65, 0x7b, 0x1e, 0x87, - 0x2b, 0xaf, 0xba, 0xd9, 0x8e, 0xd0, 0x3c, 0xe6, 0xf3, 0x03, 0x33, 0x7b, 0xf2, 0x88, 0x29, 0x46, - 0x2d, 0x6f, 0xf2, 0x77, 0x07, 0xb6, 0xf5, 0x34, 0xda, 0xf9, 0x22, 0xdf, 0x43, 0xbf, 0x7e, 0x95, - 0xc9, 0x6e, 0x5b, 0xc2, 0xd5, 0xe7, 0xda, 0xbf, 0x74, 0xba, 0xe0, 0xda, 0x47, 0x0e, 0x79, 0x05, - 0xf0, 0x76, 0x5b, 0xc8, 0xa8, 0x15, 0x7b, 0x6d, 0x91, 0xae, 0x18, 0xfd, 0x25, 0x0c, 0x96, 0xb6, - 0x84, 0xec, 0xad, 0x97, 0xde, 0xda, 0x2b, 0x3f, 0xb8, 0x08, 0x62, 0x46, 0x34, 0xb8, 0x46, 0x5e, - 0xc1, 0xce, 0xca, 0xf4, 0x92, 0x7b, 0xeb, 0xb4, 0xb5, 0x45, 0xf3, 0x3f, 0xb8, 0x18, 0x54, 0x47, - 0x7f, 0xb4, 0x07, 0xb7, 0xd3, 0xdc, 0x62, 0xab, 0xce, 0x52, 0x9e, 0x58, 0xca, 0x0f, 0x9b, 0xe6, - 0x7b, 0xba, 0xa9, 0xfb, 0x3e, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0x04, 0x2f, 0x8b, 0x11, 0xd5, - 0x07, 0x00, 0x00, + // 837 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x6e, 0x1b, 0x45, + 0x14, 0xee, 0xda, 0x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, 0xed, 0x5d, 0x3a, 0x9d, 0x7f, 0xe5, 0x23, 0x87, + 0xbc, 0x00, 0x78, 0xb3, 0x2d, 0x64, 0x58, 0x8b, 0xbd, 0xb6, 0x48, 0x6f, 0x19, 0xfd, 0x39, 0x74, + 0x97, 0xb6, 0x84, 0xec, 0xae, 0x97, 0x5e, 0xdb, 0x2b, 0xcf, 0xbf, 0x08, 0x62, 0x46, 0xd4, 0xbf, + 0x42, 0x5e, 0xc0, 0xf6, 0xca, 0xf4, 0x92, 0xdb, 0xeb, 0xb4, 0xb5, 0x45, 0xf3, 0x3e, 0xb8, 0x18, + 0x54, 0x46, 0x7f, 0xb0, 0x0b, 0x37, 0xe3, 0xd4, 0x62, 0x8b, 0xce, 0x62, 0x1e, 0x59, 0xca, 0xf7, + 0x9b, 0xe6, 0x7b, 0xb2, 0xa9, 0xfb, 0x3e, 0xf8, 0x27, 0x00, 0x00, 0xff, 0xff, 0x42, 0x2d, 0x97, + 0x3d, 0xe3, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -930,3 +942,338 @@ var _QueryService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "query_service.proto", } + +func (m *GetTraceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTraceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetTraceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.EndTime != nil { + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintQueryService(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + } + if m.StartTime != nil { + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintQueryService(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x12 + } + if len(m.TraceId) > 0 { + i -= len(m.TraceId) + copy(dAtA[i:], m.TraceId) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.TraceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQueryService(dAtA []byte, offset int, v uint64) int { + offset -= sovQueryService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GetTraceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TraceId) + if l > 0 { + n += 1 + l + sovQueryService(uint64(l)) + } + if m.StartTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartTime) + n += 1 + l + sovQueryService(uint64(l)) + } + if m.EndTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndTime) + n += 1 + l + sovQueryService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovQueryService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQueryService(x uint64) (n int) { + return sovQueryService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GetTraceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTraceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTraceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TraceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TraceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StartTime == nil { + m.StartTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.StartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EndTime == nil { + m.EndTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.EndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQueryService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQueryService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQueryService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQueryService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQueryService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQueryService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQueryService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQueryService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQueryService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQueryService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/cmd/query/app/query_parser.go b/cmd/query/app/query_parser.go index 523f1af6aee..d849369cf0c 100644 --- a/cmd/query/app/query_parser.go +++ b/cmd/query/app/query_parser.go @@ -85,6 +85,39 @@ func newDurationUnitsParser(units time.Duration) durationParser { } } +// parseTraceGetParams takes a request and constructs a model of parameters. +// These parameters are optional +// +// Why start/end parameters are expressed in microseconds: +// Span searches operate on span latencies, which are expressed as microseconds in the data model, hence why +// support for high accuracy in search query parameters is required. +// Microsecond precision is a legacy artifact from zipkin origins where timestamps and durations +// are in microseconds (see: https://zipkin.io/pages/instrumenting.html). +// +// Trace get syntax: +// +// query ::= param | param '&' query +// param ::= start | end +// start ::= 'start=' intValue in unix microseconds +// end ::= 'end=' intValue in unix microseconds +func (p *queryParser) parseTraceGetParams(r *http.Request, param *spanstore.TraceGetParameters) error { + startTime, err := p.parseTime(r, startTimeParam, time.Microsecond, true) + if err != nil { + return err + } + if startTime != nil { + param.StartTime = startTime + } + endTime, err := p.parseTime(r, endTimeParam, time.Microsecond, true) + if err != nil { + return err + } + if endTime != nil { + param.EndTime = endTime + } + return nil +} + // parseTraceQueryParams takes a request and constructs a model of parameters. // // Why start/end parameters are expressed in microseconds: @@ -117,11 +150,11 @@ func (p *queryParser) parseTraceQueryParams(r *http.Request) (*traceQueryParamet service := r.FormValue(serviceParam) operation := r.FormValue(operationParam) - startTime, err := p.parseTime(r, startTimeParam, time.Microsecond) + startTime, err := p.parseTime(r, startTimeParam, time.Microsecond, false) if err != nil { return nil, err } - endTime, err := p.parseTime(r, endTimeParam, time.Microsecond) + endTime, err := p.parseTime(r, endTimeParam, time.Microsecond, false) if err != nil { return nil, err } @@ -165,8 +198,8 @@ func (p *queryParser) parseTraceQueryParams(r *http.Request) (*traceQueryParamet TraceQueryParameters: spanstore.TraceQueryParameters{ ServiceName: service, OperationName: operation, - StartTimeMin: startTime, - StartTimeMax: endTime, + StartTimeMin: *startTime, + StartTimeMax: *endTime, Tags: tags, NumTraces: limit, DurationMin: minDuration, @@ -187,10 +220,11 @@ func (p *queryParser) parseTraceQueryParams(r *http.Request) (*traceQueryParamet // and the typical backend granularity of those is on the order of 15min or more. As such, microseconds aren't // useful in this domain and milliseconds are sufficient for both times and durations. func (p *queryParser) parseDependenciesQueryParams(r *http.Request) (dqp dependenciesQueryParameters, err error) { - dqp.endTs, err = p.parseTime(r, endTsParam, time.Millisecond) + endTs, err := p.parseTime(r, endTsParam, time.Millisecond, false) if err != nil { return dqp, err } + dqp.endTs = *endTs dqp.lookback, err = parseDuration(r, lookbackParam, newDurationUnitsParser(time.Millisecond), defaultDependencyLookbackDuration) return dqp, err @@ -248,7 +282,7 @@ func (p *queryParser) parseMetricsQueryParams(r *http.Request) (bqp metricsstore if err != nil { return bqp, err } - endTs, err := p.parseTime(r, endTsParam, time.Millisecond) + endTs, err := p.parseTime(r, endTsParam, time.Millisecond, false) if err != nil { return bqp, err } @@ -265,7 +299,7 @@ func (p *queryParser) parseMetricsQueryParams(r *http.Request) (bqp metricsstore if err != nil { return bqp, err } - bqp.EndTime = &endTs + bqp.EndTime = endTs bqp.Lookback = &lookback bqp.Step = &step bqp.RatePer = &ratePer @@ -273,20 +307,29 @@ func (p *queryParser) parseMetricsQueryParams(r *http.Request) (bqp metricsstore } // parseTime parses the time parameter of an HTTP request that is represented the number of "units" since epoch. -// If the time parameter is empty, the current time will be returned. -func (p *queryParser) parseTime(r *http.Request, paramName string, units time.Duration) (time.Time, error) { +// If the time parameter is empty, and allowNil is false, the current time will be returned. +func (p *queryParser) parseTime(r *http.Request, paramName string, units time.Duration, allowNil bool) (*time.Time, error) { formValue := r.FormValue(paramName) + var t time.Time if formValue == "" { + if allowNil { + return nil, nil + } if paramName == startTimeParam { - return p.timeNow().Add(-1 * p.traceQueryLookbackDuration), nil + t = p.timeNow().Add(-1 * p.traceQueryLookbackDuration) + } else { + t = p.timeNow() } - return p.timeNow(), nil + return &t, nil } - t, err := strconv.ParseInt(formValue, 10, 64) + parsed_time, err := strconv.ParseInt(formValue, 10, 64) if err != nil { - return time.Time{}, newParseError(err, paramName) + t = time.Time{} + err = newParseError(err, paramName) + } else { + t = time.Unix(0, 0).Add(time.Duration(parsed_time) * units) } - return time.Unix(0, 0).Add(time.Duration(t) * units), nil + return &t, err } // parseDuration parses the duration parameter of an HTTP request using the provided durationParser. diff --git a/cmd/query/app/querysvc/query_service.go b/cmd/query/app/querysvc/query_service.go index 135ecc60bbe..23b4d13ed40 100644 --- a/cmd/query/app/querysvc/query_service.go +++ b/cmd/query/app/querysvc/query_service.go @@ -60,13 +60,13 @@ func NewQueryService(spanReader spanstore.Reader, dependencyReader dependencysto } // GetTrace is the queryService implementation of spanstore.Reader.GetTrace -func (qs QueryService) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - trace, err := qs.spanReader.GetTrace(ctx, traceID) +func (qs QueryService) GetTrace(ctx context.Context, query spanstore.TraceGetParameters) (*model.Trace, error) { + trace, err := qs.spanReader.GetTrace(ctx, query) if errors.Is(err, spanstore.ErrTraceNotFound) { if qs.options.ArchiveSpanReader == nil { return nil, err } - trace, err = qs.options.ArchiveSpanReader.GetTrace(ctx, traceID) + trace, err = qs.options.ArchiveSpanReader.GetTrace(ctx, query) } return trace, err } @@ -90,11 +90,11 @@ func (qs QueryService) FindTraces(ctx context.Context, query *spanstore.TraceQue } // ArchiveTrace is the queryService utility to archive traces. -func (qs QueryService) ArchiveTrace(ctx context.Context, traceID model.TraceID) error { +func (qs QueryService) ArchiveTrace(ctx context.Context, query spanstore.TraceGetParameters) error { if qs.options.ArchiveSpanWriter == nil { return errNoArchiveSpanStorage } - trace, err := qs.GetTrace(ctx, traceID) + trace, err := qs.GetTrace(ctx, query) if err != nil { return err } diff --git a/cmd/query/app/querysvc/query_service_test.go b/cmd/query/app/querysvc/query_service_test.go index 582a4568509..fae51e8e6e3 100644 --- a/cmd/query/app/querysvc/query_service_test.go +++ b/cmd/query/app/querysvc/query_service_test.go @@ -107,12 +107,13 @@ func initializeTestService(optionAppliers ...testOption) *testQueryService { // Test QueryService.GetTrace() func TestGetTraceSuccess(t *testing.T) { tqs := initializeTestService() - tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() type contextKey string ctx := context.Background() - res, err := tqs.queryService.GetTrace(context.WithValue(ctx, contextKey("foo"), "bar"), mockTraceID) + query := spanstore.TraceGetParameters{TraceID: mockTraceID} + res, err := tqs.queryService.GetTrace(context.WithValue(ctx, contextKey("foo"), "bar"), query) require.NoError(t, err) assert.Equal(t, res, mockTrace) } @@ -120,26 +121,28 @@ func TestGetTraceSuccess(t *testing.T) { // Test QueryService.GetTrace() without ArchiveSpanReader func TestGetTraceNotFound(t *testing.T) { tqs := initializeTestService() - tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() type contextKey string ctx := context.Background() - _, err := tqs.queryService.GetTrace(context.WithValue(ctx, contextKey("foo"), "bar"), mockTraceID) + query := spanstore.TraceGetParameters{TraceID: mockTraceID} + _, err := tqs.queryService.GetTrace(context.WithValue(ctx, contextKey("foo"), "bar"), query) assert.Equal(t, err, spanstore.ErrTraceNotFound) } // Test QueryService.GetTrace() with ArchiveSpanReader func TestGetTraceFromArchiveStorage(t *testing.T) { tqs := initializeTestService(withArchiveSpanReader()) - tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() - tqs.archiveSpanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + tqs.archiveSpanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() type contextKey string ctx := context.Background() - res, err := tqs.queryService.GetTrace(context.WithValue(ctx, contextKey("foo"), "bar"), mockTraceID) + query := spanstore.TraceGetParameters{TraceID: mockTraceID} + res, err := tqs.queryService.GetTrace(context.WithValue(ctx, contextKey("foo"), "bar"), query) require.NoError(t, err) assert.Equal(t, res, mockTrace) } @@ -202,35 +205,38 @@ func TestArchiveTraceNoOptions(t *testing.T) { type contextKey string ctx := context.Background() - err := tqs.queryService.ArchiveTrace(context.WithValue(ctx, contextKey("foo"), "bar"), mockTraceID) + query := spanstore.TraceGetParameters{TraceID: mockTraceID} + err := tqs.queryService.ArchiveTrace(context.WithValue(ctx, contextKey("foo"), "bar"), query) assert.Equal(t, errNoArchiveSpanStorage, err) } // Test QueryService.ArchiveTrace() with ArchiveSpanWriter but invalid traceID. func TestArchiveTraceWithInvalidTraceID(t *testing.T) { tqs := initializeTestService(withArchiveSpanReader(), withArchiveSpanWriter()) - tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() - tqs.archiveSpanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + tqs.archiveSpanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(nil, spanstore.ErrTraceNotFound).Once() type contextKey string ctx := context.Background() - err := tqs.queryService.ArchiveTrace(context.WithValue(ctx, contextKey("foo"), "bar"), mockTraceID) + query := spanstore.TraceGetParameters{TraceID: mockTraceID} + err := tqs.queryService.ArchiveTrace(context.WithValue(ctx, contextKey("foo"), "bar"), query) assert.Equal(t, spanstore.ErrTraceNotFound, err) } // Test QueryService.ArchiveTrace(), save error with ArchiveSpanWriter. func TestArchiveTraceWithArchiveWriterError(t *testing.T) { tqs := initializeTestService(withArchiveSpanWriter()) - tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() tqs.archiveSpanWriter.On("WriteSpan", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("*model.Span")). Return(errors.New("cannot save")).Times(2) type contextKey string ctx := context.Background() - joinErr := tqs.queryService.ArchiveTrace(context.WithValue(ctx, contextKey("foo"), "bar"), mockTraceID) + query := spanstore.TraceGetParameters{TraceID: mockTraceID} + joinErr := tqs.queryService.ArchiveTrace(context.WithValue(ctx, contextKey("foo"), "bar"), query) // There are two spans in the mockTrace, ArchiveTrace should return a wrapped error. require.EqualError(t, joinErr, "cannot save\ncannot save") } @@ -238,14 +244,15 @@ func TestArchiveTraceWithArchiveWriterError(t *testing.T) { // Test QueryService.ArchiveTrace() with correctly configured ArchiveSpanWriter. func TestArchiveTraceSuccess(t *testing.T) { tqs := initializeTestService(withArchiveSpanWriter()) - tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("model.TraceID")). + tqs.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("spanstore.TraceGetParameters")). Return(mockTrace, nil).Once() tqs.archiveSpanWriter.On("WriteSpan", mock.AnythingOfType("*context.valueCtx"), mock.AnythingOfType("*model.Span")). Return(nil).Times(2) type contextKey string ctx := context.Background() - err := tqs.queryService.ArchiveTrace(context.WithValue(ctx, contextKey("foo"), "bar"), mockTraceID) + query := spanstore.TraceGetParameters{TraceID: mockTraceID} + err := tqs.queryService.ArchiveTrace(context.WithValue(ctx, contextKey("foo"), "bar"), query) require.NoError(t, err) } diff --git a/idl b/idl index a97152c66d8..5f4ef400e82 160000 --- a/idl +++ b/idl @@ -1 +1 @@ -Subproject commit a97152c66d8f1562fcdcbbb85600d5f12c8aab9e +Subproject commit 5f4ef400e82545e8c26b1bb7910f93b16bcc13e0 diff --git a/jaeger-ui b/jaeger-ui index 6dbddd02cc4..5c6b04bd4c2 160000 --- a/jaeger-ui +++ b/jaeger-ui @@ -1 +1 @@ -Subproject commit 6dbddd02cc4ead13d3ab412aad90d5caa0a8907a +Subproject commit 5c6b04bd4c22818a43ba6f05cac79faa6af9aaa5 diff --git a/plugin/storage/badger/spanstore/read_write_test.go b/plugin/storage/badger/spanstore/read_write_test.go index 6fa17c497a8..6c0cd58629f 100644 --- a/plugin/storage/badger/spanstore/read_write_test.go +++ b/plugin/storage/badger/spanstore/read_write_test.go @@ -68,10 +68,10 @@ func TestWriteReadBack(t *testing.T) { } for i := 0; i < traces; i++ { - tr, err := sr.GetTrace(context.Background(), model.TraceID{ + tr, err := sr.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{ Low: uint64(i), High: 1, - }) + }}) require.NoError(t, err) assert.Len(t, tr.Spans, spans) @@ -291,7 +291,7 @@ func TestFindNothing(t *testing.T) { require.NoError(t, err) assert.Empty(t, trs) - tr, err := sr.GetTrace(context.Background(), model.TraceID{High: 0, Low: 0}) + tr, err := sr.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{Low: 0, High: 0}}) assert.Equal(t, spanstore.ErrTraceNotFound, err) assert.Nil(t, tr) }) @@ -418,10 +418,10 @@ func TestPersist(t *testing.T) { }) p(t, dir, func(t *testing.T, _ spanstore.Writer, sr spanstore.Reader) { - trace, err := sr.GetTrace(context.Background(), model.TraceID{ + trace, err := sr.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{ Low: uint64(1), High: 1, - }) + }}) require.NoError(t, err) assert.Equal(t, "operation-p", trace.Spans[0].OperationName) diff --git a/plugin/storage/badger/spanstore/reader.go b/plugin/storage/badger/spanstore/reader.go index 84c5212d775..481a32ccbc4 100644 --- a/plugin/storage/badger/spanstore/reader.go +++ b/plugin/storage/badger/spanstore/reader.go @@ -146,8 +146,8 @@ func (r *TraceReader) getTraces(traceIDs []model.TraceID) ([]*model.Trace, error } // GetTrace takes a traceID and returns a Trace associated with that traceID -func (r *TraceReader) GetTrace(_ context.Context, traceID model.TraceID) (*model.Trace, error) { - traces, err := r.getTraces([]model.TraceID{traceID}) +func (r *TraceReader) GetTrace(_ context.Context, query spanstore.TraceGetParameters) (*model.Trace, error) { + traces, err := r.getTraces([]model.TraceID{query.TraceID}) if err != nil { return nil, err } diff --git a/plugin/storage/badger/spanstore/rw_internal_test.go b/plugin/storage/badger/spanstore/rw_internal_test.go index 60828a8b80a..5cf0326ddc7 100644 --- a/plugin/storage/badger/spanstore/rw_internal_test.go +++ b/plugin/storage/badger/spanstore/rw_internal_test.go @@ -31,7 +31,7 @@ func TestEncodingTypes(t *testing.T) { err := sw.WriteSpan(context.Background(), &testSpan) require.NoError(t, err) - tr, err := rw.GetTrace(context.Background(), model.TraceID{Low: 0, High: 1}) + tr, err := rw.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{Low: 0, High: 1}}) require.NoError(t, err) assert.Len(t, tr.Spans, 1) }) @@ -74,7 +74,7 @@ func TestEncodingTypes(t *testing.T) { return nil }) - _, err = rw.GetTrace(context.Background(), model.TraceID{Low: 0, High: 1}) + _, err = rw.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{Low: 0, High: 1}}) require.EqualError(t, err, "unknown encoding type: 0x04") }) } diff --git a/plugin/storage/blackhole/blackhole.go b/plugin/storage/blackhole/blackhole.go index 5ffa51bb3af..3ca0428a3c2 100644 --- a/plugin/storage/blackhole/blackhole.go +++ b/plugin/storage/blackhole/blackhole.go @@ -36,7 +36,7 @@ func (*Store) WriteSpan(context.Context, *model.Span) error { } // GetTrace gets nothing. -func (*Store) GetTrace(context.Context, model.TraceID) (*model.Trace, error) { +func (*Store) GetTrace(context.Context, spanstore.TraceGetParameters) (*model.Trace, error) { return nil, spanstore.ErrTraceNotFound } diff --git a/plugin/storage/blackhole/blackhole_test.go b/plugin/storage/blackhole/blackhole_test.go index 236ce82406d..e025346b13d 100644 --- a/plugin/storage/blackhole/blackhole_test.go +++ b/plugin/storage/blackhole/blackhole_test.go @@ -37,7 +37,7 @@ func TestStoreWriteSpan(t *testing.T) { func TestStoreGetTrace(t *testing.T) { withBlackhole(func(store *Store) { - trace, err := store.GetTrace(context.Background(), model.NewTraceID(1, 2)) + trace, err := store.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: model.NewTraceID(1, 2)}) require.Error(t, err) assert.Nil(t, trace) }) diff --git a/plugin/storage/cassandra/savetracetest/main.go b/plugin/storage/cassandra/savetracetest/main.go index d2190f5511e..a1255fc0916 100644 --- a/plugin/storage/cassandra/savetracetest/main.go +++ b/plugin/storage/cassandra/savetracetest/main.go @@ -59,7 +59,7 @@ func main() { logger.Info("Saved span", zap.String("spanID", getSomeSpan().SpanID.String())) } s := getSomeSpan() - trace, err := spanReader.GetTrace(ctx, s.TraceID) + trace, err := spanReader.GetTrace(ctx, spanstore.TraceGetParameters{TraceID: s.TraceID}) if err != nil { logger.Fatal("Failed to read", zap.Error(err)) } else { diff --git a/plugin/storage/cassandra/spanstore/reader.go b/plugin/storage/cassandra/spanstore/reader.go index 88ba7b8f335..0dc5a52f71e 100644 --- a/plugin/storage/cassandra/spanstore/reader.go +++ b/plugin/storage/cassandra/spanstore/reader.go @@ -204,8 +204,8 @@ func (s *SpanReader) readTraceInSpan(_ context.Context, traceID dbmodel.TraceID) } // GetTrace takes a traceID and returns a Trace associated with that traceID -func (s *SpanReader) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - return s.readTrace(ctx, dbmodel.TraceIDFromDomain(traceID)) +func (s *SpanReader) GetTrace(ctx context.Context, query spanstore.TraceGetParameters) (*model.Trace, error) { + return s.readTrace(ctx, dbmodel.TraceIDFromDomain(query.TraceID)) } func validateQuery(p *spanstore.TraceQueryParameters) error { @@ -238,7 +238,7 @@ func (s *SpanReader) FindTraces(ctx context.Context, traceQuery *spanstore.Trace } var retMe []*model.Trace for _, traceID := range uniqueTraceIDs { - jTrace, err := s.GetTrace(ctx, traceID) + jTrace, err := s.GetTrace(ctx, spanstore.TraceGetParameters{TraceID: traceID}) if err != nil { s.logger.Error("Failure to read trace", zap.String("trace_id", traceID.String()), zap.Error(err)) continue diff --git a/plugin/storage/cassandra/spanstore/reader_test.go b/plugin/storage/cassandra/spanstore/reader_test.go index 28cd75c7b5e..1d41986a33b 100644 --- a/plugin/storage/cassandra/spanstore/reader_test.go +++ b/plugin/storage/cassandra/spanstore/reader_test.go @@ -171,7 +171,7 @@ func TestSpanReaderGetTrace(t *testing.T) { r.session.On("Query", mock.AnythingOfType("string"), matchEverything()).Return(query) - trace, err := r.reader.GetTrace(context.Background(), model.TraceID{}) + trace, err := r.reader.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{}}) if testCase.expectedErr == "" { require.NotEmpty(t, r.traceBuffer.GetSpans(), "Spans recorded") require.NoError(t, err) @@ -198,7 +198,7 @@ func TestSpanReaderGetTrace_TraceNotFound(t *testing.T) { r.session.On("Query", mock.AnythingOfType("string"), matchEverything()).Return(query) - trace, err := r.reader.GetTrace(context.Background(), model.TraceID{}) + trace, err := r.reader.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{}}) require.NotEmpty(t, r.traceBuffer.GetSpans(), "Spans recorded") assert.Nil(t, trace) require.EqualError(t, err, "trace not found") diff --git a/plugin/storage/es/spanstore/reader.go b/plugin/storage/es/spanstore/reader.go index accd1932e53..86f489c86b1 100644 --- a/plugin/storage/es/spanstore/reader.go +++ b/plugin/storage/es/spanstore/reader.go @@ -232,11 +232,11 @@ func timeRangeIndices(indexName, indexDateLayout string, startTime time.Time, en } // GetTrace takes a traceID and returns a Trace associated with that traceID -func (s *SpanReader) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { +func (s *SpanReader) GetTrace(ctx context.Context, query spanstore.TraceGetParameters) (*model.Trace, error) { ctx, span := s.tracer.Start(ctx, "GetTrace") defer span.End() currentTime := time.Now() - traces, err := s.multiRead(ctx, []model.TraceID{traceID}, currentTime.Add(-s.maxSpanAge), currentTime) + traces, err := s.multiRead(ctx, []model.TraceID{query.TraceID}, currentTime.Add(-s.maxSpanAge), currentTime) if err != nil { return nil, es.DetailedError(err) } diff --git a/plugin/storage/es/spanstore/reader_test.go b/plugin/storage/es/spanstore/reader_test.go index 3b292008dcd..4459655c3b4 100644 --- a/plugin/storage/es/spanstore/reader_test.go +++ b/plugin/storage/es/spanstore/reader_test.go @@ -330,8 +330,8 @@ func TestSpanReader_GetTrace(t *testing.T) { {Hits: searchHits}, }, }, nil) - - trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1)) + query := spanstore.TraceGetParameters{TraceID: model.NewTraceID(0, 1)} + trace, err := r.reader.GetTrace(context.Background(), query) require.NotEmpty(t, r.traceBuffer.GetSpans(), "Spans recorded") require.NoError(t, err) require.NotNil(t, trace) @@ -446,7 +446,8 @@ func TestSpanReader_SearchAfter(t *testing.T) { }, }, nil).Times(2) - trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1)) + query := spanstore.TraceGetParameters{TraceID: model.NewTraceID(0, 1)} + trace, err := r.reader.GetTrace(context.Background(), query) require.NotEmpty(t, r.traceBuffer.GetSpans(), "Spans recorded") require.NoError(t, err) require.NotNil(t, trace) @@ -466,7 +467,8 @@ func TestSpanReader_GetTraceQueryError(t *testing.T) { Return(&elastic.MultiSearchResult{ Responses: []*elastic.SearchResult{}, }, nil) - trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1)) + query := spanstore.TraceGetParameters{TraceID: model.NewTraceID(0, 1)} + trace, err := r.reader.GetTrace(context.Background(), query) require.NotEmpty(t, r.traceBuffer.GetSpans(), "Spans recorded") require.EqualError(t, err, "trace not found") require.Nil(t, trace) @@ -486,7 +488,8 @@ func TestSpanReader_GetTraceNilHits(t *testing.T) { }, }, nil) - trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1)) + query := spanstore.TraceGetParameters{TraceID: model.NewTraceID(0, 1)} + trace, err := r.reader.GetTrace(context.Background(), query) require.NotEmpty(t, r.traceBuffer.GetSpans(), "Spans recorded") require.EqualError(t, err, "trace not found") require.Nil(t, trace) @@ -510,7 +513,8 @@ func TestSpanReader_GetTraceInvalidSpanError(t *testing.T) { }, }, nil) - trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1)) + query := spanstore.TraceGetParameters{TraceID: model.NewTraceID(0, 1)} + trace, err := r.reader.GetTrace(context.Background(), query) require.NotEmpty(t, r.traceBuffer.GetSpans(), "Spans recorded") require.Error(t, err, "invalid span") require.Nil(t, trace) @@ -535,7 +539,8 @@ func TestSpanReader_GetTraceSpanConversionError(t *testing.T) { }, }, nil) - trace, err := r.reader.GetTrace(context.Background(), model.NewTraceID(0, 1)) + query := spanstore.TraceGetParameters{TraceID: model.NewTraceID(0, 1)} + trace, err := r.reader.GetTrace(context.Background(), query) require.NotEmpty(t, r.traceBuffer.GetSpans(), "Spans recorded") require.Error(t, err, "span conversion error, because lacks elements") require.Nil(t, trace) @@ -1272,8 +1277,8 @@ func TestSpanReader_ArchiveTraces(t *testing.T) { Return(&elastic.MultiSearchResult{ Responses: []*elastic.SearchResult{}, }, nil) - - trace, err := r.reader.GetTrace(context.Background(), model.TraceID{}) + query := spanstore.TraceGetParameters{TraceID: model.TraceID{}} + trace, err := r.reader.GetTrace(context.Background(), query) require.NotEmpty(t, r.traceBuffer.GetSpans(), "Spans recorded") require.Nil(t, trace) require.EqualError(t, err, "trace not found") @@ -1289,7 +1294,8 @@ func TestSpanReader_ArchiveTraces_ReadAlias(t *testing.T) { Responses: []*elastic.SearchResult{}, }, nil) - trace, err := r.reader.GetTrace(context.Background(), model.TraceID{}) + query := spanstore.TraceGetParameters{TraceID: model.TraceID{}} + trace, err := r.reader.GetTrace(context.Background(), query) require.NotEmpty(t, r.traceBuffer.GetSpans(), "Spans recorded") require.Nil(t, trace) require.EqualError(t, err, "trace not found") diff --git a/plugin/storage/grpc/proto/storage.proto b/plugin/storage/grpc/proto/storage.proto index 51c804948fb..f49c16b2b08 100644 --- a/plugin/storage/grpc/proto/storage.proto +++ b/plugin/storage/grpc/proto/storage.proto @@ -72,6 +72,14 @@ message GetTraceRequest { (gogoproto.customtype) = "github.com/jaegertracing/jaeger/model.TraceID", (gogoproto.customname) = "TraceID" ]; + google.protobuf.Timestamp start_time = 2 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = true + ]; + google.protobuf.Timestamp end_time = 3 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = true + ]; } message GetServicesRequest {} diff --git a/plugin/storage/grpc/shared/archive.go b/plugin/storage/grpc/shared/archive.go index 2bd14685d27..c1748b0c8bb 100644 --- a/plugin/storage/grpc/shared/archive.go +++ b/plugin/storage/grpc/shared/archive.go @@ -32,9 +32,11 @@ type archiveWriter struct { } // GetTrace takes a traceID and returns a Trace associated with that traceID from Archive Storage -func (r *archiveReader) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { +func (r *archiveReader) GetTrace(ctx context.Context, q spanstore.TraceGetParameters) (*model.Trace, error) { stream, err := r.client.GetArchiveTrace(ctx, &storage_v1.GetTraceRequest{ - TraceID: traceID, + TraceID: q.TraceID, + StartTime: q.StartTime, + EndTime: q.EndTime, }) if status.Code(err) == codes.NotFound { return nil, spanstore.ErrTraceNotFound diff --git a/plugin/storage/grpc/shared/archive_test.go b/plugin/storage/grpc/shared/archive_test.go index 75857f9e3cc..e1005b7153a 100644 --- a/plugin/storage/grpc/shared/archive_test.go +++ b/plugin/storage/grpc/shared/archive_test.go @@ -59,7 +59,9 @@ func TestArchiveReader_GetTrace(t *testing.T) { }).Return(traceClient, nil) reader := &archiveReader{client: archiveSpanReader} - trace, err := reader.GetTrace(context.Background(), mockTraceID) + trace, err := reader.GetTrace(context.Background(), spanstore.TraceGetParameters{ + TraceID: mockTraceID, + }) require.NoError(t, err) assert.Equal(t, expected, trace) } @@ -73,7 +75,9 @@ func TestArchiveReaderGetTrace_NoTrace(t *testing.T) { }).Return(nil, status.Errorf(codes.NotFound, "")) reader := &archiveReader{client: archiveSpanReader} - _, err := reader.GetTrace(context.Background(), mockTraceID) + _, err := reader.GetTrace(context.Background(), spanstore.TraceGetParameters{ + TraceID: mockTraceID, + }) assert.Equal(t, spanstore.ErrTraceNotFound, err) } diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index 4469e9ce2b7..0f39ec0019f 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -81,9 +81,11 @@ func (c *GRPCClient) ArchiveSpanWriter() spanstore.Writer { } // GetTrace takes a traceID and returns a Trace associated with that traceID -func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { +func (c *GRPCClient) GetTrace(ctx context.Context, query spanstore.TraceGetParameters) (*model.Trace, error) { stream, err := c.readerClient.GetTrace(ctx, &storage_v1.GetTraceRequest{ - TraceID: traceID, + TraceID: query.TraceID, + StartTime: query.StartTime, + EndTime: query.EndTime, }) if status.Code(err) == codes.NotFound { return nil, spanstore.ErrTraceNotFound diff --git a/plugin/storage/grpc/shared/grpc_client_test.go b/plugin/storage/grpc/shared/grpc_client_test.go index a8bb88fcf34..8ff12534e08 100644 --- a/plugin/storage/grpc/shared/grpc_client_test.go +++ b/plugin/storage/grpc/shared/grpc_client_test.go @@ -157,13 +157,17 @@ func TestGRPCClientGetOperationsV2(t *testing.T) { func TestGRPCClientGetTrace(t *testing.T) { withGRPCClient(func(r *grpcClientTest) { + startTime := time.Date(2020, time.January, 1, 13, 0, 0, 0, time.UTC) + endTime := time.Date(2020, time.January, 1, 14, 0, 0, 0, time.UTC) traceClient := new(grpcMocks.SpanReaderPlugin_GetTraceClient) traceClient.On("Recv").Return(&storage_v1.SpansResponseChunk{ Spans: mockTraceSpans, }, nil).Once() traceClient.On("Recv").Return(nil, io.EOF) r.spanReader.On("GetTrace", mock.Anything, &storage_v1.GetTraceRequest{ - TraceID: mockTraceID, + TraceID: mockTraceID, + StartTime: &startTime, + EndTime: &endTime, }).Return(traceClient, nil) var expectedSpans []*model.Span @@ -171,7 +175,11 @@ func TestGRPCClientGetTrace(t *testing.T) { expectedSpans = append(expectedSpans, &mockTraceSpans[i]) } - s, err := r.client.GetTrace(context.Background(), mockTraceID) + s, err := r.client.GetTrace(context.Background(), spanstore.TraceGetParameters{ + TraceID: mockTraceID, + StartTime: &startTime, + EndTime: &endTime, + }) require.NoError(t, err) assert.Equal(t, &model.Trace{ Spans: expectedSpans, @@ -187,7 +195,7 @@ func TestGRPCClientGetTrace_StreamError(t *testing.T) { TraceID: mockTraceID, }).Return(traceClient, nil) - s, err := r.client.GetTrace(context.Background(), mockTraceID) + s, err := r.client.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: mockTraceID}) require.Error(t, err) assert.Nil(t, s) }) @@ -199,7 +207,7 @@ func TestGRPCClientGetTrace_NoTrace(t *testing.T) { TraceID: mockTraceID, }).Return(nil, status.Errorf(codes.NotFound, "")) - s, err := r.client.GetTrace(context.Background(), mockTraceID) + s, err := r.client.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: mockTraceID}) assert.Equal(t, spanstore.ErrTraceNotFound, err) assert.Nil(t, s) }) @@ -215,7 +223,7 @@ func TestGRPCClientGetTrace_StreamErrorTraceNotFound(t *testing.T) { TraceID: mockTraceID, }).Return(traceClient, nil) - s, err := r.client.GetTrace(context.Background(), mockTraceID) + s, err := r.client.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: mockTraceID}) assert.Equal(t, spanstore.ErrTraceNotFound, err) assert.Nil(t, s) }) @@ -364,13 +372,17 @@ func TestGrpcClientStreamWriterWriteSpan(t *testing.T) { func TestGrpcClientGetArchiveTrace(t *testing.T) { withGRPCClient(func(r *grpcClientTest) { + startTime := time.Date(2020, time.January, 1, 13, 0, 0, 0, time.UTC) + endTime := time.Date(2020, time.January, 1, 14, 0, 0, 0, time.UTC) traceClient := new(grpcMocks.ArchiveSpanReaderPlugin_GetArchiveTraceClient) traceClient.On("Recv").Return(&storage_v1.SpansResponseChunk{ Spans: mockTraceSpans, }, nil).Once() traceClient.On("Recv").Return(nil, io.EOF) r.archiveReader.On("GetArchiveTrace", mock.Anything, &storage_v1.GetTraceRequest{ - TraceID: mockTraceID, + TraceID: mockTraceID, + StartTime: &startTime, + EndTime: &endTime, }).Return(traceClient, nil) var expectedSpans []*model.Span @@ -378,7 +390,11 @@ func TestGrpcClientGetArchiveTrace(t *testing.T) { expectedSpans = append(expectedSpans, &mockTraceSpans[i]) } - s, err := r.client.ArchiveSpanReader().GetTrace(context.Background(), mockTraceID) + s, err := r.client.ArchiveSpanReader().GetTrace(context.Background(), spanstore.TraceGetParameters{ + TraceID: mockTraceID, + StartTime: &startTime, + EndTime: &endTime, + }) require.NoError(t, err) assert.Equal(t, &model.Trace{ Spans: expectedSpans, @@ -394,7 +410,9 @@ func TestGrpcClientGetArchiveTrace_StreamError(t *testing.T) { TraceID: mockTraceID, }).Return(traceClient, nil) - s, err := r.client.ArchiveSpanReader().GetTrace(context.Background(), mockTraceID) + s, err := r.client.ArchiveSpanReader().GetTrace(context.Background(), spanstore.TraceGetParameters{ + TraceID: mockTraceID, + }) require.Error(t, err) assert.Nil(t, s) }) @@ -406,7 +424,9 @@ func TestGrpcClientGetArchiveTrace_NoTrace(t *testing.T) { TraceID: mockTraceID, }).Return(nil, spanstore.ErrTraceNotFound) - s, err := r.client.ArchiveSpanReader().GetTrace(context.Background(), mockTraceID) + s, err := r.client.ArchiveSpanReader().GetTrace(context.Background(), spanstore.TraceGetParameters{ + TraceID: mockTraceID, + }) require.Error(t, err) assert.Nil(t, s) }) @@ -420,7 +440,9 @@ func TestGrpcClientGetArchiveTrace_StreamErrorTraceNotFound(t *testing.T) { TraceID: mockTraceID, }).Return(traceClient, nil) - s, err := r.client.ArchiveSpanReader().GetTrace(context.Background(), mockTraceID) + s, err := r.client.ArchiveSpanReader().GetTrace(context.Background(), spanstore.TraceGetParameters{ + TraceID: mockTraceID, + }) assert.Equal(t, spanstore.ErrTraceNotFound, err) assert.Nil(t, s) }) diff --git a/plugin/storage/grpc/shared/grpc_handler.go b/plugin/storage/grpc/shared/grpc_handler.go index 564a625ebf0..ba3d3f49605 100644 --- a/plugin/storage/grpc/shared/grpc_handler.go +++ b/plugin/storage/grpc/shared/grpc_handler.go @@ -151,7 +151,11 @@ func (s *GRPCHandler) Close(context.Context, *storage_v1.CloseWriterRequest) (*s // GetTrace takes a traceID and streams a Trace associated with that traceID func (s *GRPCHandler) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.SpanReaderPlugin_GetTraceServer) error { - trace, err := s.impl.SpanReader().GetTrace(stream.Context(), r.TraceID) + trace, err := s.impl.SpanReader().GetTrace(stream.Context(), spanstore.TraceGetParameters{ + TraceID: r.TraceID, + StartTime: r.StartTime, + EndTime: r.EndTime, + }) if errors.Is(err, spanstore.ErrTraceNotFound) { return status.Error(codes.NotFound, spanstore.ErrTraceNotFound.Error()) } @@ -276,7 +280,11 @@ func (s *GRPCHandler) GetArchiveTrace(r *storage_v1.GetTraceRequest, stream stor if reader == nil { return status.Error(codes.Unimplemented, "not implemented") } - trace, err := reader.GetTrace(stream.Context(), r.TraceID) + trace, err := reader.GetTrace(stream.Context(), spanstore.TraceGetParameters{ + TraceID: r.TraceID, + StartTime: r.StartTime, + EndTime: r.EndTime, + }) if errors.Is(err, spanstore.ErrTraceNotFound) { return status.Error(codes.NotFound, spanstore.ErrTraceNotFound.Error()) } diff --git a/plugin/storage/grpc/shared/grpc_handler_test.go b/plugin/storage/grpc/shared/grpc_handler_test.go index a6fd5079143..9a688786035 100644 --- a/plugin/storage/grpc/shared/grpc_handler_test.go +++ b/plugin/storage/grpc/shared/grpc_handler_test.go @@ -136,7 +136,7 @@ func TestGRPCServerGetTrace(t *testing.T) { for i := range mockTraceSpans { traceSpans = append(traceSpans, &mockTraceSpans[i]) } - r.impl.spanReader.On("GetTrace", mock.Anything, mockTraceID). + r.impl.spanReader.On("GetTrace", mock.Anything, spanstore.TraceGetParameters{TraceID: mockTraceID}). Return(&model.Trace{Spans: traceSpans}, nil) err := r.server.GetTrace(&storage_v1.GetTraceRequest{ @@ -151,7 +151,7 @@ func TestGRPCServerGetTrace_NotFound(t *testing.T) { traceSteam := new(grpcMocks.SpanReaderPlugin_GetTraceServer) traceSteam.On("Context").Return(context.Background()) - r.impl.spanReader.On("GetTrace", mock.Anything, mockTraceID). + r.impl.spanReader.On("GetTrace", mock.Anything, spanstore.TraceGetParameters{TraceID: mockTraceID}). Return(nil, spanstore.ErrTraceNotFound) err := r.server.GetTrace(&storage_v1.GetTraceRequest{ @@ -284,7 +284,7 @@ func TestGRPCServerGetArchiveTrace(t *testing.T) { for i := range mockTraceSpans { traceSpans = append(traceSpans, &mockTraceSpans[i]) } - r.impl.archiveReader.On("GetTrace", mock.Anything, mockTraceID). + r.impl.archiveReader.On("GetTrace", mock.Anything, spanstore.TraceGetParameters{TraceID: mockTraceID}). Return(&model.Trace{Spans: traceSpans}, nil) err := r.server.GetArchiveTrace(&storage_v1.GetTraceRequest{ @@ -299,7 +299,7 @@ func TestGRPCServerGetArchiveTrace_NotFound(t *testing.T) { traceSteam := new(grpcMocks.SpanReaderPlugin_GetTraceServer) traceSteam.On("Context").Return(context.Background()) - r.impl.archiveReader.On("GetTrace", mock.Anything, mockTraceID). + r.impl.archiveReader.On("GetTrace", mock.Anything, spanstore.TraceGetParameters{TraceID: mockTraceID}). Return(nil, spanstore.ErrTraceNotFound) err := r.server.GetArchiveTrace(&storage_v1.GetTraceRequest{ @@ -314,7 +314,7 @@ func TestGRPCServerGetArchiveTrace_Error(t *testing.T) { traceSteam := new(grpcMocks.SpanReaderPlugin_GetTraceServer) traceSteam.On("Context").Return(context.Background()) - r.impl.archiveReader.On("GetTrace", mock.Anything, mockTraceID). + r.impl.archiveReader.On("GetTrace", mock.Anything, spanstore.TraceGetParameters{TraceID: mockTraceID}). Return(nil, fmt.Errorf("some error")) err := r.server.GetArchiveTrace(&storage_v1.GetTraceRequest{ @@ -329,7 +329,7 @@ func TestGRPCServerGetArchiveTrace_NoImpl(t *testing.T) { r.server.impl.ArchiveSpanReader = func() spanstore.Reader { return nil } traceSteam := new(grpcMocks.SpanReaderPlugin_GetTraceServer) - r.impl.archiveReader.On("GetTrace", mock.Anything, mockTraceID). + r.impl.archiveReader.On("GetTrace", mock.Anything, spanstore.TraceGetParameters{TraceID: mockTraceID}). Return(nil, fmt.Errorf("some error")) err := r.server.GetArchiveTrace(&storage_v1.GetTraceRequest{ @@ -350,7 +350,7 @@ func TestGRPCServerGetArchiveTrace_StreamError(t *testing.T) { for i := range mockTraceSpans { traceSpans = append(traceSpans, &mockTraceSpans[i]) } - r.impl.archiveReader.On("GetTrace", mock.Anything, mockTraceID). + r.impl.archiveReader.On("GetTrace", mock.Anything, spanstore.TraceGetParameters{TraceID: mockTraceID}). Return(&model.Trace{Spans: traceSpans}, nil) err := r.server.GetArchiveTrace(&storage_v1.GetTraceRequest{ diff --git a/plugin/storage/integration/integration.go b/plugin/storage/integration/integration.go index 243cc8c9a1c..b3b5b6b08e2 100644 --- a/plugin/storage/integration/integration.go +++ b/plugin/storage/integration/integration.go @@ -198,7 +198,7 @@ func (s *StorageIntegration) testArchiveTrace(t *testing.T) { var actual *model.Trace found := s.waitForCondition(t, func(_ *testing.T) bool { var err error - actual, err = s.ArchiveSpanReader.GetTrace(context.Background(), tID) + actual, err = s.ArchiveSpanReader.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: tID}) return err == nil && len(actual.Spans) == 1 }) require.True(t, found) @@ -216,7 +216,7 @@ func (s *StorageIntegration) testGetLargeSpan(t *testing.T) { var actual *model.Trace found := s.waitForCondition(t, func(_ *testing.T) bool { var err error - actual, err = s.SpanReader.GetTrace(context.Background(), expectedTraceID) + actual, err = s.SpanReader.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: expectedTraceID}) return err == nil && len(actual.Spans) >= len(expected.Spans) }) if !assert.True(t, found) { @@ -276,7 +276,7 @@ func (s *StorageIntegration) testGetTrace(t *testing.T) { var actual *model.Trace found := s.waitForCondition(t, func(t *testing.T) bool { var err error - actual, err = s.SpanReader.GetTrace(context.Background(), expectedTraceID) + actual, err = s.SpanReader.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: expectedTraceID}) if err != nil { t.Log(err) } @@ -288,7 +288,7 @@ func (s *StorageIntegration) testGetTrace(t *testing.T) { t.Run("NotFound error", func(t *testing.T) { fakeTraceID := model.TraceID{High: 0, Low: 1} - trace, err := s.SpanReader.GetTrace(context.Background(), fakeTraceID) + trace, err := s.SpanReader.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: fakeTraceID}) assert.Equal(t, spanstore.ErrTraceNotFound, err) assert.Nil(t, trace) }) diff --git a/plugin/storage/integration/kafka_test.go b/plugin/storage/integration/kafka_test.go index ef3528baf65..ee1e2cf65fa 100644 --- a/plugin/storage/integration/kafka_test.go +++ b/plugin/storage/integration/kafka_test.go @@ -95,8 +95,8 @@ type ingester struct { traceStore *memory.Store } -func (r *ingester) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - return r.traceStore.GetTrace(ctx, traceID) +func (r *ingester) GetTrace(ctx context.Context, query spanstore.TraceGetParameters) (*model.Trace, error) { + return r.traceStore.GetTrace(ctx, query) } func (*ingester) GetServices(context.Context) ([]string, error) { diff --git a/plugin/storage/memory/memory.go b/plugin/storage/memory/memory.go index 48276aabffb..1d6dacd6d13 100644 --- a/plugin/storage/memory/memory.go +++ b/plugin/storage/memory/memory.go @@ -182,11 +182,11 @@ func (st *Store) WriteSpan(ctx context.Context, span *model.Span) error { } // GetTrace gets a trace -func (st *Store) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { +func (st *Store) GetTrace(ctx context.Context, query spanstore.TraceGetParameters) (*model.Trace, error) { m := st.getTenant(tenancy.GetTenant(ctx)) m.RLock() defer m.RUnlock() - trace, ok := m.traces[traceID] + trace, ok := m.traces[query.TraceID] if !ok { return nil, spanstore.ErrTraceNotFound } diff --git a/plugin/storage/memory/memory_test.go b/plugin/storage/memory/memory_test.go index 7005c273b33..55e17bcd8d3 100644 --- a/plugin/storage/memory/memory_test.go +++ b/plugin/storage/memory/memory_test.go @@ -187,7 +187,8 @@ func TestStoreWithLimit(t *testing.T) { func TestStoreGetTraceSuccess(t *testing.T) { withPopulatedMemoryStore(func(store *Store) { - trace, err := store.GetTrace(context.Background(), testingSpan.TraceID) + query := spanstore.TraceGetParameters{TraceID: testingSpan.TraceID} + trace, err := store.GetTrace(context.Background(), query) require.NoError(t, err) assert.Len(t, trace.Spans, 1) assert.Equal(t, testingSpan, trace.Spans[0]) @@ -196,7 +197,8 @@ func TestStoreGetTraceSuccess(t *testing.T) { func TestStoreGetAndMutateTrace(t *testing.T) { withPopulatedMemoryStore(func(store *Store) { - trace, err := store.GetTrace(context.Background(), testingSpan.TraceID) + query := spanstore.TraceGetParameters{TraceID: testingSpan.TraceID} + trace, err := store.GetTrace(context.Background(), query) require.NoError(t, err) assert.Len(t, trace.Spans, 1) assert.Equal(t, testingSpan, trace.Spans[0]) @@ -204,7 +206,7 @@ func TestStoreGetAndMutateTrace(t *testing.T) { trace.Spans[0].Warnings = append(trace.Spans[0].Warnings, "the end is near") - trace, err = store.GetTrace(context.Background(), testingSpan.TraceID) + trace, err = store.GetTrace(context.Background(), query) require.NoError(t, err) assert.Len(t, trace.Spans, 1) assert.Equal(t, testingSpan, trace.Spans[0]) @@ -217,14 +219,16 @@ func TestStoreGetTraceError(t *testing.T) { store.getTenant("").traces[testingSpan.TraceID] = &model.Trace{ Spans: []*model.Span{nonSerializableSpan}, } - _, err := store.GetTrace(context.Background(), testingSpan.TraceID) + query := spanstore.TraceGetParameters{TraceID: testingSpan.TraceID} + _, err := store.GetTrace(context.Background(), query) require.Error(t, err) }) } func TestStoreGetTraceFailure(t *testing.T) { withPopulatedMemoryStore(func(store *Store) { - trace, err := store.GetTrace(context.Background(), model.TraceID{}) + query := spanstore.TraceGetParameters{TraceID: model.TraceID{}} + trace, err := store.GetTrace(context.Background(), query) require.EqualError(t, err, spanstore.ErrTraceNotFound.Error()) assert.Nil(t, trace) }) @@ -448,12 +452,14 @@ func TestTenantStore(t *testing.T) { require.NoError(t, store.WriteSpan(ctxWonka, testingSpan2)) // Can we retrieve the spans with correct tenancy - trace1, err := store.GetTrace(ctxAcme, testingSpan.TraceID) + query := spanstore.TraceGetParameters{TraceID: testingSpan.TraceID} + trace1, err := store.GetTrace(ctxAcme, query) require.NoError(t, err) assert.Len(t, trace1.Spans, 1) assert.Equal(t, testingSpan, trace1.Spans[0]) - trace2, err := store.GetTrace(ctxWonka, testingSpan2.TraceID) + query2 := spanstore.TraceGetParameters{TraceID: testingSpan2.TraceID} + trace2, err := store.GetTrace(ctxWonka, query2) require.NoError(t, err) assert.Len(t, trace2.Spans, 1) assert.Equal(t, testingSpan2, trace2.Spans[0]) @@ -476,13 +482,13 @@ func TestTenantStore(t *testing.T) { assert.Equal(t, testingSpan2, traces2[0].Spans[0]) // Do the spans fail with incorrect tenancy? - _, err = store.GetTrace(ctxAcme, testingSpan2.TraceID) + _, err = store.GetTrace(ctxAcme, query2) require.Error(t, err) - _, err = store.GetTrace(ctxWonka, testingSpan.TraceID) + _, err = store.GetTrace(ctxWonka, query) require.Error(t, err) - _, err = store.GetTrace(context.Background(), testingSpan.TraceID) + _, err = store.GetTrace(context.Background(), query) require.Error(t, err) }) } diff --git a/proto-gen/api_v2/query.pb.go b/proto-gen/api_v2/query.pb.go index c4898c6c876..9922d60cf96 100644 --- a/proto-gen/api_v2/query.pb.go +++ b/proto-gen/api_v2/query.pb.go @@ -771,69 +771,70 @@ func init() { func init() { proto.RegisterFile("query.proto", fileDescriptor_5c6ac9b241082464) } var fileDescriptor_5c6ac9b241082464 = []byte{ - // 983 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4f, 0x73, 0xdb, 0x44, - 0x14, 0x47, 0x8e, 0x1d, 0xdb, 0x4f, 0x76, 0x4b, 0xd7, 0x4e, 0x2b, 0x54, 0xb0, 0x1d, 0x85, 0x76, - 0x32, 0xcc, 0x44, 0x2a, 0xe6, 0x40, 0x29, 0xcc, 0x94, 0xa6, 0x69, 0x3d, 0x05, 0x5a, 0x40, 0xcd, - 0x09, 0x0e, 0x9e, 0x8d, 0xb5, 0xc8, 0xc2, 0xf1, 0xca, 0x95, 0xd6, 0x21, 0x1e, 0x86, 0x0b, 0x9f, - 0x80, 0x19, 0x2e, 0x9c, 0xb8, 0x72, 0xe2, 0x7b, 0xf4, 0xc8, 0x0c, 0x37, 0x0e, 0x81, 0xc9, 0x70, - 0xe4, 0xc0, 0x47, 0x60, 0xf6, 0x8f, 0x14, 0x49, 0xce, 0xa4, 0x69, 0xae, 0x9c, 0x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0x16, 0xa0, 0xc6, 0x5b, 0x27, 0x8a, 0xd0, - 0x48, 0x6b, 0xf8, 0x38, 0xa0, 0x45, 0x2c, 0x7c, 0x68, 0x54, 0x2e, 0x86, 0x85, 0x0f, 0xd1, 0x43, - 0x68, 0x24, 0x84, 0x14, 0x51, 0xad, 0x0a, 0xa4, 0xd7, 0x96, 0x90, 0x76, 0x94, 0x92, 0x04, 0xfa, - 0x89, 0x03, 0xe9, 0x89, 0x21, 0x8f, 0x29, 0x87, 0x83, 0x0f, 0x8d, 0xea, 0x45, 0x70, 0xf0, 0xa1, - 0x6c, 0x1a, 0x8e, 0x46, 0xe3, 0xa1, 0x47, 0x66, 0x6c, 0x6c, 0xd4, 0x7a, 0xda, 0x66, 0x85, 0x37, - 0x8d, 0xcb, 0x76, 0xb8, 0xc8, 0x7c, 0x17, 0xea, 0x69, 0x75, 0xd1, 0xab, 0xb0, 0x32, 0x21, 0x0b, - 0xd5, 0x5b, 0xfe, 0x89, 0xda, 0x50, 0x39, 0xc0, 0xfb, 0xf3, 0xa4, 0x95, 0xf2, 0x70, 0xa7, 0x74, - 0x5b, 0xb3, 0x9e, 0xc0, 0x95, 0x87, 0x01, 0xf5, 0x44, 0xbf, 0xe2, 0x84, 0x31, 0xef, 0x41, 0x45, - 0xec, 0x47, 0x01, 0xa1, 0xf7, 0x37, 0xce, 0xd1, 0x5c, 0x57, 0x5a, 0x58, 0x6d, 0x40, 0x03, 0xc2, - 0x9e, 0xca, 0x79, 0x4a, 0x00, 0xad, 0xb7, 0xa1, 0x95, 0x93, 0xca, 0x31, 0x45, 0x26, 0xd4, 0xd4, - 0xe4, 0x49, 0x96, 0xd7, 0xdd, 0xf4, 0x6c, 0x3d, 0x86, 0xf6, 0x80, 0xb0, 0x4f, 0x93, 0x99, 0x4b, - 0x63, 0x33, 0xa0, 0xaa, 0x74, 0x54, 0x82, 0xc9, 0x11, 0x5d, 0x87, 0x3a, 0x5f, 0x04, 0xc3, 0x49, - 0x40, 0x3d, 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xd7, 0x85, 0xdb, 0x35, 0xab, 0xe5, 0x60, 0x79, - 0x9d, 0xf1, 0x8b, 0x7c, 0x80, 0x13, 0x66, 0xa2, 0x5e, 0x01, 0x6f, 0x89, 0xb4, 0xe7, 0x49, 0x13, - 0x09, 0x7f, 0x0d, 0xab, 0xea, 0xc8, 0xdd, 0x71, 0x47, 0x7b, 0xeb, 0x96, 0x86, 0x7c, 0xd0, 0x33, - 0xe4, 0x44, 0xeb, 0xcb, 0xe5, 0x2c, 0xd0, 0xd9, 0xb4, 0xce, 0x52, 0x51, 0xb9, 0x5d, 0x11, 0xbe, - 0x74, 0x54, 0x77, 0x12, 0x4a, 0xa3, 0x10, 0x9a, 0x39, 0x16, 0xa1, 0x8d, 0x65, 0x9c, 0x25, 0xc2, - 0x9b, 0x6f, 0x9e, 0xad, 0xa4, 0xdc, 0xb5, 0x84, 0xbb, 0x26, 0xd2, 0x9d, 0x13, 0xee, 0xa0, 0x6f, - 0xc4, 0xdf, 0xa8, 0xec, 0x68, 0xa2, 0x1b, 0xcb, 0x68, 0xa7, 0x50, 0xcb, 0xbc, 0xf9, 0x22, 0x35, - 0xe5, 0x76, 0x4d, 0xb8, 0xbd, 0x8c, 0x9a, 0x4e, 0x76, 0x5e, 0xb7, 0xb7, 0x9e, 0x1f, 0x77, 0xb4, - 0xdf, 0x8e, 0x3b, 0xda, 0x5f, 0xc7, 0x1d, 0x0d, 0xae, 0x05, 0xa1, 0x9d, 0xfb, 0x7b, 0xa1, 0x50, - 0xbf, 0x58, 0x95, 0xbf, 0x7b, 0xab, 0x82, 0x69, 0xef, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xe1, - 0x8b, 0x00, 0xa9, 0x96, 0x0a, 0x00, 0x00, + // 996 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x73, 0xdb, 0x44, + 0x14, 0xaf, 0x1c, 0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xad, 0x9f, 0x8b, 0xd0, 0x14, 0x92, 0xcf, 0xf8, 0xb8, 0x7f, 0x8a, 0x23, 0x3c, 0x26, 0x8c, 0x44, + 0x31, 0x5a, 0x87, 0x5a, 0x4c, 0xa2, 0x83, 0x60, 0x40, 0xfa, 0x14, 0x8f, 0x89, 0xa8, 0x47, 0xd5, + 0xd5, 0x95, 0xec, 0x29, 0x1e, 0x13, 0x74, 0x13, 0x2e, 0x87, 0x13, 0x22, 0xe7, 0x52, 0x2a, 0x15, + 0x84, 0x52, 0x3d, 0x95, 0x0a, 0xb5, 0xfb, 0x50, 0x64, 0xd8, 0x8f, 0x8d, 0x15, 0xd1, 0x9d, 0xad, + 0x5c, 0x77, 0xce, 0x72, 0x6e, 0xef, 0x62, 0x3f, 0x7e, 0x48, 0x59, 0x34, 0x73, 0x85, 0x29, 0xfa, + 0x10, 0x2e, 0x9f, 0xd6, 0xae, 0x3f, 0x0e, 0xa8, 0x51, 0xbc, 0xd0, 0xf8, 0x5c, 0x12, 0x45, 0xa8, + 0xa5, 0x35, 0x7c, 0x12, 0xd0, 0x3c, 0x16, 0x3e, 0x34, 0x4a, 0x2f, 0x86, 0x85, 0x0f, 0xd1, 0x23, + 0xa8, 0x25, 0xc4, 0x14, 0x51, 0xad, 0x0a, 0xa4, 0x57, 0x17, 0x90, 0x76, 0x94, 0x92, 0x04, 0xfa, + 0x91, 0x03, 0xe9, 0x89, 0x21, 0x8f, 0x29, 0x83, 0x83, 0x0f, 0x8d, 0xf2, 0x8b, 0xe0, 0xe0, 0x43, + 0xd9, 0x34, 0x1c, 0x0d, 0x86, 0x7d, 0x8f, 0x4c, 0xd8, 0xd0, 0xa8, 0x74, 0xb4, 0xcd, 0x12, 0x6f, + 0x1a, 0x97, 0xed, 0x70, 0x91, 0xf9, 0x0e, 0x54, 0xd3, 0xea, 0xa2, 0x57, 0x60, 0x65, 0x44, 0x66, + 0xaa, 0xb7, 0xfc, 0x13, 0x35, 0xa1, 0x74, 0x80, 0xf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x76, 0x06, 0xb5, 0xcc, 0x5b, 0xff, 0xa7, 0xa6, 0xdc, 0xae, 0x09, + 0xb7, 0x57, 0x50, 0xdd, 0x99, 0x9f, 0xd7, 0xed, 0xad, 0xa3, 0x93, 0x96, 0xf6, 0xeb, 0x49, 0x4b, + 0xfb, 0xf3, 0xa4, 0xa5, 0xc1, 0xf5, 0x20, 0xb4, 0x33, 0x7f, 0x2f, 0x14, 0xea, 0xe7, 0xab, 0xf2, + 0x77, 0x6f, 0x55, 0x30, 0xed, 0xed, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x58, 0x6a, 0x66, + 0x9e, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto-gen/storage_v1/storage.pb.go b/proto-gen/storage_v1/storage.pb.go index 5564abb7ed4..356257a8495 100644 --- a/proto-gen/storage_v1/storage.pb.go +++ b/proto-gen/storage_v1/storage.pb.go @@ -304,6 +304,8 @@ var xxx_messageInfo_CloseWriterResponse proto.InternalMessageInfo type GetTraceRequest struct { TraceID github_com_jaegertracing_jaeger_model.TraceID `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3,customtype=github.com/jaegertracing/jaeger/model.TraceID" json:"trace_id"` + StartTime *time.Time `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time,omitempty"` + EndTime *time.Time `protobuf:"bytes,3,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -342,6 +344,20 @@ func (m *GetTraceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetTraceRequest proto.InternalMessageInfo +func (m *GetTraceRequest) GetStartTime() *time.Time { + if m != nil { + return m.StartTime + } + return nil +} + +func (m *GetTraceRequest) GetEndTime() *time.Time { + if m != nil { + return m.EndTime + } + return nil +} + type GetServicesRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1006,77 +1022,78 @@ func init() { func init() { proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffdb) } var fileDescriptor_0d2c4ccf1453ffdb = []byte{ - // 1117 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0xdc, 0xc4, - 0x1b, 0xfe, 0x39, 0xd9, 0x6d, 0x76, 0xdf, 0xdd, 0xb4, 0xc9, 0xec, 0xf6, 0x57, 0xd7, 0xd0, 0x24, - 0x18, 0x9a, 0x04, 0x04, 0xde, 0x66, 0x39, 0x80, 0xa0, 0x08, 0x9a, 0x3f, 0x8d, 0x02, 0x14, 0x8a, - 0x13, 0xb5, 0x12, 0x85, 0xac, 0x66, 0xe3, 0xc1, 0x19, 0xb2, 0x1e, 0x6f, 0xed, 0xf1, 0x2a, 0x11, - 0xe2, 0xc6, 0x07, 0xe0, 0xc8, 0x89, 0x13, 0x12, 0xdf, 0x83, 0x53, 0x8f, 0x9c, 0x39, 0x04, 0x94, - 0x2b, 0x5f, 0x02, 0x79, 0x66, 0xec, 0xd8, 0x6b, 0x2b, 0x49, 0xa3, 0xdc, 0x3c, 0xef, 0x3c, 0xf3, - 0xbc, 0xff, 0x66, 0x9e, 0xd7, 0x30, 0x1d, 0x72, 0x3f, 0xc0, 0x2e, 0xb1, 0x86, 0x81, 0xcf, 0x7d, - 0x34, 0xfb, 0x3d, 0x26, 0x2e, 0x09, 0xac, 0xc4, 0x3a, 0x5a, 0x31, 0xda, 0xae, 0xef, 0xfa, 0x62, - 0xb7, 0x13, 0x7f, 0x49, 0xa0, 0x31, 0xef, 0xfa, 0xbe, 0x3b, 0x20, 0x1d, 0xb1, 0xea, 0x47, 0xdf, - 0x75, 0x38, 0xf5, 0x48, 0xc8, 0xb1, 0x37, 0x54, 0x80, 0xb9, 0x71, 0x80, 0x13, 0x05, 0x98, 0x53, - 0x9f, 0xa9, 0xfd, 0x86, 0xe7, 0x3b, 0x64, 0x20, 0x17, 0xe6, 0xaf, 0x1a, 0xfc, 0x7f, 0x93, 0xf0, - 0x75, 0x32, 0x24, 0xcc, 0x21, 0x6c, 0x8f, 0x92, 0xd0, 0x26, 0xcf, 0x23, 0x12, 0x72, 0xb4, 0x06, - 0x10, 0x72, 0x1c, 0xf0, 0x5e, 0xec, 0x40, 0xd7, 0x16, 0xb4, 0xe5, 0x46, 0xd7, 0xb0, 0x24, 0xb9, - 0x95, 0x90, 0x5b, 0x3b, 0x89, 0xf7, 0xd5, 0xda, 0x8b, 0xe3, 0xf9, 0xff, 0xfd, 0xfc, 0xf7, 0xbc, - 0x66, 0xd7, 0xc5, 0xb9, 0x78, 0x07, 0x7d, 0x0c, 0x35, 0xc2, 0x1c, 0x49, 0x31, 0xf1, 0x12, 0x14, - 0x53, 0x84, 0x39, 0xb1, 0xdd, 0xec, 0xc3, 0xad, 0x42, 0x7c, 0xe1, 0xd0, 0x67, 0x21, 0x41, 0x9b, - 0xd0, 0x74, 0x32, 0x76, 0x5d, 0x5b, 0x98, 0x5c, 0x6e, 0x74, 0xef, 0x58, 0xaa, 0x92, 0x78, 0x48, - 0x7b, 0xa3, 0xae, 0x95, 0x1e, 0x3d, 0xfa, 0x9c, 0xb2, 0x83, 0xd5, 0x4a, 0xec, 0xc2, 0xce, 0x1d, - 0x34, 0x3f, 0x84, 0x99, 0xa7, 0x01, 0xe5, 0x64, 0x7b, 0x88, 0x59, 0x92, 0xfd, 0x12, 0x54, 0xc2, - 0x21, 0x66, 0x2a, 0xef, 0xd6, 0x18, 0xa9, 0x40, 0x0a, 0x80, 0xd9, 0x82, 0xd9, 0xcc, 0x61, 0x19, - 0x9a, 0xd9, 0x06, 0xb4, 0x36, 0xf0, 0x43, 0x22, 0x76, 0x02, 0xc5, 0x69, 0xde, 0x84, 0x56, 0xce, - 0xaa, 0xc0, 0x0c, 0x6e, 0x6c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x52, 0xd1, 0x28, 0x0a, - 0x74, 0x69, 0xcb, 0xcb, 0x04, 0x7b, 0x55, 0x7f, 0x71, 0x32, 0xa7, 0xfd, 0x79, 0x32, 0xa7, 0xfd, - 0x73, 0x32, 0xa7, 0x7d, 0x0d, 0x0a, 0xde, 0x1b, 0xad, 0xf4, 0xaf, 0x89, 0x29, 0xff, 0xee, 0x7f, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xa3, 0xc0, 0x72, 0x65, 0x0d, 0x00, 0x00, + // 1132 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcd, 0x73, 0xdb, 0x44, + 0x14, 0x47, 0xb1, 0xdd, 0xd8, 0xcf, 0x4e, 0x9b, 0xac, 0x5d, 0xaa, 0x0a, 0x9a, 0x04, 0x41, 0x93, + 0xc0, 0x80, 0xdc, 0x98, 0x03, 0x0c, 0x94, 0x81, 0xe6, 0xa3, 0x99, 0x00, 0x85, 0xa2, 0x64, 0xda, + 0x19, 0x0a, 0xf1, 0xac, 0xa3, 0x45, 0x11, 0xb1, 0x56, 0xae, 0xb4, 0xf2, 0x24, 0xc3, 0x70, 0xe3, + 0x0f, 0xe0, 0xc8, 0x89, 0x13, 0x33, 0xfc, 0x1f, 0x9c, 0x7a, 0xe4, 0xcc, 0x21, 0x30, 0xb9, 0x72, + 0xe5, 0x0f, 0x60, 0xb4, 0xbb, 0x52, 0xf4, 0x35, 0xf9, 0x9a, 0xdc, 0xbc, 0xef, 0xfd, 0xf6, 0xf7, + 0x3e, 0xf7, 0x3d, 0x19, 0xa6, 0x02, 0xe6, 0xf9, 0xd8, 0x26, 0xc6, 0xc8, 0xf7, 0x98, 0x87, 0x66, + 0xbe, 0xc7, 0xc4, 0x26, 0xbe, 0x11, 0x4b, 0xc7, 0xcb, 0x5a, 0xc7, 0xf6, 0x6c, 0x8f, 0x6b, 0xbb, + 0xd1, 0x2f, 0x01, 0xd4, 0xe6, 0x6c, 0xcf, 0xb3, 0x87, 0xa4, 0xcb, 0x4f, 0x83, 0xf0, 0xbb, 0x2e, + 0x73, 0x5c, 0x12, 0x30, 0xec, 0x8e, 0x24, 0x60, 0x36, 0x0f, 0xb0, 0x42, 0x1f, 0x33, 0xc7, 0xa3, + 0x52, 0xdf, 0x74, 0x3d, 0x8b, 0x0c, 0xc5, 0x41, 0xff, 0x55, 0x81, 0x97, 0x37, 0x08, 0x5b, 0x23, + 0x23, 0x42, 0x2d, 0x42, 0x77, 0x1d, 0x12, 0x98, 0xe4, 0x79, 0x48, 0x02, 0x86, 0x56, 0x01, 0x02, + 0x86, 0x7d, 0xd6, 0x8f, 0x0c, 0xa8, 0xca, 0xbc, 0xb2, 0xd4, 0xec, 0x69, 0x86, 0x20, 0x37, 0x62, + 0x72, 0x63, 0x3b, 0xb6, 0xbe, 0x52, 0x7f, 0x71, 0x34, 0xf7, 0xd2, 0xcf, 0x7f, 0xcf, 0x29, 0x66, + 0x83, 0xdf, 0x8b, 0x34, 0xe8, 0x63, 0xa8, 0x13, 0x6a, 0x09, 0x8a, 0x89, 0x0b, 0x50, 0x4c, 0x12, + 0x6a, 0x45, 0x72, 0x7d, 0x00, 0xb7, 0x0a, 0xfe, 0x05, 0x23, 0x8f, 0x06, 0x04, 0x6d, 0x40, 0xcb, + 0x4a, 0xc9, 0x55, 0x65, 0xbe, 0xb2, 0xd4, 0xec, 0xdd, 0x31, 0x64, 0x26, 0xf1, 0xc8, 0xe9, 0x8f, + 0x7b, 0x46, 0x72, 0xf5, 0xf0, 0x73, 0x87, 0xee, 0xaf, 0x54, 0x23, 0x13, 0x66, 0xe6, 0xa2, 0xfe, + 0x21, 0x4c, 0x3f, 0xf5, 0x1d, 0x46, 0xb6, 0x46, 0x98, 0xc6, 0xd1, 0x2f, 0x42, 0x35, 0x18, 0x61, + 0x2a, 0xe3, 0x6e, 0xe7, 0x48, 0x39, 0x92, 0x03, 0xf4, 0x36,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 0xe1, 0x1f, + 0x98, 0x52, 0x7b, 0xf5, 0x4d, 0xd7, 0xfb, 0x49, 0x01, 0x35, 0xfb, 0x89, 0x9e, 0x32, 0xbe, 0xc7, + 0x8d, 0xa7, 0xd5, 0xe8, 0xcd, 0x72, 0xe3, 0x25, 0xff, 0x42, 0xb4, 0xb7, 0xce, 0x03, 0x95, 0x19, + 0x08, 0x01, 0x09, 0x9b, 0xe9, 0xb9, 0x1a, 0x95, 0x3c, 0x73, 0x2e, 0x1d, 0x1a, 0xc5, 0x01, 0x5d, + 0x5a, 0xf2, 0xb2, 0x81, 0xbd, 0xa2, 0xbe, 0x38, 0x9e, 0x55, 0xfe, 0x3c, 0x9e, 0x55, 0xfe, 0x39, + 0x9e, 0x55, 0xbe, 0x06, 0x09, 0xef, 0x8f, 0x97, 0x07, 0xd7, 0xf8, 0x96, 0x7f, 0xf7, 0xff, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x1d, 0xe3, 0xf1, 0xbf, 0xec, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2125,6 +2142,26 @@ func (m *GetTraceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if m.EndTime != nil { + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintStorage(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x1a + } + if m.StartTime != nil { + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintStorage(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x12 + } { size := m.TraceID.Size() i -= size @@ -2362,37 +2399,37 @@ func (m *TraceQueryParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x40 } - n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DurationMax, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMax):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintStorage(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x3a - n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DurationMin, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMin):]) - if err5 != nil { - return 0, err5 - } - i -= n5 - i = encodeVarintStorage(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0x32 - n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTimeMax, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMax):]) + n6, err6 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DurationMax, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMax):]) if err6 != nil { return 0, err6 } i -= n6 i = encodeVarintStorage(dAtA, i, uint64(n6)) i-- - dAtA[i] = 0x2a - n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTimeMin, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMin):]) + dAtA[i] = 0x3a + n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DurationMin, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMin):]) if err7 != nil { return 0, err7 } i -= n7 i = encodeVarintStorage(dAtA, i, uint64(n7)) i-- + dAtA[i] = 0x32 + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTimeMax, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMax):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintStorage(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0x2a + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTimeMin, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMin):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintStorage(dAtA, i, uint64(n9)) + i-- dAtA[i] = 0x22 if len(m.Tags) > 0 { for k := range m.Tags { @@ -2779,6 +2816,14 @@ func (m *GetTraceRequest) Size() (n int) { _ = l l = m.TraceID.Size() n += 1 + l + sovStorage(uint64(l)) + if m.StartTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartTime) + n += 1 + l + sovStorage(uint64(l)) + } + if m.EndTime != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndTime) + n += 1 + l + sovStorage(uint64(l)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3529,6 +3574,78 @@ func (m *GetTraceRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.StartTime == nil { + m.StartTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.StartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EndTime == nil { + m.EndTime = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.EndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) diff --git a/storage/spanstore/interface.go b/storage/spanstore/interface.go index c4c29181502..642a921e2bd 100644 --- a/storage/spanstore/interface.go +++ b/storage/spanstore/interface.go @@ -25,7 +25,7 @@ type Reader interface { // GetTrace retrieves the trace with a given id. // // If no spans are stored for this trace, it returns ErrTraceNotFound. - GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) + GetTrace(ctx context.Context, query TraceGetParameters) (*model.Trace, error) // GetServices returns all service names known to the backend from spans // within its retention period. @@ -50,6 +50,13 @@ type Reader interface { FindTraceIDs(ctx context.Context, query *TraceQueryParameters) ([]model.TraceID, error) } +// TraceGetParameters contains parameters of a trace get. +type TraceGetParameters struct { + TraceID model.TraceID + StartTime *time.Time + EndTime *time.Time +} + // TraceQueryParameters contains parameters of a trace query. type TraceQueryParameters struct { ServiceName string diff --git a/storage/spanstore/metrics/decorator.go b/storage/spanstore/metrics/decorator.go index 7b1fdd222bc..937c8127a27 100644 --- a/storage/spanstore/metrics/decorator.go +++ b/storage/spanstore/metrics/decorator.go @@ -78,9 +78,9 @@ func (m *ReadMetricsDecorator) FindTraceIDs(ctx context.Context, traceQuery *spa } // GetTrace implements spanstore.Reader#GetTrace -func (m *ReadMetricsDecorator) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { +func (m *ReadMetricsDecorator) GetTrace(ctx context.Context, traceGet spanstore.TraceGetParameters) (*model.Trace, error) { start := time.Now() - retMe, err := m.spanReader.GetTrace(ctx, traceID) + retMe, err := m.spanReader.GetTrace(ctx, traceGet) m.getTraceMetrics.emit(err, time.Since(start), 1) return retMe, err } diff --git a/storage/spanstore/metrics/decorator_test.go b/storage/spanstore/metrics/decorator_test.go index 5fef39cd9ec..af4f8e8c878 100644 --- a/storage/spanstore/metrics/decorator_test.go +++ b/storage/spanstore/metrics/decorator_test.go @@ -29,8 +29,8 @@ func TestSuccessfulUnderlyingCalls(t *testing.T) { mockReader.On("GetOperations", context.Background(), operationQuery). Return([]spanstore.Operation{}, nil) mrs.GetOperations(context.Background(), operationQuery) - mockReader.On("GetTrace", context.Background(), model.TraceID{}).Return(&model.Trace{}, nil) - mrs.GetTrace(context.Background(), model.TraceID{}) + mockReader.On("GetTrace", context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{}}).Return(&model.Trace{}, nil) + mrs.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{}}) mockReader.On("FindTraces", context.Background(), &spanstore.TraceQueryParameters{}). Return([]*model.Trace{}, nil) mrs.FindTraces(context.Background(), &spanstore.TraceQueryParameters{}) @@ -97,9 +97,9 @@ func TestFailingUnderlyingCalls(t *testing.T) { mockReader.On("GetOperations", context.Background(), operationQuery). Return(nil, errors.New("Failure")) mrs.GetOperations(context.Background(), operationQuery) - mockReader.On("GetTrace", context.Background(), model.TraceID{}). + mockReader.On("GetTrace", context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{}}). Return(nil, errors.New("Failure")) - mrs.GetTrace(context.Background(), model.TraceID{}) + mrs.GetTrace(context.Background(), spanstore.TraceGetParameters{TraceID: model.TraceID{}}) mockReader.On("FindTraces", context.Background(), &spanstore.TraceQueryParameters{}). Return(nil, errors.New("Failure")) mrs.FindTraces(context.Background(), &spanstore.TraceQueryParameters{}) diff --git a/storage/spanstore/mocks/Reader.go b/storage/spanstore/mocks/Reader.go index d48658937c3..ca2592c5661 100644 --- a/storage/spanstore/mocks/Reader.go +++ b/storage/spanstore/mocks/Reader.go @@ -141,9 +141,9 @@ func (_m *Reader) GetServices(ctx context.Context) ([]string, error) { return r0, r1 } -// GetTrace provides a mock function with given fields: ctx, traceID -func (_m *Reader) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - ret := _m.Called(ctx, traceID) +// GetTrace provides a mock function with given fields: ctx, query +func (_m *Reader) GetTrace(ctx context.Context, query spanstore.TraceGetParameters) (*model.Trace, error) { + ret := _m.Called(ctx, query) if len(ret) == 0 { panic("no return value specified for GetTrace") @@ -151,19 +151,19 @@ func (_m *Reader) GetTrace(ctx context.Context, traceID model.TraceID) (*model.T var r0 *model.Trace var r1 error - if rf, ok := ret.Get(0).(func(context.Context, model.TraceID) (*model.Trace, error)); ok { - return rf(ctx, traceID) + if rf, ok := ret.Get(0).(func(context.Context, spanstore.TraceGetParameters) (*model.Trace, error)); ok { + return rf(ctx, query) } - if rf, ok := ret.Get(0).(func(context.Context, model.TraceID) *model.Trace); ok { - r0 = rf(ctx, traceID) + if rf, ok := ret.Get(0).(func(context.Context, spanstore.TraceGetParameters) *model.Trace); ok { + r0 = rf(ctx, query) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.Trace) } } - if rf, ok := ret.Get(1).(func(context.Context, model.TraceID) error); ok { - r1 = rf(ctx, traceID) + if rf, ok := ret.Get(1).(func(context.Context, spanstore.TraceGetParameters) error); ok { + r1 = rf(ctx, query) } else { r1 = ret.Error(1) } From 489b3c91a5aca0e70097462d775ab0b69d607423 Mon Sep 17 00:00:00 2001 From: rim99 Date: Sun, 10 Nov 2024 09:39:22 +0800 Subject: [PATCH 2/3] Remove gogoproto related code in api_v3 proto file Signed-off-by: rim99 --- cmd/query/app/apiv3/grpc_handler.go | 15 +- cmd/query/app/apiv3/grpc_handler_test.go | 11 +- .../app/internal/api_v3/query_service.pb.go | 486 +++--------------- 3 files changed, 87 insertions(+), 425 deletions(-) diff --git a/cmd/query/app/apiv3/grpc_handler.go b/cmd/query/app/apiv3/grpc_handler.go index 6e82ae6cbf9..3e264b2814f 100644 --- a/cmd/query/app/apiv3/grpc_handler.go +++ b/cmd/query/app/apiv3/grpc_handler.go @@ -7,6 +7,7 @@ import ( "context" "errors" "fmt" + "time" "github.com/gogo/protobuf/types" "google.golang.org/grpc/codes" @@ -32,11 +33,21 @@ func (h *Handler) GetTrace(request *api_v3.GetTraceRequest, stream api_v3.QueryS if err != nil { return fmt.Errorf("malform trace ID: %w", err) } + var startTime time.Time + var endTime time.Time + reqStartTime := request.GetStartTime() + if reqStartTime != nil { + startTime = time.Unix(request.GetStartTime().GetSeconds(), int64(request.GetStartTime().GetNanos())) + } + reqEndTime := request.GetEndTime() + if reqEndTime != nil { + endTime = time.Unix(request.GetEndTime().GetSeconds(), int64(request.GetEndTime().GetNanos())) + } query := spanstore.TraceGetParameters{ TraceID: traceID, - StartTime: request.GetStartTime(), - EndTime: request.GetEndTime(), + StartTime: &startTime, + EndTime: &endTime, } trace, err := h.QueryService.GetTrace(stream.Context(), query) if err != nil { diff --git a/cmd/query/app/apiv3/grpc_handler_test.go b/cmd/query/app/apiv3/grpc_handler_test.go index ad6e0c61cec..1b1e6ac974a 100644 --- a/cmd/query/app/apiv3/grpc_handler_test.go +++ b/cmd/query/app/apiv3/grpc_handler_test.go @@ -82,13 +82,16 @@ func TestGetTrace(t *testing.T) { tsc := newTestServerClient(t) traceIdLiteral := "156" traceId, _ := model.TraceIDFromString(traceIdLiteral) - startTime := time.Date(2020, time.January, 1, 13, 0, 0, 0, time.UTC) - endTime := time.Date(2020, time.January, 1, 14, 0, 0, 0, time.UTC) + startTime := types.Timestamp{Seconds: 1, Nanos: 2} + endTime := types.Timestamp{Seconds: 3, Nanos: 4} + + traceGetStartTime := time.Unix(startTime.GetSeconds(), int64(startTime.GetNanos())) + traceGetEndTime := time.Unix(endTime.GetSeconds(), int64(endTime.GetNanos())) expectedTraceGetParameters := spanstore.TraceGetParameters{ TraceID: traceId, - StartTime: &startTime, - EndTime: &endTime, + StartTime: &traceGetStartTime, + EndTime: &traceGetEndTime, } tsc.reader.On("GetTrace", matchContext, expectedTraceGetParameters).Return( &model.Trace{ diff --git a/cmd/query/app/internal/api_v3/query_service.pb.go b/cmd/query/app/internal/api_v3/query_service.pb.go index 3b836093c6c..de837fce26f 100644 --- a/cmd/query/app/internal/api_v3/query_service.pb.go +++ b/cmd/query/app/internal/api_v3/query_service.pb.go @@ -6,25 +6,19 @@ package api_v3 import ( context "context" fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" types "github.com/gogo/protobuf/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" math "math" - math_bits "math/bits" - time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf -var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -37,12 +31,12 @@ type GetTraceRequest struct { // Hex encoded 64 or 128 bit trace ID. TraceId string `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` // Optional. The start time to search trace ID. - StartTime *time.Time `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time,omitempty"` + StartTime *types.Timestamp `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` // Optional. The end time to search trace ID. - EndTime *time.Time `protobuf:"bytes,3,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + EndTime *types.Timestamp `protobuf:"bytes,3,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetTraceRequest) Reset() { *m = GetTraceRequest{} } @@ -52,25 +46,16 @@ func (*GetTraceRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{0} } func (m *GetTraceRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_GetTraceRequest.Unmarshal(m, b) } func (m *GetTraceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetTraceRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_GetTraceRequest.Marshal(b, m, deterministic) } func (m *GetTraceRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetTraceRequest.Merge(m, src) } func (m *GetTraceRequest) XXX_Size() int { - return m.Size() + return xxx_messageInfo_GetTraceRequest.Size(m) } func (m *GetTraceRequest) XXX_DiscardUnknown() { xxx_messageInfo_GetTraceRequest.DiscardUnknown(m) @@ -85,14 +70,14 @@ func (m *GetTraceRequest) GetTraceId() string { return "" } -func (m *GetTraceRequest) GetStartTime() *time.Time { +func (m *GetTraceRequest) GetStartTime() *types.Timestamp { if m != nil { return m.StartTime } return nil } -func (m *GetTraceRequest) GetEndTime() *time.Time { +func (m *GetTraceRequest) GetEndTime() *types.Timestamp { if m != nil { return m.EndTime } @@ -110,6 +95,7 @@ func (m *GetTraceRequest) GetEndTime() *time.Time { // that match the conditions, and the resulting number of traces can be less. // // Note: some storage implementations do not guarantee the correct implementation of all parameters. +// type TraceQueryParameters struct { ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` OperationName string `protobuf:"bytes,2,opt,name=operation_name,json=operationName,proto3" json:"operation_name,omitempty"` @@ -566,15 +552,15 @@ func (m *GRPCGatewayError_GRPCGatewayErrorDetails) GetHttpStatus() string { // In case of errors, GRPCGatewayError above is used. // // Example: -// -// {"result": {"resourceSpans": ...}} +// {"result": {"resourceSpans": ...}} // // See https://github.com/grpc-ecosystem/grpc-gateway/issues/2189 +// type GRPCGatewayWrapper struct { Result *TracesData `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GRPCGatewayWrapper) Reset() { *m = GRPCGatewayWrapper{} } @@ -626,60 +612,57 @@ func init() { func init() { proto.RegisterFile("query_service.proto", fileDescriptor_5fcb6756dc1afb8d) } var fileDescriptor_5fcb6756dc1afb8d = []byte{ - // 837 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0xee, 0xda, 0x71, 0x62, 0x1f, 0x3b, 0x6d, 0x99, 0x1a, 0x75, 0xbb, 0x88, 0xd8, 0xd9, 0x82, - 0xe4, 0xab, 0x0d, 0x71, 0x2e, 0x28, 0xa5, 0x88, 0xd2, 0xa6, 0x58, 0x08, 0xa5, 0xb4, 0x93, 0xaa, - 0x20, 0x54, 0xc9, 0x9a, 0x64, 0x0f, 0xcb, 0x52, 0xef, 0xec, 0x76, 0x66, 0xd6, 0xc4, 0x6f, 0x80, - 0xc4, 0x4d, 0x25, 0x5e, 0x80, 0xbc, 0x05, 0x6f, 0xc3, 0x23, 0xf0, 0x02, 0x5c, 0xa0, 0x9d, 0x99, - 0xdd, 0xda, 0x6b, 0x08, 0xe9, 0xd5, 0xce, 0x39, 0xf3, 0x7d, 0xe7, 0xe7, 0xdb, 0x73, 0x06, 0x6e, - 0xbc, 0xca, 0x51, 0x2c, 0xa6, 0x12, 0xc5, 0x3c, 0x3e, 0xc5, 0x20, 0x13, 0xa9, 0x4a, 0x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, 0x00, 0x00, + // 799 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x5d, 0x8f, 0xdb, 0x44, + 0x14, 0xad, 0x93, 0xcd, 0x87, 0x6f, 0xb2, 0x6d, 0x99, 0x06, 0xd5, 0x35, 0x62, 0xc9, 0xba, 0x20, + 0xe5, 0xc9, 0x61, 0xb3, 0x42, 0xb4, 0xa8, 0x48, 0x85, 0x6e, 0x89, 0x10, 0xda, 0xd2, 0x7a, 0xab, + 0x82, 0x50, 0x25, 0x6b, 0x76, 0x7d, 0x09, 0xa6, 0xf1, 0xd8, 0x3b, 0x33, 0x0e, 0xc9, 0x6f, 0xe0, + 0x91, 0x77, 0xfe, 0x22, 0x7f, 0x80, 0x07, 0xe4, 0x99, 0xb1, 0x37, 0x71, 0xe8, 0x7e, 0x3c, 0xd9, + 0x77, 0xe6, 0x9c, 0x33, 0xf7, 0x9e, 0xb9, 0x77, 0xe0, 0xde, 0x79, 0x8e, 0x7c, 0x15, 0x0a, 0xe4, + 0x8b, 0xf8, 0x0c, 0xfd, 0x8c, 0xa7, 0x32, 0x25, 0xbb, 0xbf, 0x53, 0x9c, 0x21, 0xf7, 0x69, 0x16, + 0x87, 0x8b, 0x43, 0x77, 0x94, 0x66, 0xc8, 0x24, 0xce, 0x31, 0x41, 0xc9, 0x57, 0x63, 0x85, 0x19, + 0x4b, 0x4e, 0xcf, 0x70, 0xbc, 0x38, 0xd0, 0x3f, 0x9a, 0xe8, 0x7e, 0x32, 0x4b, 0xd3, 0xd9, 0x1c, + 0x35, 0xe4, 0x34, 0xff, 0x75, 0x2c, 0xe3, 0x04, 0x85, 0xa4, 0x49, 0x66, 0x00, 0x7b, 0x75, 0x40, + 0x94, 0x73, 0x2a, 0xe3, 0x94, 0xe9, 0x7d, 0xef, 0x6f, 0x0b, 0xee, 0x4c, 0x51, 0xbe, 0x2e, 0x34, + 0x03, 0x3c, 0xcf, 0x51, 0x48, 0xf2, 0x00, 0xba, 0xea, 0x8c, 0x30, 0x8e, 0x1c, 0x6b, 0x68, 0x8d, + 0xec, 0xa0, 0xa3, 0xe2, 0xef, 0x23, 0xf2, 0x18, 0x40, 0x48, 0xca, 0x65, 0x58, 0x9c, 0xe3, 0x34, + 0x86, 0xd6, 0xa8, 0x37, 0x71, 0x7d, 0x7d, 0x86, 0x5f, 0x9e, 0xe1, 0xbf, 0x2e, 0x93, 0x08, 0x6c, + 0x85, 0x2e, 0x62, 0xf2, 0x05, 0x74, 0x91, 0x45, 0x9a, 0xd8, 0xbc, 0x92, 0xd8, 0x41, 0x16, 0x15, + 0x91, 0xf7, 0xd7, 0x0e, 0x0c, 0x54, 0x76, 0xaf, 0x0a, 0xdf, 0x5e, 0x52, 0x4e, 0x13, 0x94, 0xc8, + 0x05, 0xd9, 0x87, 0xbe, 0x31, 0x31, 0x64, 0x34, 0x41, 0x93, 0x69, 0xcf, 0xac, 0xbd, 0xa0, 0x09, + 0x92, 0xcf, 0xe0, 0x76, 0x9a, 0xa1, 0xae, 0x57, 0x83, 0x1a, 0x0a, 0xb4, 0x5b, 0xad, 0x2a, 0xd8, + 0x09, 0x00, 0x95, 0x92, 0xc7, 0xa7, 0xb9, 0x44, 0xe1, 0x34, 0x87, 0xcd, 0x51, 0x6f, 0x72, 0xe8, + 0x6f, 0x5c, 0x89, 0xff, 0x7f, 0x29, 0xf8, 0xdf, 0x54, 0xac, 0xe7, 0x4c, 0xf2, 0x55, 0xb0, 0x26, + 0x43, 0x9e, 0xc2, 0xed, 0x0b, 0xa7, 0xc2, 0x24, 0x66, 0xce, 0xce, 0x95, 0x45, 0xf7, 0x2b, 0xb7, + 0x8e, 0x63, 0x56, 0x57, 0xa0, 0x4b, 0xa7, 0x75, 0x13, 0x05, 0xba, 0x24, 0x4f, 0xa0, 0x5f, 0x5e, + 0xb7, 0xca, 0xa0, 0xad, 0xf8, 0x0f, 0xb6, 0xf8, 0x47, 0x06, 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, 0x1b, 0xe8, 0xad, 0x4d, 0x09, 0xd9, 0xdf, 0x4e, + 0xbd, 0x36, 0x57, 0xae, 0x77, 0x19, 0x44, 0xb7, 0xa8, 0x77, 0x8b, 0xbc, 0x85, 0xdd, 0x8d, 0xee, + 0x25, 0x0f, 0xb7, 0x69, 0x5b, 0x83, 0xe6, 0x7e, 0x7a, 0x39, 0xa8, 0x54, 0xff, 0x76, 0x1f, 0xee, + 0xc7, 0xa9, 0xc1, 0x16, 0x95, 0xc5, 0x6c, 0x66, 0x28, 0xbf, 0xb4, 0xf5, 0xf7, 0xb4, 0xad, 0xea, + 0x3e, 0xfc, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x10, 0xfa, 0xdd, 0xab, 0xb3, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -942,338 +925,3 @@ var _QueryService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "query_service.proto", } - -func (m *GetTraceRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetTraceRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GetTraceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.XXX_unrecognized != nil { - i -= len(m.XXX_unrecognized) - copy(dAtA[i:], m.XXX_unrecognized) - } - if m.EndTime != nil { - n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndTime):]) - if err1 != nil { - return 0, err1 - } - i -= n1 - i = encodeVarintQueryService(dAtA, i, uint64(n1)) - i-- - dAtA[i] = 0x1a - } - if m.StartTime != nil { - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartTime):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintQueryService(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x12 - } - if len(m.TraceId) > 0 { - i -= len(m.TraceId) - copy(dAtA[i:], m.TraceId) - i = encodeVarintQueryService(dAtA, i, uint64(len(m.TraceId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintQueryService(dAtA []byte, offset int, v uint64) int { - offset -= sovQueryService(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GetTraceRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TraceId) - if l > 0 { - n += 1 + l + sovQueryService(uint64(l)) - } - if m.StartTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartTime) - n += 1 + l + sovQueryService(uint64(l)) - } - if m.EndTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndTime) - n += 1 + l + sovQueryService(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovQueryService(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQueryService(x uint64) (n int) { - return sovQueryService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GetTraceRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQueryService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetTraceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetTraceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TraceId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQueryService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQueryService - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQueryService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TraceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQueryService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQueryService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQueryService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StartTime == nil { - m.StartTime = new(time.Time) - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.StartTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQueryService - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQueryService - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQueryService - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.EndTime == nil { - m.EndTime = new(time.Time) - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.EndTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQueryService(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQueryService - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQueryService(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQueryService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQueryService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQueryService - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQueryService - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQueryService - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQueryService - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQueryService = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQueryService = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQueryService = fmt.Errorf("proto: unexpected end of group") -) From 74fd1e55815ab9ce965f58dba35dd5aff0ac1afa Mon Sep 17 00:00:00 2001 From: rim99 Date: Sun, 10 Nov 2024 17:05:41 +0800 Subject: [PATCH 3/3] Update unit test Signed-off-by: rim99 --- cmd/query/app/apiv3/grpc_handler.go | 26 +++++++------- cmd/query/app/apiv3/grpc_handler_test.go | 44 +++++++++++++++++++----- cmd/query/app/server_test.go | 3 +- 3 files changed, 51 insertions(+), 22 deletions(-) diff --git a/cmd/query/app/apiv3/grpc_handler.go b/cmd/query/app/apiv3/grpc_handler.go index 3e264b2814f..9b9a154e07a 100644 --- a/cmd/query/app/apiv3/grpc_handler.go +++ b/cmd/query/app/apiv3/grpc_handler.go @@ -33,22 +33,22 @@ func (h *Handler) GetTrace(request *api_v3.GetTraceRequest, stream api_v3.QueryS if err != nil { return fmt.Errorf("malform trace ID: %w", err) } - var startTime time.Time - var endTime time.Time - reqStartTime := request.GetStartTime() - if reqStartTime != nil { - startTime = time.Unix(request.GetStartTime().GetSeconds(), int64(request.GetStartTime().GetNanos())) - } - reqEndTime := request.GetEndTime() - if reqEndTime != nil { - endTime = time.Unix(request.GetEndTime().GetSeconds(), int64(request.GetEndTime().GetNanos())) - } query := spanstore.TraceGetParameters{ - TraceID: traceID, - StartTime: &startTime, - EndTime: &endTime, + TraceID: traceID, + } + + startTime := request.GetStartTime() + if startTime != nil { + ts := time.Unix(startTime.GetSeconds(), int64(startTime.GetNanos())) + query.StartTime = &ts + } + endTime := request.GetEndTime() + if endTime != nil { + ts := time.Unix(endTime.GetSeconds(), int64(endTime.GetNanos())) + query.EndTime = &ts } + trace, err := h.QueryService.GetTrace(stream.Context(), query) if err != nil { return fmt.Errorf("cannot retrieve trace: %w", err) diff --git a/cmd/query/app/apiv3/grpc_handler_test.go b/cmd/query/app/apiv3/grpc_handler_test.go index 07187a606b4..7b5203732c4 100644 --- a/cmd/query/app/apiv3/grpc_handler_test.go +++ b/cmd/query/app/apiv3/grpc_handler_test.go @@ -82,16 +82,44 @@ func TestGetTrace(t *testing.T) { tsc := newTestServerClient(t) traceIdLiteral := "156" traceId, _ := model.TraceIDFromString(traceIdLiteral) - startTime := types.Timestamp{Seconds: 1, Nanos: 2} - endTime := types.Timestamp{Seconds: 3, Nanos: 4} - traceGetStartTime := time.Unix(startTime.GetSeconds(), int64(startTime.GetNanos())) - traceGetEndTime := time.Unix(endTime.GetSeconds(), int64(endTime.GetNanos())) + expectedTraceGetParameters := spanstore.TraceGetParameters{ + TraceID: traceId, + } + tsc.reader.On("GetTrace", matchContext, expectedTraceGetParameters).Return( + &model.Trace{ + Spans: []*model.Span{ + { + OperationName: "foobar", + }, + }, + }, nil).Once() + + getTraceStream, err := tsc.client.GetTrace(context.Background(), + &api_v3.GetTraceRequest{ + TraceId: traceIdLiteral, + }, + ) + require.NoError(t, err) + recv, err := getTraceStream.Recv() + require.NoError(t, err) + td := recv.ToTraces() + require.EqualValues(t, 1, td.SpanCount()) + assert.Equal(t, "foobar", + td.ResourceSpans().At(0).ScopeSpans().At(0).Spans().At(0).Name()) +} + +func TestGetTraceWithTimeWindow(t *testing.T) { + tsc := newTestServerClient(t) + traceIdLiteral := "156" + traceId, _ := model.TraceIDFromString(traceIdLiteral) + start_ts := time.Unix(1, 2) + end_ts := time.Unix(3, 4) expectedTraceGetParameters := spanstore.TraceGetParameters{ TraceID: traceId, - StartTime: &traceGetStartTime, - EndTime: &traceGetEndTime, + StartTime: &start_ts, + EndTime: &end_ts, } tsc.reader.On("GetTrace", matchContext, expectedTraceGetParameters).Return( &model.Trace{ @@ -105,8 +133,8 @@ func TestGetTrace(t *testing.T) { getTraceStream, err := tsc.client.GetTrace(context.Background(), &api_v3.GetTraceRequest{ TraceId: traceIdLiteral, - StartTime: &startTime, - EndTime: &endTime, + StartTime: &types.Timestamp{Seconds: 1, Nanos: 2}, + EndTime: &types.Timestamp{Seconds: 3, Nanos: 4}, }, ) require.NoError(t, err) diff --git a/cmd/query/app/server_test.go b/cmd/query/app/server_test.go index fbc7360483f..1a16e40d133 100644 --- a/cmd/query/app/server_test.go +++ b/cmd/query/app/server_test.go @@ -42,6 +42,7 @@ import ( "github.com/jaegertracing/jaeger/ports" "github.com/jaegertracing/jaeger/proto-gen/api_v2" depsmocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" + "github.com/jaegertracing/jaeger/storage/spanstore" spanstoremocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" ) @@ -933,7 +934,7 @@ func TestServerHTTP_TracesRequest(t *testing.T) { tenancyMgr := tenancy.NewManager(&serverOptions.Tenancy) querySvc := makeQuerySvc() - querySvc.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), model.NewTraceID(0, 0x123456abc)). + querySvc.spanReader.On("GetTrace", mock.AnythingOfType("*context.valueCtx"), spanstore.TraceGetParameters{TraceID: model.NewTraceID(0, 0x123456abc)}). Return(makeMockTrace(t), nil).Once() telset := initTelSet(zaptest.NewLogger(t), &tracer, healthcheck.New())