Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] Converge v2 API with v2 remote storage API #6784

Merged
merged 2 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/jaeger/internal/integration/trace_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (r *traceReader) FindTraces(
query tracestore.TraceQueryParams,
) iter.Seq2[[]ptrace.Traces, error] {
return func(yield func([]ptrace.Traces, error) bool) {
if query.NumTraces > math.MaxInt32 {
if query.SearchDepth > math.MaxInt32 {
yield(nil, fmt.Errorf("NumTraces must not be greater than %d", math.MaxInt32))
return
}
Expand All @@ -127,7 +127,7 @@ func (r *traceReader) FindTraces(
DurationMin: query.DurationMin,
DurationMax: query.DurationMax,
//nolint: gosec // G115
SearchDepth: int32(query.NumTraces),
SearchDepth: int32(query.SearchDepth),
RawTraces: true,
},
})
Expand Down
2 changes: 1 addition & 1 deletion cmd/query/app/apiv3/grpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (h *Handler) internalFindTraces(
ServiceName: query.GetServiceName(),
OperationName: query.GetOperationName(),
Attributes: jptrace.MapToAttributes(query.GetAttributes()),
NumTraces: int(query.GetSearchDepth()),
SearchDepth: int(query.GetSearchDepth()),
},
RawTraces: query.GetRawTraces(),
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/query/app/apiv3/http_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (h *HTTPGateway) parseFindTracesQuery(q url.Values, w http.ResponseWriter)
if h.tryParamError(w, err, paramNumTraces) {
return nil, true
}
queryParams.NumTraces = numTraces
queryParams.SearchDepth = numTraces
}

if d := q.Get(paramDurationMin); d != "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/query/app/apiv3/http_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func mockFindQueries() (url.Values, tracestore.TraceQueryParams) {
StartTimeMax: time2,
DurationMin: 1 * time.Second,
DurationMax: 2 * time.Second,
NumTraces: 10,
SearchDepth: 10,
}
}

Expand Down
10 changes: 5 additions & 5 deletions cmd/query/app/querysvc/v2/querysvc/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func TestFindTraces_Success(t *testing.T) {
OperationName: "operation",
StartTimeMax: now,
DurationMin: duration,
NumTraces: 200,
SearchDepth: 200,
}
tqs.traceReader.On("FindTraces", mock.Anything, queryParams).Return(responseIter).Once()

Expand Down Expand Up @@ -352,7 +352,7 @@ func TestFindTraces_WithRawTraces_PerformsAdjustment(t *testing.T) {
OperationName: "operation",
StartTimeMax: now,
DurationMin: duration,
NumTraces: 200,
SearchDepth: 200,
}).
Return(responseIter).Once()

Expand All @@ -362,7 +362,7 @@ func TestFindTraces_WithRawTraces_PerformsAdjustment(t *testing.T) {
OperationName: "operation",
StartTimeMax: now,
DurationMin: duration,
NumTraces: 200,
SearchDepth: 200,
},
RawTraces: test.rawTraces,
}
Expand Down Expand Up @@ -488,7 +488,7 @@ func TestFindTraces_WithRawTraces_PerformsAggregation(t *testing.T) {
OperationName: "operation",
StartTimeMax: now,
DurationMin: duration,
NumTraces: 200,
SearchDepth: 200,
}).
Return(responseIter).Once()

Expand All @@ -498,7 +498,7 @@ func TestFindTraces_WithRawTraces_PerformsAggregation(t *testing.T) {
OperationName: "operation",
StartTimeMax: now,
DurationMin: duration,
NumTraces: 200,
SearchDepth: 200,
},
RawTraces: test.rawTraces,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/storage/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (q *Query) ToTraceQueryParams() *tracestore.TraceQueryParams {
StartTimeMax: q.StartTimeMax,
DurationMin: q.DurationMin,
DurationMax: q.DurationMax,
NumTraces: q.NumTraces,
SearchDepth: q.NumTraces,
}
}

Expand Down
8 changes: 5 additions & 3 deletions internal/storage/v2/api/tracestore/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ type GetTraceParams struct {
End time.Time
}

// TraceQueryParams contains parameters of a trace query.
// TraceQueryParams contains query parameters to find traces. For a detailed
// definition of each field in this message, refer to `TraceQueryParameters` in `jaeger.api_v3`
// (https://github.com/jaegertracing/jaeger-idl/blob/main/proto/api_v3/query_service.proto).
type TraceQueryParams struct {
ServiceName string
OperationName string
Expand All @@ -86,7 +88,7 @@ type TraceQueryParams struct {
StartTimeMax time.Time
DurationMin time.Duration
DurationMax time.Duration
NumTraces int
SearchDepth int
}

// FoundTraceID is a wrapper around trace ID returned from FindTraceIDs
Expand All @@ -111,7 +113,7 @@ func (t *TraceQueryParams) ToSpanStoreQueryParameters() *spanstore.TraceQueryPar
StartTimeMax: t.StartTimeMax,
DurationMin: t.DurationMin,
DurationMax: t.DurationMax,
NumTraces: t.NumTraces,
NumTraces: t.SearchDepth,
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/storage/v2/api/tracestore/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestToSpanStoreQueryParameters(t *testing.T) {
StartTimeMax: now.Add(time.Minute),
DurationMin: time.Minute,
DurationMax: time.Hour,
NumTraces: 10,
SearchDepth: 10,
}
expected := &spanstore.TraceQueryParameters{
ServiceName: "service",
Expand Down
4 changes: 2 additions & 2 deletions internal/storage/v2/v1adapter/spanreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
StartTimeMax: query.StartTimeMax,
DurationMin: query.DurationMin,
DurationMax: query.DurationMax,
NumTraces: query.NumTraces,
SearchDepth: query.NumTraces,

Check warning on line 87 in internal/storage/v2/v1adapter/spanreader.go

View check run for this annotation

Codecov / codecov/patch

internal/storage/v2/v1adapter/spanreader.go#L87

Added line #L87 was not covered by tests
})
return V1TracesFromSeq2(getTracesIter)
}
Expand All @@ -101,7 +101,7 @@
StartTimeMax: query.StartTimeMax,
DurationMin: query.DurationMin,
DurationMax: query.DurationMax,
NumTraces: query.NumTraces,
SearchDepth: query.NumTraces,

Check warning on line 104 in internal/storage/v2/v1adapter/spanreader.go

View check run for this annotation

Codecov / codecov/patch

internal/storage/v2/v1adapter/spanreader.go#L104

Added line #L104 was not covered by tests
})
return V1TraceIDsFromSeq2(traceIDsIter)
}
4 changes: 2 additions & 2 deletions internal/storage/v2/v1adapter/tracereader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func TestTraceReader_FindTracesDelegatesSuccessResponse(t *testing.T) {
StartTimeMax: now.Add(time.Minute),
DurationMin: time.Minute,
DurationMax: time.Hour,
NumTraces: 10,
SearchDepth: 10,
},
))
require.NoError(t, err)
Expand Down Expand Up @@ -480,7 +480,7 @@ func TestTraceReader_FindTraceIDsDelegatesResponse(t *testing.T) {
StartTimeMax: now.Add(time.Minute),
DurationMin: time.Minute,
DurationMax: time.Hour,
NumTraces: 10,
SearchDepth: 10,
},
))
require.ErrorIs(t, err, test.err)
Expand Down
Loading