Skip to content

Commit

Permalink
[fix] Fix call to GetDependencies in grpc handler (#6324)
Browse files Browse the repository at this point in the history
## Description of the changes
- This PR fixes a bug in the query GRPC handler which currently passes
`startTime` to `GetDependencies` instead of `endTime`

## How was this change tested?
- Fixed unit test expectations

## Checklist
- [x] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [x] I have signed all commits
- [x] I have added unit tests for the new functionality
- [x] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `yarn lint` and `yarn test`

---------

Signed-off-by: Mahad Zaryab <[email protected]>
  • Loading branch information
mahadzaryab1 authored Dec 7, 2024
1 parent 593315b commit 723202b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/query/app/grpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (g *GRPCHandler) GetDependencies(ctx context.Context, r *api_v2.GetDependen
return nil, status.Errorf(codes.InvalidArgument, "StartTime and EndTime must be initialized.")
}

dependencies, err := g.queryService.GetDependencies(ctx, startTime, endTime.Sub(startTime))
dependencies, err := g.queryService.GetDependencies(ctx, endTime, endTime.Sub(startTime))
if err != nil {
g.logger.Error("failed to fetch dependencies", zap.Error(err))
return nil, status.Errorf(codes.Internal, "failed to fetch dependencies: %v", err)
Expand Down
4 changes: 2 additions & 2 deletions cmd/query/app/grpc_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ func TestGetDependenciesSuccessGRPC(t *testing.T) {
endTs := time.Now().UTC()
server.depReader.On("GetDependencies",
mock.Anything, // context.Context
endTs.Add(time.Duration(-1)*defaultDependencyLookbackDuration),
endTs,
defaultDependencyLookbackDuration,
).Return(expectedDependencies, nil).Times(1)

Expand All @@ -532,7 +532,7 @@ func TestGetDependenciesFailureGRPC(t *testing.T) {
server.depReader.On(
"GetDependencies",
mock.Anything, // context.Context
endTs.Add(time.Duration(-1)*defaultDependencyLookbackDuration),
endTs,
defaultDependencyLookbackDuration).Return(nil, errStorageGRPC).Times(1)

_, err := client.GetDependencies(context.Background(), &api_v2.GetDependenciesRequest{
Expand Down

0 comments on commit 723202b

Please sign in to comment.