Skip to content

feat(apiv3): implement GetDependencies in gRPC handler and HTTP gateway#8581

Open
Pulkit7070 wants to merge 4 commits into
jaegertracing:mainfrom
Pulkit7070:feat/apiv3-get-dependencies
Open

feat(apiv3): implement GetDependencies in gRPC handler and HTTP gateway#8581
Pulkit7070 wants to merge 4 commits into
jaegertracing:mainfrom
Pulkit7070:feat/apiv3-get-dependencies

Conversation

@Pulkit7070
Copy link
Copy Markdown
Contributor

Which problem is this PR solving?

Closes #7595

The GetDependencies RPC is declared in query_service.proto and the generated Go interface requires every QueryServiceServer to provide it. The concrete Handler struct in apiv3 had no implementation, so all callers received an Unimplemented gRPC status. The HTTP gateway similarly had no /api/v3/dependencies route.

Description of the changes

  • grpc_handler.go: Add GetDependencies method on Handler. Validates that both start_time and end_time are present, computes the duration, delegates to h.QueryService.GetDependencies, and maps the result into api_v3.DependenciesResponse.
  • http_gateway.go: Register GET /api/v3/dependencies route. Parse start_time / end_time query parameters (RFC 3339), call QueryService.GetDependencies, and encode the protobuf response via the shared marshalResponse helper.
  • gateway_test.go / http_gateway_test.go: Add tests for the happy path and missing-parameter error handling.

How was this change tested?

go test ./cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/... -run TestHTTPGatewayGetDependencies -v
go vet ./cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/...

All new tests pass. Pre-existing snapshot-test failures on Windows (CRLF/LF mismatch) are unrelated to this change.

Copilot AI review requested due to automatic review settings May 16, 2026 11:10
@Pulkit7070 Pulkit7070 requested a review from a team as a code owner May 16, 2026 11:10
@dosubot dosubot Bot added the enhancement label May 16, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a GetDependencies endpoint to the APIv3 query service, exposed via both gRPC and HTTP handlers, with corresponding unit tests.

Changes:

  • Implement GetDependencies handler in the APIv3 gRPC handler.
  • Add /api/v3/dependencies HTTP route with start/end time validation and response marshaling.
  • Extend the HTTP gateway test harness with a dependency-store mock and add tests for success and missing-params cases.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/grpc_handler.go Adds gRPC GetDependencies implementation translating query results to API types.
cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/http_gateway.go Registers new /api/v3/dependencies route and implements its handler.
cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/gateway_test.go Adds depReader mock field to the test gateway.
cmd/jaeger/internal/extension/jaegerquery/internal/apiv3/http_gateway_test.go Adds tests for the new dependencies HTTP endpoint, including a missing-params error case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Pulkit7070
Copy link
Copy Markdown
Contributor Author

Gentle ping - happy to address any feedback when you get a chance.

@mahadzaryab1 mahadzaryab1 self-requested a review May 24, 2026 04:30
@mahadzaryab1
Copy link
Copy Markdown
Collaborator

@Pulkit7070 can you please address the merge conflicts?

@github-actions github-actions Bot added the waiting-for-author PR is waiting for author to respond to maintainer's comments label May 24, 2026
@Pulkit7070 Pulkit7070 force-pushed the feat/apiv3-get-dependencies branch from 970bf7a to 54f7490 Compare May 24, 2026 06:35
@github-actions github-actions Bot removed the waiting-for-author PR is waiting for author to respond to maintainer's comments label May 24, 2026
@Pulkit7070
Copy link
Copy Markdown
Contributor Author

The merge conflicts were resolved in the latest push - the branch is rebased cleanly on top of main (no conflict markers remaining). GitHub's mergeable status now shows clean.

@mahadzaryab1
Copy link
Copy Markdown
Collaborator

The merge conflicts were resolved in the latest push - the branch is rebased cleanly on top of main (no conflict markers remaining). GitHub's mergeable status now shows clean.

I'm still seeing merge conflicts

@github-actions github-actions Bot added the waiting-for-author PR is waiting for author to respond to maintainer's comments label May 30, 2026
…TTP gateway

The api/v3 GetDependencies method was defined in the proto but not
implemented in the Go Handler or HTTP gateway, causing every call to
return an unimplemented error.  Wire the method through to the
QueryService so callers can fetch service dependency graphs via v3.

Signed-off-by: Pulkit Saraf <prateeksaraf9@gmail.com>
Copilot AI review requested due to automatic review settings May 31, 2026 07:47
@Pulkit7070 Pulkit7070 force-pushed the feat/apiv3-get-dependencies branch from 54f7490 to 36ac250 Compare May 31, 2026 07:47
@github-actions github-actions Bot removed the waiting-for-author PR is waiting for author to respond to maintainer's comments label May 31, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment on lines 239 to 241
h.marshalResponse(&api_v3.DependenciesResponse{Dependencies: apiDeps}, w)
}
func (h *HTTPGateway) getServices(w http.ResponseWriter, r *http.Request) {
Comment on lines +158 to +160
if startTime.IsZero() || endTime.IsZero() {
return nil, status.Error(codes.InvalidArgument, "start_time and end_time are required")
}
- Add blank line between getDependencies and getServices handlers
- Validate that endTime is after startTime in both HTTP and gRPC handlers
- Use getQueryParam helper in getDependencies to support deprecated snake_case params
- Add gRPC handler tests for success path, invalid params, and storage error
- Add depReader field to testServerClient for dependency mock access

Signed-off-by: Pulkit Saraf <prateeksaraf9@gmail.com>
Copy link
Copy Markdown
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unrelated changes

Restore snapshot files to their upstream state; the CRLF/LF
regeneration was a Windows-only side effect unrelated to the
GetDependencies feature.

Signed-off-by: Pulkit Saraf <prateeksaraf9@gmail.com>
Copilot AI review requested due to automatic review settings May 31, 2026 18:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment on lines +235 to +243
apiDeps := make([]*api_v3.Dependency, len(deps))
for i, d := range deps {
apiDeps[i] = &api_v3.Dependency{
Parent: d.Parent,
Child: d.Child,
CallCount: uint64(d.CallCount),
}
}
h.marshalResponse(&api_v3.DependenciesResponse{Dependencies: apiDeps}, w)
Comment on lines +213 to +218
startTimeStr, startTimeParam := getQueryParam(q, paramStartTime, paramStartTimeDeprecated)
endTimeStr, endTimeParam := getQueryParam(q, paramEndTime, paramEndTimeDeprecated)
if startTimeStr == "" || endTimeStr == "" {
h.tryHandleError(w, fmt.Errorf("%s and %s are required", paramStartTime, paramEndTime), http.StatusBadRequest)
return
}
Comment on lines +583 to +592
func TestHTTPGatewayGetDependenciesMissingParams(t *testing.T) {
gw := setupHTTPGatewayNoServer(t, "")

r, err := http.NewRequest(http.MethodGet, "/api/v3/dependencies", http.NoBody)
require.NoError(t, err)
w := httptest.NewRecorder()
gw.router.ServeHTTP(w, r)
assert.Equal(t, http.StatusBadRequest, w.Code)
assert.Contains(t, w.Body.String(), "are required")
}
- Extract toAPIDependencies helper to eliminate duplicate conversion loop
- Report specific missing parameter name in getDependencies error messages
- Add HTTP tests for invalid time format, end-before-start, and storage error

Signed-off-by: Pulkit Saraf <prateeksaraf9@gmail.com>
@Pulkit7070
Copy link
Copy Markdown
Contributor Author

Addressed in the latest push: reverted the unrelated snapshot line-ending changes so only the GetDependencies-related files are modified. Also addressed all three Copilot comments from the second review (extracted toAPIDependencies helper, per-param missing error messages, added HTTP tests for invalid time format, end-before-start, and storage error).

Copy link
Copy Markdown
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please comment and resolve Copilot comments that are already addressed

@yurishkuro
Copy link
Copy Markdown
Member

linter failure

@github-actions github-actions Bot added the waiting-for-author PR is waiting for author to respond to maintainer's comments label Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:bugfix-or-minor-feature enhancement waiting-for-author PR is waiting for author to respond to maintainer's comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add support to query for dependencies in api/v3 API

4 participants