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

Add manual implementation of APIv3 HTTP endpoints #5054

Merged
merged 16 commits into from
Dec 30, 2023

Conversation

yurishkuro
Copy link
Member

@yurishkuro yurishkuro commented Dec 28, 2023

Which problem is this PR solving?

Description of the changes

  • Pull in IDL change Add grpc-gateway helper types jaeger-idl#102
  • Re-implement APIv3 HTTP endpoints without the use of grpc-gateway
  • Share tests from grpc-gateway for manual implementation
    • Refactor tests to avoid duplication of snapshots
  • Fix inconsistency between http and grpc tenancy interceptors where HTTP was returning Unauthenticated in certain cases, but GRPC was always returning Forbidden. Make them consistent: missing tenant header results in Unauthenticated.

Follow-ups

  • http implementation needs more unit tests (mostly error handling and parameter variations)
  • the new implementation is not hooked up into production code yet, I first want to confirm it works with model-v2, and just in general minimize the scope of a single PR

How was this change tested?

Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Copy link

codecov bot commented Dec 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (84e7b69) 95.55% compared to head (3abcaa2) 95.58%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5054      +/-   ##
==========================================
+ Coverage   95.55%   95.58%   +0.03%     
==========================================
  Files         313      314       +1     
  Lines       18160    18321     +161     
==========================================
+ Hits        17352    17513     +161     
  Misses        647      647              
  Partials      161      161              
Flag Coverage Δ
cassandra-3.x 25.61% <0.00%> (ø)
cassandra-4.x 25.61% <0.00%> (ø)
elasticsearch-5.x 19.87% <0.00%> (-0.02%) ⬇️
elasticsearch-6.x 19.88% <0.00%> (ø)
elasticsearch-7.x 20.02% <0.00%> (ø)
elasticsearch-8.x 20.09% <0.00%> (-0.02%) ⬇️
grpc-badger 19.50% <0.00%> (ø)
kafka 14.10% <0.00%> (ø)
opensearch-1.x 20.00% <0.00%> (-0.02%) ⬇️
opensearch-2.x 20.00% <0.00%> (ø)
unittests 93.27% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Yuri Shkuro <[email protected]>
@@ -60,6 +61,9 @@ const (
// REGENERATE_SNAPSHOTS=true go test -v ./cmd/query/app/apiv3/...
var regenerateSnapshots = os.Getenv("REGENERATE_SNAPSHOTS") == "true"

// The tests in http_gateway_test.go set this to true to use manual gateway implementation.
var useHTTPGateway = false
Copy link
Member Author

@yurishkuro yurishkuro Dec 28, 2023

Choose a reason for hiding this comment

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

not the cleanest way, but hopefully we'll just delete grpc-gateway based implementation soon and simplify/consolidate the tests

// Unwrap the 'result' container generated by the gateway.
// See https://github.com/grpc-ecosystem/grpc-gateway/issues/2189
type resultWrapper struct {
Result json.RawMessage `json:"result"`
Copy link
Member Author

@yurishkuro yurishkuro Dec 28, 2023

Choose a reason for hiding this comment

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

to avoid this ugliness use the new helper types from IDL and marshal in one go.

@yurishkuro yurishkuro added changelog:new-feature Change that should be called out as new feature in CHANGELOG changelog:bugfix-or-minor-feature and removed changelog:new-feature Change that should be called out as new feature in CHANGELOG labels Dec 28, 2023
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
@yurishkuro yurishkuro changed the title Add proof-of-concept manual implementation of APIv3 HTTP endpoints Add manual implementation of APIv3 HTTP endpoints Dec 28, 2023
@yurishkuro yurishkuro marked this pull request as ready for review December 28, 2023 17:25
@yurishkuro yurishkuro requested a review from a team as a code owner December 28, 2023 17:25
@yurishkuro yurishkuro requested a review from jkowall December 28, 2023 17:25
@yurishkuro yurishkuro merged commit 718f666 into jaegertracing:main Dec 30, 2023
36 of 37 checks passed
@yurishkuro yurishkuro deleted the grpc-gateway-manual-impl branch December 30, 2023 19:24
yurishkuro added a commit that referenced this pull request Dec 30, 2023
## Which problem is this PR solving?
- Part of #5052
- Continues #5054
- Closes #4911

## Description of the changes
- Replace grpc-gateway based implementation with manual HTTP
implementation from #5054
- Clean up spurious grpc-gateway usage (e.g. all-in-one test that did
not need it)
- Delete grpc-gateway step from `make proto` and remove the
corresponding generated file
- `go mod tidy` removes grpc-gateway and github.com/golang/protobuf

## How was this change tested?
- CI

---------

Signed-off-by: Yuri Shkuro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant