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 remote gRPC option for storage plugin #3383

Merged
merged 11 commits into from
Dec 10, 2021

Conversation

cevian
Copy link
Contributor

@cevian cevian commented Nov 10, 2021

Which problem is this PR solving?

Resolves #3377
Resolves #1519

Short description of the changes

Adds the option to host a gRPC storage API on a remote endpoint
using regular gRPC. Previously the plugin system only supported
local socket connections through the go-hashicorp plugin system.

@cevian cevian requested a review from a team as a code owner November 10, 2021 13:55
Adds the option to host a gRPC storage API on a remote endpoint
using regular gRPC. Previously the plugin system only supported
local socket connections through the go-hashicorp plugin system.

Signed-off-by: Matvey Arye <[email protected]>
@cevian
Copy link
Contributor Author

cevian commented Nov 10, 2021

I couldn't find how the existing plugin was tested end-to-end, so couldn't write better tests. If more tests are needed, please point me in the right direction.

@cevian
Copy link
Contributor Author

cevian commented Nov 10, 2021

Also wasn't sure about the CLI option naming.

Copy link
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.

Can we adapt grpc-plugin storage integration test to test via remote grpc as well?

Comment on lines 30 to 34
pluginServer = "grpc-storage-plugin.server"
pluginTLS = "grpc-storage-plugin.tls"
pluginCAFile = "grpc-storage-plugin.ca-file"
pluginServerHostOverride = "grpc-storage-plugin.server-host-override"
pluginConnectionTimeout = "grpc-storage-plugin.connection-timeout"
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we can just call it grpc-storage, not the plugin

plugin/storage/grpc/config/config.go Outdated Show resolved Hide resolved
@yurishkuro
Copy link
Member

plugin test is here

jaeger/Makefile

Lines 105 to 107 in 745587a

grpc-storage-integration-test:
(cd examples/memstore-plugin/ && go build .)
bash -c "set -e; set -o pipefail; $(GOTEST) -tags=grpc_storage_integration $(STORAGE_PKGS) | $(COLORIZE)"

@cevian
Copy link
Contributor Author

cevian commented Nov 10, 2021

@yurishkuro for the integration tests I will need to either:

  1. modify examples/memstore-plugin to be able to accept a gRPC address cli flag to listen on (and then either start the plugin or the grpc server depending on the flag)
    or
  2. create a new examples/memstore-remote to only act as a gRPC server (not the plugin)

Option 1 is less code changes but the examples become a bit more muddled. Do you have any preference if we want a separate example for this?

@yurishkuro
Copy link
Member

I think option 1 is ok, but I was also thinking that the plugin / grpc server implemented in examples/memstore-plugin is actually pretty boiler plate and just invokes shared plugin/storage/grpc.ServeWithGRPCServer. It might be useful to extend that shared functionality to allow a choice between a unix socket server and a an IP socket. This way we could keep the example itself minimal, we'll just need to expose a CLI flag in it specifying in which mode it should start. Thoughts?

@cevian
Copy link
Contributor Author

cevian commented Nov 10, 2021

Hmm I like that idea. Let me try it out.

plugin/storage/grpc/config/config.go Outdated Show resolved Hide resolved
plugin/storage/grpc/options.go Outdated Show resolved Hide resolved
Use the tlscfg package for the TLS configuration and change the
cli option prefix from `grpc-storage-plugin` to `grpc-storage`.

Signed-off-by: Matvey Arye <[email protected]>
We also created a RegisterServer method on StorageGRPCPlugin to
register be able to easily create remote GRPC servers.

Signed-off-by: Matvey Arye <[email protected]>
Also ran `make fmt`

Signed-off-by: Matvey Arye <[email protected]>
plugin/storage/grpc/config/config.go Outdated Show resolved Hide resolved
plugin/storage/grpc/options.go Outdated Show resolved Hide resolved
plugin/storage/grpc/options.go Outdated Show resolved Hide resolved
Comment on lines 52 to 53
var tlsFlagsConfig = tlsFlagsConfig()
tlsFlagsConfig.AddFlags(flagSet)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var tlsFlagsConfig = tlsFlagsConfig()
tlsFlagsConfig.AddFlags(flagSet)
tlsFlagsConfig().AddFlags(flagSet)

plugin/storage/grpc/options.go Outdated Show resolved Hide resolved
// GRPCServer implements plugin.GRPCPlugin. It is used by go-plugin to create a grpc plugin server.
func (p *StorageGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error {
// RegisterServer registers the plugin with the server
func (p *StorageGRPCPlugin) RegisterServer(s *grpc.Server) error {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func (p *StorageGRPCPlugin) RegisterServer(s *grpc.Server) error {
func (p *StorageGRPCPlugin) RegisterHandlers(s *grpc.Server) error {

Comment on lines 75 to 76
err := queryPlugin.RegisterServer(s.server)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
err := queryPlugin.RegisterServer(s.server)
if err != nil {
if err := queryPlugin.RegisterServer(s.server); err != nil {

Comment on lines 87 to 88
err = s.server.Serve(listener)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
err = s.server.Serve(listener)
if err != nil {
if err := s.server.Serve(listener); err != nil {

plugin/storage/integration/grpc_test.go Outdated Show resolved Hide resolved
"--grpc-storage-plugin.binary", binaryPath,
"--grpc-storage-plugin.log-level", "debug",
}
if configPath != "" {
Copy link
Member

Choose a reason for hiding this comment

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

this check seems unnecessary, will it fail if we append --grpc-storage-plugin.configuration-file with empty string value?

@codecov
Copy link

codecov bot commented Nov 13, 2021

Codecov Report

Merging #3383 (5c24f6e) into main (d825152) will increase coverage by 0.02%.
The diff coverage is 67.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3383      +/-   ##
==========================================
+ Coverage   96.49%   96.51%   +0.02%     
==========================================
  Files         261      262       +1     
  Lines       15277    15307      +30     
==========================================
+ Hits        14741    14774      +33     
+ Misses        453      452       -1     
+ Partials       83       81       -2     
Impacted Files Coverage Δ
plugin/storage/grpc/shared/grpc_client.go 79.06% <0.00%> (-4.37%) ⬇️
plugin/storage/grpc/shared/plugin.go 0.00% <0.00%> (ø)
plugin/storage/grpc/factory.go 100.00% <100.00%> (ø)
plugin/storage/grpc/memory/plugin.go 100.00% <100.00%> (ø)
plugin/storage/grpc/options.go 100.00% <100.00%> (ø)
plugin/storage/badger/spanstore/reader.go 96.21% <0.00%> (+0.70%) ⬆️
cmd/query/app/static_handler.go 97.60% <0.00%> (+1.79%) ⬆️
cmd/collector/app/server/zipkin.go 70.73% <0.00%> (+2.43%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d825152...5c24f6e. Read the comment docs.

@cevian
Copy link
Contributor Author

cevian commented Nov 15, 2021

Thanks for the detailed review @yurishkuro. I think I addressed all the issues

Copy link
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 add some tests to plugin/storage/grpc/memory

I recommend running make test lint locally before submitting

@@ -87,6 +140,31 @@ func (s *GRPCStorageIntegrationTestSuite) cleanUp() error {
return s.initialize()
}

type memoryStorePlugin struct {
Copy link
Member

Choose a reason for hiding this comment

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

do you need this type in the test, or can you use one from plugin/storage/grpc/memory/plugin.go ?

plugin/storage/grpc/factory.go Show resolved Hide resolved
Comment on lines 68 to 71
if c.PluginBinary == "" {
return c.RemoteTLS.Close()
}
return nil
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if c.PluginBinary == "" {
return c.RemoteTLS.Close()
}
return nil
return c.RemoteTLS.Close()

the check is not necessary, TLSConfig.Close() is safe to call

yurishkuro
yurishkuro previously approved these changes Dec 10, 2021
Copy link
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.

Thanks!

@yurishkuro yurishkuro enabled auto-merge (squash) December 10, 2021 14:52
@yurishkuro yurishkuro merged commit 1b74ef9 into jaegertracing:main Dec 10, 2021
JamesGuthrie added a commit to timescale/promscale that referenced this pull request Jan 18, 2022
With upstream support for remote gPRC storage plugins [1], our query
proxy is no longer required. Updated documentation to illustrate how to
use jaeger standalone.

[1]: jaegertracing/jaeger#3383
JamesGuthrie added a commit to timescale/promscale that referenced this pull request Jan 26, 2022
With upstream support for remote gPRC storage plugins [1], our query
proxy is no longer required. Updated documentation to illustrate how to
use jaeger standalone.

[1]: jaegertracing/jaeger#3383
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the ability to use the gRPC storage plugin with a remote endpoint Support gRPC API for storage
2 participants