From 9d547fe5e3baed7c22c71d4e34f657ac81fd8d52 Mon Sep 17 00:00:00 2001 From: Benedikt Bongartz Date: Tue, 13 Aug 2024 18:08:59 +0200 Subject: [PATCH] update vendor Signed-off-by: Benedikt Bongartz --- .../jaeger/pkg/tenancy/context.go | 43 ---- .../jaegertracing/jaeger/pkg/tenancy/flags.go | 54 ---- .../jaegertracing/jaeger/pkg/tenancy/grpc.go | 149 ----------- .../jaegertracing/jaeger/pkg/tenancy/http.go | 65 ----- .../jaeger/pkg/tenancy/manager.go | 91 ------- .../jaegertracing/jaeger/plugin/README.md | 3 - .../jaeger/plugin/configurable.go | 33 --- .../jaegertracing/jaeger/plugin/doc.go | 19 -- .../jaeger/plugin/storage/grpc/README.md | 243 ------------------ .../plugin/storage/grpc/config/config.go | 230 ----------------- .../jaeger/plugin/storage/grpc/factory.go | 177 ------------- .../jaeger/plugin/storage/grpc/grpc.go | 46 ---- .../jaeger/plugin/storage/grpc/options.go | 83 ------ vendor/modules.txt | 4 - 14 files changed, 1240 deletions(-) delete mode 100644 vendor/github.com/jaegertracing/jaeger/pkg/tenancy/context.go delete mode 100644 vendor/github.com/jaegertracing/jaeger/pkg/tenancy/flags.go delete mode 100644 vendor/github.com/jaegertracing/jaeger/pkg/tenancy/grpc.go delete mode 100644 vendor/github.com/jaegertracing/jaeger/pkg/tenancy/http.go delete mode 100644 vendor/github.com/jaegertracing/jaeger/pkg/tenancy/manager.go delete mode 100644 vendor/github.com/jaegertracing/jaeger/plugin/README.md delete mode 100644 vendor/github.com/jaegertracing/jaeger/plugin/configurable.go delete mode 100644 vendor/github.com/jaegertracing/jaeger/plugin/doc.go delete mode 100644 vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/README.md delete mode 100644 vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/config/config.go delete mode 100644 vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/factory.go delete mode 100644 vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/grpc.go delete mode 100644 vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/options.go diff --git a/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/context.go b/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/context.go deleted file mode 100644 index 9e0021e3659..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/context.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tenancy - -import "context" - -// tenantKeyType is a custom type for the key "tenant", following context.Context convention -type tenantKeyType string - -const ( - // tenantKey holds tenancy for spans - tenantKey = tenantKeyType("tenant") -) - -// WithTenant creates a Context with a tenant association -func WithTenant(ctx context.Context, tenant string) context.Context { - return context.WithValue(ctx, tenantKey, tenant) -} - -// GetTenant retrieves a tenant associated with a Context -func GetTenant(ctx context.Context) string { - tenant := ctx.Value(tenantKey) - if tenant == nil { - return "" - } - - if s, ok := tenant.(string); ok { - return s - } - return "" -} diff --git a/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/flags.go b/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/flags.go deleted file mode 100644 index 0a050c4a3ef..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/flags.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tenancy - -import ( - "flag" - "fmt" - "strings" - - "github.com/spf13/viper" -) - -const ( - flagPrefix = "multi-tenancy" - flagTenancyEnabled = flagPrefix + ".enabled" - flagTenancyHeader = flagPrefix + ".header" - flagValidTenants = flagPrefix + ".tenants" -) - -// AddFlags adds flags for tenancy to the FlagSet. -func AddFlags(flags *flag.FlagSet) { - flags.Bool(flagTenancyEnabled, false, "Enable tenancy header when receiving or querying") - flags.String(flagTenancyHeader, "x-tenant", "HTTP header carrying tenant") - flags.String(flagValidTenants, "", - fmt.Sprintf("comma-separated list of allowed values for --%s header. (If not supplied, tenants are not restricted)", - flagTenancyHeader)) -} - -// InitFromViper creates tenancy.Options populated with values retrieved from Viper. -func InitFromViper(v *viper.Viper) Options { - var p Options - p.Enabled = v.GetBool(flagTenancyEnabled) - p.Header = v.GetString(flagTenancyHeader) - tenants := v.GetString(flagValidTenants) - if len(tenants) != 0 { - p.Tenants = strings.Split(tenants, ",") - } else { - p.Tenants = []string{} - } - - return p -} diff --git a/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/grpc.go b/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/grpc.go deleted file mode 100644 index 80d069d3825..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/grpc.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tenancy - -import ( - "context" - - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// tenantedServerStream is a wrapper for ServerStream providing settable context -type tenantedServerStream struct { - grpc.ServerStream - context context.Context -} - -func (tss *tenantedServerStream) Context() context.Context { - return tss.context -} - -func getValidTenant(ctx context.Context, tc *Manager) (string, error) { - // Handle case where tenant is already directly in the context - tenant := GetTenant(ctx) - if tenant != "" { - if !tc.Valid(tenant) { - return tenant, status.Errorf(codes.PermissionDenied, "unknown tenant") - } - return tenant, nil - } - - // Handle case where tenant is in the context metadata - md, ok := metadata.FromIncomingContext(ctx) - if !ok { - return "", status.Errorf(codes.PermissionDenied, "missing tenant header") - } - - var err error - tenant, err = tenantFromMetadata(md, tc.Header) - if err != nil { - return "", err - } - if !tc.Valid(tenant) { - return tenant, status.Errorf(codes.PermissionDenied, "unknown tenant") - } - - return tenant, nil -} - -func directlyAttachedTenant(ctx context.Context) bool { - return GetTenant(ctx) != "" -} - -// NewGuardingStreamInterceptor blocks handling of streams whose tenancy header doesn't meet tenancy requirements. -// It also ensures the tenant is directly in the context, rather than context metadata. -func NewGuardingStreamInterceptor(tc *Manager) grpc.StreamServerInterceptor { - return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - tenant, err := getValidTenant(ss.Context(), tc) - if err != nil { - return err - } - - if directlyAttachedTenant(ss.Context()) { - return handler(srv, ss) - } - - // "upgrade" the tenant to be part of the context, rather than just incoming metadata - return handler(srv, &tenantedServerStream{ - ServerStream: ss, - context: WithTenant(ss.Context(), tenant), - }) - } -} - -func tenantFromMetadata(md metadata.MD, tenancyHeader string) (string, error) { - tenants := md.Get(tenancyHeader) - if len(tenants) < 1 { - return "", status.Errorf(codes.Unauthenticated, "missing tenant header") - } else if len(tenants) > 1 { - return "", status.Errorf(codes.PermissionDenied, "extra tenant header") - } - - return tenants[0], nil -} - -// NewGuardingUnaryInterceptor blocks handling of RPCs whose tenancy header doesn't meet tenancy requirements. -// It also ensures the tenant is directly in the context, rather than context metadata. -func NewGuardingUnaryInterceptor(tc *Manager) grpc.UnaryServerInterceptor { - return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { - tenant, err := getValidTenant(ctx, tc) - if err != nil { - return nil, err - } - - if directlyAttachedTenant(ctx) { - return handler(ctx, req) - } - - return handler(WithTenant(ctx, tenant), req) - } -} - -// NewClientUnaryInterceptor injects tenant header into gRPC request metadata. -func NewClientUnaryInterceptor(tc *Manager) grpc.UnaryClientInterceptor { - return grpc.UnaryClientInterceptor(func( - ctx context.Context, - method string, - req, reply interface{}, - cc *grpc.ClientConn, - invoker grpc.UnaryInvoker, - opts ...grpc.CallOption, - ) error { - if tenant := GetTenant(ctx); tenant != "" { - ctx = metadata.AppendToOutgoingContext(ctx, tc.Header, tenant) - } - return invoker(ctx, method, req, reply, cc, opts...) - }) -} - -// NewClientStreamInterceptor injects tenant header into gRPC request metadata. -func NewClientStreamInterceptor(tc *Manager) grpc.StreamClientInterceptor { - return grpc.StreamClientInterceptor(func( - ctx context.Context, - desc *grpc.StreamDesc, - cc *grpc.ClientConn, - method string, - streamer grpc.Streamer, - opts ...grpc.CallOption, - ) (grpc.ClientStream, error) { - if tenant := GetTenant(ctx); tenant != "" { - ctx = metadata.AppendToOutgoingContext(ctx, tc.Header, tenant) - } - return streamer(ctx, desc, cc, method, opts...) - }) -} diff --git a/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/http.go b/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/http.go deleted file mode 100644 index 0884a7d41ed..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/http.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tenancy - -import ( - "context" - "net/http" - - "google.golang.org/grpc/metadata" -) - -// PropagationHandler returns a http.Handler containing the logic to extract -// the tenancy header of the http.Request and insert the tenant into request.Context -// for propagation. The token can be accessed via tenancy.GetTenant(). -func ExtractTenantHTTPHandler(tc *Manager, h http.Handler) http.Handler { - if !tc.Enabled { - return h - } - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - tenant := r.Header.Get(tc.Header) - if tenant == "" { - w.WriteHeader(http.StatusUnauthorized) - w.Write([]byte("missing tenant header")) - return - } - - if !tc.Valid(tenant) { - w.WriteHeader(http.StatusUnauthorized) - w.Write([]byte("unknown tenant")) - return - } - - ctx := WithTenant(r.Context(), tenant) - h.ServeHTTP(w, r.WithContext(ctx)) - }) -} - -// MetadataAnnotator returns a function suitable for propagating tenancy -// via github.com/grpc-ecosystem/grpc-gateway/runtime.NewServeMux -func (tc *Manager) MetadataAnnotator() func(context.Context, *http.Request) metadata.MD { - return func(ctx context.Context, req *http.Request) metadata.MD { - tenant := req.Header.Get(tc.Header) - if tenant == "" { - // The HTTP request lacked the tenancy header. Pass along - // empty metadata -- the gRPC query service will reject later. - return metadata.Pairs() - } - return metadata.New(map[string]string{ - tc.Header: tenant, - }) - } -} diff --git a/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/manager.go b/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/manager.go deleted file mode 100644 index 9f6addf1471..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/pkg/tenancy/manager.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2022 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package tenancy - -// Options describes the configuration properties for multitenancy -type Options struct { - Enabled bool - Header string - Tenants []string -} - -// Manager can check tenant usage for multi-tenant Jaeger configurations -type Manager struct { - Enabled bool - Header string - guard guard -} - -// Guard verifies a valid tenant when tenancy is enabled -type guard interface { - Valid(candidate string) bool -} - -// NewManager creates a tenancy.Manager for given tenancy.Options. -func NewManager(options *Options) *Manager { - // Default header value (although set by CLI flags, this helps tests and API users) - header := options.Header - if header == "" && options.Enabled { - header = "x-tenant" - } - return &Manager{ - Enabled: options.Enabled, - Header: header, - guard: tenancyGuardFactory(options), - } -} - -func (tc *Manager) Valid(tenant string) bool { - return tc.guard.Valid(tenant) -} - -type tenantDontCare bool - -func (tenantDontCare) Valid(candidate string) bool { - return true -} - -type tenantList struct { - tenants map[string]bool -} - -func (tl *tenantList) Valid(candidate string) bool { - _, ok := tl.tenants[candidate] - return ok -} - -func newTenantList(tenants []string) *tenantList { - tenantMap := make(map[string]bool) - for _, tenant := range tenants { - tenantMap[tenant] = true - } - - return &tenantList{ - tenants: tenantMap, - } -} - -func tenancyGuardFactory(options *Options) guard { - // Three cases - // - no tenancy - // - tenancy, but no guarding by tenant - // - tenancy, with guarding by a list - - if !options.Enabled || len(options.Tenants) == 0 { - return tenantDontCare(true) - } - - return newTenantList(options.Tenants) -} diff --git a/vendor/github.com/jaegertracing/jaeger/plugin/README.md b/vendor/github.com/jaegertracing/jaeger/plugin/README.md deleted file mode 100644 index 4490c35fb9a..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/plugin/README.md +++ /dev/null @@ -1,3 +0,0 @@ -The collection of implementations of different interfaces defined across Jaeger - -For example, implementations of the storage interface can be found in the plugin package \ No newline at end of file diff --git a/vendor/github.com/jaegertracing/jaeger/plugin/configurable.go b/vendor/github.com/jaegertracing/jaeger/plugin/configurable.go deleted file mode 100644 index 20872798630..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/plugin/configurable.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2019 The Jaeger Authors. -// Copyright (c) 2017 Uber Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package plugin - -import ( - "flag" - - "github.com/spf13/viper" - "go.uber.org/zap" -) - -// Configurable interface can be implemented by plugins that require external configuration, -// such as CLI flags, config files, or environment variables. -type Configurable interface { - // AddFlags adds CLI flags for configuring this component. - AddFlags(flagSet *flag.FlagSet) - - // InitFromViper initializes this component with properties from spf13/viper. - InitFromViper(v *viper.Viper, logger *zap.Logger) -} diff --git a/vendor/github.com/jaegertracing/jaeger/plugin/doc.go b/vendor/github.com/jaegertracing/jaeger/plugin/doc.go deleted file mode 100644 index dd04bfff02b..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/plugin/doc.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2019 The Jaeger Authors. -// Copyright (c) 2017 Uber Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package plugin is the collection of implementations of different interfaces defined across Jaeger -// -// For example, implementations of the storage interface can be found in the plugin package -package plugin diff --git a/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/README.md b/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/README.md deleted file mode 100644 index 1fee18db23a..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/README.md +++ /dev/null @@ -1,243 +0,0 @@ -gRPC Storage Plugins -==================== - -Update (Jan 2022): as of Jaeger v1.30, the gRPC storage extension can be implemented as a remote gRPC server, in addition to the gRPC plugin architecture described below. The remote server needs to implement the same `storage_v1` gRPC interfaces defined in `plugin/storage/grpc/proto/`. - -gRPC Storage Plugins currently use the [Hashicorp go-plugin](https://github.com/hashicorp/go-plugin). This requires the -implementer of a plugin to develop the "server" side of the go-plugin system. At a high level this looks like: - -``` -+----------------------------------+ +-----------------------------+ -| | | | -| +-------------+ | unix-socket | +-------------+ | -| | | | | | | | -| jaeger-component | grpc-client +----------------------> grpc-server | plugin-impl | -| | | | | | | | -| +-------------+ | | +-------------+ | -| | | | -+----------------------------------+ +-----------------------------+ - - parent process child sub-process -``` - -Implementing a plugin ----------------------- - -Although the instructions below are limited to Go, plugins can be implemented any language. Languages other than -Go would implement a gRPC server using the `storage_v1` proto interfaces. The `proto` file can be found in `plugin/storage/grpc/proto/`. -To generate the bindings for your language you would use `protoc` with the appropriate `xx_out=` flag. This is detailed -in the [protobuf documentation](https://developers.google.com/protocol-buffers/docs/tutorials) and you can see an example of -how it is done for Go in the top level Jaeger `Makefile`. - -The easiest way to generate the gRPC storage plugin bindings is to use [Docker Protobuf](https://github.com/jaegertracing/docker-protobuf/) which is a lightweight `protoc` Docker image containing the dependencies needed to generate code for multiple languages. For example, one can generate bindings for C# on Windows with Docker for Windows using the following steps: -1. First clone the Jaeger github repo to a folder (e.g. `c:\source\repos\jaeger`): -``` -$ mkdir c:\source\repos\jaeger -$ cd c:\source\repos\jaeger -$ git clone https://github.com/jaegertracing/jaeger.git c:\source\repos\jaeger -``` -2. Initialize the Jaeger repo submodules (this pulls in code from other Jaeger repositories that are needed): -``` -$ git submodule update --init --recursive -``` -3. Then execute the following Docker command which mounts the local directory `c:\source\repos\jaeger` to the directory `/jaeger` in the Docker container and then executes the `jaegertracing/protobuf:0.2.0` command. This will create a file called `Storage.cs` in your local Windows folder `c:\source\repos\jaeger\code` containing the gRPC Storage Plugin bindings. -``` -$ docker run --rm -u 1000 -v/c/source/repos/jaeger:/jaeger -w/jaeger \ - jaegertracing/protobuf:0.2.0 "-I/jaeger -Iidl/proto/api_v2 -I/usr/include/github.com/gogo/protobuf -Iplugin/storage/grpc/proto --csharp_out=/jaeger/code plugin/storage/grpc/proto/storage.proto" -``` - -There are instructions on implementing a `go-plugin` server for non-Go languages in the -[go-plugin non-go guide](https://github.com/hashicorp/go-plugin/blob/master/docs/guide-plugin-write-non-go.md). -Take note of the required [health check service](https://github.com/hashicorp/go-plugin/blob/master/docs/guide-plugin-write-non-go.md#3-add-the-grpc-health-checking-service). - -A Go plugin is a standalone application which calls `grpc.Serve(&pluginServices)` in its `main` function, where the `grpc` package -is `github.com/jaegertracing/jaeger/plugin/storage/grpc`. - -```go - package main - - import ( - "flag" - "github.com/jaegertracing/jaeger/plugin/storage/grpc" - ) - - func main() { - var configPath string - flag.StringVar(&configPath, "config", "", "A path to the plugin's configuration file") - flag.Parse() - - plugin := myStoragePlugin{} - - grpc.Serve(&shared.PluginServices{ - Store: plugin, - ArchiveStore: plugin, - }) - } -``` - -Note that `grpc.Serve` is called as the final part of the main. This should be called after you have carried out any necessary -setup for your plugin, as once running Jaeger may start calling to read/write spans straight away. You could defer -setup until the first read/write but that could make the first operation slow and also lead to racing behaviours. - -A plugin must implement the StoragePlugin interface of: - -```go -type StoragePlugin interface { - SpanReader() spanstore.Reader - SpanWriter() spanstore.Writer - DependencyReader() dependencystore.Reader -} -``` - -As your plugin will be dependent on the protobuf implementation within Jaeger you will likely need to `vendor` your -dependencies, you can also use `go.mod` to achieve the same goal of pinning your plugin to a Jaeger point in time. - -A simple plugin which uses the memstore storage implementation can be found in the `examples` directory of the top level -of the Jaeger project. - -To support archive storage a plugin must implement the ArchiveStoragePlugin interface of: - -```go -type ArchiveStoragePlugin interface { - ArchiveSpanReader() spanstore.Reader - ArchiveSpanWriter() spanstore.Writer -} -``` - -If you don't plan to implement archive storage simply do not fill `ArchiveStore` property of `shared.PluginServices`: - -```go -grpc.Serve(&shared.PluginServices{ - Store: plugin, -}) -``` - -The plugin framework supports writing spans via gRPC stream, instead of unary messages. Streaming writes can improve throughput and decrease CPU load (see benchmarks in Issue #3636). The plugin needs to implement `StreamingSpanWriter` interface and indicate support via the `streamingSpanWriter` flag in the `Capabilities` response. - -Note that using the streaming spanWriter may make the collector's `save_by_svr` metric inaccurate, in which case users will need to pay attention to the metrics provided by the plugin. - -Certifying compliance ---------------- -A plugin implementation shall verify it's correctness with Jaeger storage protocol by running the storage integration tests from [integration package](https://github.com/jaegertracing/jaeger/blob/main/plugin/storage/integration/integration.go#L397). - -```golang -import ( - jaeger_integration_tests "github.com/jaegertracing/jaeger/plugin/storage/integration" -) - -func TestJaegerStorageIntegration(t *testing.T) { - ... - si := jaeger_integration_tests.StorageIntegration{ - SpanReader: createSpanReader(), - SpanWriter: createSpanWriter(), - CleanUp: func() error { ... }, - Refresh: func() error { ... }, - SkipList: []string { // Skip any unsupported tests - }, - } - // Runs all storage integration tests. - si.IntegrationTestAll(t) -} -``` -For more details, refer to one of the following implementations. - -1. [grpc-plugin](https://github.com/jaegertracing/jaeger/blob/cbceceb1e0cc308cdf0226b1fa19b9c531a3a2d3/plugin/storage/integration/grpc_test.go#L189-L203) -2. [jaeger-clickhouse](https://github.com/jaegertracing/jaeger-clickhouse/blob/798c568c1e1a345536f35692fca71196a796811e/integration/grpc_test.go#L88-L107) -3. [Timescale DB via Promscale](https://github.com/timescale/promscale/blob/ccde8accf5205450891e805e23566d9a11dbf8d3/pkg/tests/end_to_end_tests/jaeger_store_integration_test.go#L79-L97) - -Running with a plugin ---------------------- -A plugin can be run using the `all-in-one` application within the top level `cmd` package of the Jaeger project. To do this -an environment variable must be set to tell the `all-in-one` application to use the gRPC plugin storage: -`export SPAN_STORAGE_TYPE="grpc-plugin"` - -Once this has been set then there are two command line flags that can be used to configure the plugin. The first is -`--grpc-storage-plugin.binary` which is required and is the path to the plugin **binary**. The second is -`--grpc-storage-plugin.configuration-file` which is optional and is the path to the configuration file which will be -provided to your plugin as a command line flag. This command line flag is `config`, as can be seen in the code sample -above. An example invocation would be: - -``` -./all-in-one --grpc-storage-plugin.binary=/path/to/my/plugin --grpc-storage-plugin.configuration-file=/path/to/my/config -``` - -As well as passing configuration values via the command line through the configuration file it is also possible to use -environment variables. When you invoke `all-in-one` any environment variables that have been set will also be accessible -from within your plugin, this is useful if using Docker. - -Logging -------- -In order for Jaeger to include the log output from your plugin you need to use `hclog` (`"github.com/hashicorp/go-hclog"`). -The plugin framework will only include any log output created at the `WARN` or above levels. If you log output in this -way before calling `grpc.Serve` then it will still be included in the Jaeger output. - -An example logger instantiation could look like: - - ``` -logger := hclog.New(&hclog.LoggerOptions{ - Level: hclog.Warn, - Name: "my-jaeger-plugin", - JSONFormat: true, -}) -``` - -There are more logger options that can be used with `hclog` listed on [godoc](https://godoc.org/github.com/hashicorp/go-hclog#LoggerOptions). - -Note: Setting the `Output` option to `os.Stdout` can confuse the `go-plugin` framework and lead it to consider the plugin -errored. - -Tracing -------- - -When `grpc-plugin` is used, it will be running as a separated process, thus context propagation is necessary for inter-process scenarios. - -In order to get complete traces containing both `jaeger-component`(s) and the `grpc-plugin`, developers should enable tracing at server-side. -Thus, we can leverage gRPC interceptors, - -```golang -grpc.ServeWithGRPCServer(&shared.PluginServices{ - Store: memStorePlugin, - ArchiveStore: memStorePlugin, -}, func(options []googleGRPC.ServerOption) *googleGRPC.Server { - return plugin.DefaultGRPCServer([]googleGRPC.ServerOption{ - grpc.UnaryInterceptor(otelgrpc.UnaryServerInterceptor(otelgrpc.WithTracerProvider(tracerProvider))), - grpc.StreamInterceptor(otelgrpc.StreamServerInterceptor(otelgrpc.WithTracerProvider(tracerProvider))), - }) -}) -``` - -Refer to `example/memstore-plugin` for more details. - -Bearer token propagation from the UI ------------------------------------- -When using `--query.bearer-token-propagation=true`, the bearer token will be properly passed on to the gRPC plugin server. To get access to the bearer token in your plugin, use a method similar to: - -```golang -import ( - // ... other imports - "fmt" - "google.golang.org/grpc/metadata" - - "github.com/jaegertracing/jaeger/plugin/storage/grpc" -) - -// ... spanReader type declared here - -func (r *spanReader) extractBearerToken(ctx context.Context) (string, bool) { - if md, ok := metadata.FromIncomingContext(ctx); ok { - values := md.Get(grpc.BearerTokenKey) - if len(values) > 0 { - return values[0], true - } - } - return "", false -} - -// ... spanReader interface implementation - -func (r *spanReader) GetServices(ctx context.Context) ([]string, error) { - str, ok := r.extractBearerToken(ctx) - fmt.Println(fmt.Sprintf("spanReader.GetServices: bearer-token: '%s', wasGiven: '%t'" str, ok)) - // ... -} -``` diff --git a/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/config/config.go b/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/config/config.go deleted file mode 100644 index c22e9f9d6f1..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/config/config.go +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) 2019 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package config - -import ( - "context" - "fmt" - "os/exec" - "time" - - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - "go.opentelemetry.io/otel/trace" - "go.uber.org/zap" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/credentials/insecure" - - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" - "github.com/jaegertracing/jaeger/pkg/tenancy" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" -) - -var pluginHealthCheckInterval = time.Second * 60 - -// Configuration describes the options to customize the storage behavior. -type Configuration struct { - PluginBinary string `yaml:"binary" mapstructure:"binary"` - PluginConfigurationFile string `yaml:"configuration-file" mapstructure:"configuration_file"` - PluginLogLevel string `yaml:"log-level" mapstructure:"log_level"` - RemoteServerAddr string `yaml:"server" mapstructure:"server"` - RemoteTLS tlscfg.Options - RemoteConnectTimeout time.Duration `yaml:"connection-timeout" mapstructure:"connection-timeout"` - TenancyOpts tenancy.Options - - pluginHealthCheck *time.Ticker - pluginHealthCheckDone chan bool - pluginRPCClient plugin.ClientProtocol - remoteConn *grpc.ClientConn -} - -// ClientPluginServices defines services plugin can expose and its capabilities -type ClientPluginServices struct { - shared.PluginServices - Capabilities shared.PluginCapabilities - killPluginClient func() -} - -func (c *ClientPluginServices) Close() error { - if c.killPluginClient != nil { - c.killPluginClient() - } - return nil -} - -// PluginBuilder is used to create storage plugins. Implemented by Configuration. -type PluginBuilder interface { - Build(logger *zap.Logger, tracerProvider trace.TracerProvider) (*ClientPluginServices, error) - Close() error -} - -// Build instantiates a PluginServices -func (c *Configuration) Build(logger *zap.Logger, tracerProvider trace.TracerProvider) (*ClientPluginServices, error) { - if c.PluginBinary != "" { - return c.buildPlugin(logger, tracerProvider) - } else { - return c.buildRemote(logger, tracerProvider) - } -} - -func (c *Configuration) Close() error { - if c.pluginHealthCheck != nil { - c.pluginHealthCheck.Stop() - c.pluginHealthCheckDone <- true - } - if c.remoteConn != nil { - c.remoteConn.Close() - } - - return c.RemoteTLS.Close() -} - -func (c *Configuration) buildRemote(logger *zap.Logger, tracerProvider trace.TracerProvider) (*ClientPluginServices, error) { - opts := []grpc.DialOption{ - grpc.WithStatsHandler(otelgrpc.NewClientHandler(otelgrpc.WithTracerProvider(tracerProvider))), - grpc.WithBlock(), - } - if c.RemoteTLS.Enabled { - tlsCfg, err := c.RemoteTLS.Config(logger) - if err != nil { - return nil, err - } - creds := credentials.NewTLS(tlsCfg) - opts = append(opts, grpc.WithTransportCredentials(creds)) - } else { - opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) - } - - ctx, cancel := context.WithTimeout(context.Background(), c.RemoteConnectTimeout) - defer cancel() - - tenancyMgr := tenancy.NewManager(&c.TenancyOpts) - if tenancyMgr.Enabled { - opts = append(opts, grpc.WithUnaryInterceptor(tenancy.NewClientUnaryInterceptor(tenancyMgr))) - opts = append(opts, grpc.WithStreamInterceptor(tenancy.NewClientStreamInterceptor(tenancyMgr))) - } - var err error - // TODO: Need to replace grpc.DialContext with grpc.NewClient and pass test - c.remoteConn, err = grpc.DialContext(ctx, c.RemoteServerAddr, opts...) - if err != nil { - return nil, fmt.Errorf("error connecting to remote storage: %w", err) - } - - grpcClient := shared.NewGRPCClient(c.remoteConn) - return &ClientPluginServices{ - PluginServices: shared.PluginServices{ - Store: grpcClient, - ArchiveStore: grpcClient, - StreamingSpanWriter: grpcClient, - }, - Capabilities: grpcClient, - }, nil -} - -func (c *Configuration) buildPlugin(logger *zap.Logger, tracerProvider trace.TracerProvider) (*ClientPluginServices, error) { - opts := []grpc.DialOption{ - grpc.WithStatsHandler(otelgrpc.NewClientHandler(otelgrpc.WithTracerProvider(tracerProvider))), - } - - tenancyMgr := tenancy.NewManager(&c.TenancyOpts) - if tenancyMgr.Enabled { - opts = append(opts, grpc.WithUnaryInterceptor(tenancy.NewClientUnaryInterceptor(tenancyMgr))) - opts = append(opts, grpc.WithStreamInterceptor(tenancy.NewClientStreamInterceptor(tenancyMgr))) - } - - // #nosec G204 - cmd := exec.Command(c.PluginBinary, "--config", c.PluginConfigurationFile) - client := plugin.NewClient(&plugin.ClientConfig{ - HandshakeConfig: shared.Handshake, - VersionedPlugins: map[int]plugin.PluginSet{ - 1: shared.PluginMap, - }, - Cmd: cmd, - AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC}, - Logger: hclog.New(&hclog.LoggerOptions{ - Level: hclog.LevelFromString(c.PluginLogLevel), - }), - GRPCDialOptions: opts, - }) - - rpcClient, err := client.Client() - if err != nil { - return nil, fmt.Errorf("error attempting to connect to plugin rpc client: %w", err) - } - - raw, err := rpcClient.Dispense(shared.StoragePluginIdentifier) - if err != nil { - return nil, fmt.Errorf("unable to retrieve storage plugin instance: %w", err) - } - - // in practice, the type of `raw` is *shared.grpcClient, and type casts below cannot fail - storagePlugin, ok := raw.(shared.StoragePlugin) - if !ok { - return nil, fmt.Errorf("unable to cast %T to shared.StoragePlugin for plugin \"%s\"", - raw, shared.StoragePluginIdentifier) - } - archiveStoragePlugin, ok := raw.(shared.ArchiveStoragePlugin) - if !ok { - return nil, fmt.Errorf("unable to cast %T to shared.ArchiveStoragePlugin for plugin \"%s\"", - raw, shared.StoragePluginIdentifier) - } - streamingSpanWriterPlugin, ok := raw.(shared.StreamingSpanWriterPlugin) - if !ok { - return nil, fmt.Errorf("unable to cast %T to shared.StreamingSpanWriterPlugin for plugin \"%s\"", - raw, shared.StoragePluginIdentifier) - } - capabilities, ok := raw.(shared.PluginCapabilities) - if !ok { - return nil, fmt.Errorf("unable to cast %T to shared.PluginCapabilities for plugin \"%s\"", - raw, shared.StoragePluginIdentifier) - } - - if err := c.startPluginHealthCheck(rpcClient, logger); err != nil { - return nil, fmt.Errorf("initial plugin health check failed: %w", err) - } - - return &ClientPluginServices{ - PluginServices: shared.PluginServices{ - Store: storagePlugin, - ArchiveStore: archiveStoragePlugin, - StreamingSpanWriter: streamingSpanWriterPlugin, - }, - Capabilities: capabilities, - killPluginClient: client.Kill, - }, nil -} - -func (c *Configuration) startPluginHealthCheck(rpcClient plugin.ClientProtocol, logger *zap.Logger) error { - c.pluginRPCClient = rpcClient - c.pluginHealthCheckDone = make(chan bool) - c.pluginHealthCheck = time.NewTicker(pluginHealthCheckInterval) - - go func() { - for { - select { - case <-c.pluginHealthCheckDone: - return - case <-c.pluginHealthCheck.C: - if err := c.pluginRPCClient.Ping(); err != nil { - logger.Fatal("plugin health check failed", zap.Error(err)) - } - } - } - }() - - return c.pluginRPCClient.Ping() -} diff --git a/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/factory.go b/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/factory.go deleted file mode 100644 index 0009ebcb6c8..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/factory.go +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) 2019 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package grpc - -import ( - "errors" - "flag" - "fmt" - "io" - - "github.com/spf13/viper" - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/trace" - "go.uber.org/zap" - - "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/plugin" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/config" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" - "github.com/jaegertracing/jaeger/storage" - "github.com/jaegertracing/jaeger/storage/dependencystore" - "github.com/jaegertracing/jaeger/storage/spanstore" -) - -var ( // interface comformance checks - _ storage.Factory = (*Factory)(nil) - _ storage.ArchiveFactory = (*Factory)(nil) - _ io.Closer = (*Factory)(nil) - _ plugin.Configurable = (*Factory)(nil) -) - -// Factory implements storage.Factory and creates storage components backed by a storage plugin. -type Factory struct { - options Options - metricsFactory metrics.Factory - logger *zap.Logger - tracerProvider trace.TracerProvider - - builder config.PluginBuilder - - store shared.StoragePlugin - archiveStore shared.ArchiveStoragePlugin - streamingSpanWriter shared.StreamingSpanWriterPlugin - capabilities shared.PluginCapabilities - - servicesCloser io.Closer -} - -// NewFactory creates a new Factory. -func NewFactory() *Factory { - return &Factory{} -} - -// NewFactoryWithConfig is used from jaeger(v2). -func NewFactoryWithConfig( - cfg config.Configuration, - metricsFactory metrics.Factory, - logger *zap.Logger, -) (*Factory, error) { - f := NewFactory() - f.InitFromOptions(Options{Configuration: cfg}) - err := f.Initialize(metricsFactory, logger) - if err != nil { - return nil, err - } - return f, nil -} - -// AddFlags implements plugin.Configurable -func (f *Factory) AddFlags(flagSet *flag.FlagSet) { - f.options.AddFlags(flagSet) -} - -// InitFromViper implements plugin.Configurable -func (f *Factory) InitFromViper(v *viper.Viper, logger *zap.Logger) { - if err := f.options.InitFromViper(v); err != nil { - logger.Fatal("unable to initialize gRPC storage factory", zap.Error(err)) - } - f.builder = &f.options.Configuration -} - -// InitFromOptions initializes factory from options -func (f *Factory) InitFromOptions(opts Options) { - f.options = opts - f.builder = &f.options.Configuration -} - -// Initialize implements storage.Factory -func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger) error { - f.metricsFactory, f.logger = metricsFactory, logger - f.tracerProvider = otel.GetTracerProvider() - - services, err := f.builder.Build(logger, f.tracerProvider) - if err != nil { - return fmt.Errorf("grpc-plugin builder failed to create a store: %w", err) - } - - f.store = services.Store - f.archiveStore = services.ArchiveStore - f.capabilities = services.Capabilities - f.streamingSpanWriter = services.StreamingSpanWriter - f.servicesCloser = services - logger.Info("External plugin storage configuration", zap.Any("configuration", f.options.Configuration)) - return nil -} - -// CreateSpanReader implements storage.Factory -func (f *Factory) CreateSpanReader() (spanstore.Reader, error) { - return f.store.SpanReader(), nil -} - -// CreateSpanWriter implements storage.Factory -func (f *Factory) CreateSpanWriter() (spanstore.Writer, error) { - if f.capabilities != nil && f.streamingSpanWriter != nil { - if capabilities, err := f.capabilities.Capabilities(); err == nil && capabilities.StreamingSpanWriter { - return f.streamingSpanWriter.StreamingSpanWriter(), nil - } - } - return f.store.SpanWriter(), nil -} - -// CreateDependencyReader implements storage.Factory -func (f *Factory) CreateDependencyReader() (dependencystore.Reader, error) { - return f.store.DependencyReader(), nil -} - -// CreateArchiveSpanReader implements storage.ArchiveFactory -func (f *Factory) CreateArchiveSpanReader() (spanstore.Reader, error) { - if f.capabilities == nil { - return nil, storage.ErrArchiveStorageNotSupported - } - capabilities, err := f.capabilities.Capabilities() - if err != nil { - return nil, err - } - if capabilities == nil || !capabilities.ArchiveSpanReader { - return nil, storage.ErrArchiveStorageNotSupported - } - return f.archiveStore.ArchiveSpanReader(), nil -} - -// CreateArchiveSpanWriter implements storage.ArchiveFactory -func (f *Factory) CreateArchiveSpanWriter() (spanstore.Writer, error) { - if f.capabilities == nil { - return nil, storage.ErrArchiveStorageNotSupported - } - capabilities, err := f.capabilities.Capabilities() - if err != nil { - return nil, err - } - if capabilities == nil || !capabilities.ArchiveSpanWriter { - return nil, storage.ErrArchiveStorageNotSupported - } - return f.archiveStore.ArchiveSpanWriter(), nil -} - -// Close closes the resources held by the factory -func (f *Factory) Close() error { - errs := []error{} - if f.servicesCloser != nil { - errs = append(errs, f.servicesCloser.Close()) - } - errs = append(errs, f.builder.Close()) - return errors.Join(errs...) -} diff --git a/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/grpc.go b/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/grpc.go deleted file mode 100644 index 09ffffcd399..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/grpc.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2019 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package grpc - -import ( - "github.com/hashicorp/go-plugin" - "google.golang.org/grpc" - - "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" -) - -// Serve creates a plugin configuration using the implementation of StoragePlugin and then serves it. -func Serve(services *shared.PluginServices) { - ServeWithGRPCServer(services, plugin.DefaultGRPCServer) -} - -// ServeWithGRPCServer creates a plugin configuration using the implementation of StoragePlugin and -// function to create grpcServer, and then serves it. -func ServeWithGRPCServer(services *shared.PluginServices, grpcServer func([]grpc.ServerOption) *grpc.Server, -) { - plugin.Serve(&plugin.ServeConfig{ - HandshakeConfig: shared.Handshake, - VersionedPlugins: map[int]plugin.PluginSet{ - 1: map[string]plugin.Plugin{ - shared.StoragePluginIdentifier: &shared.StorageGRPCPlugin{ - Impl: services.Store, - ArchiveImpl: services.ArchiveStore, - StreamImpl: services.StreamingSpanWriter, - }, - }, - }, - GRPCServer: grpcServer, - }) -} diff --git a/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/options.go b/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/options.go deleted file mode 100644 index b3b8d9210b2..00000000000 --- a/vendor/github.com/jaegertracing/jaeger/plugin/storage/grpc/options.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2019 The Jaeger Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package grpc - -import ( - "flag" - "fmt" - "log" - "time" - - "github.com/spf13/viper" - - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" - "github.com/jaegertracing/jaeger/pkg/tenancy" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/config" -) - -const ( - pluginBinary = "grpc-storage-plugin.binary" - pluginConfigurationFile = "grpc-storage-plugin.configuration-file" - pluginLogLevel = "grpc-storage-plugin.log-level" - remotePrefix = "grpc-storage" - remoteServer = remotePrefix + ".server" - remoteConnectionTimeout = remotePrefix + ".connection-timeout" - defaultPluginLogLevel = "warn" - defaultConnectionTimeout = time.Duration(5 * time.Second) - - deprecatedSidecar = "(deprecated, will be removed after 2024-03-01) " -) - -// Options contains GRPC plugins configs and provides the ability -// to bind them to command line flags -type Options struct { - Configuration config.Configuration `mapstructure:",squash"` -} - -func tlsFlagsConfig() tlscfg.ClientFlagsConfig { - return tlscfg.ClientFlagsConfig{ - Prefix: remotePrefix, - } -} - -// AddFlags adds flags for Options -func (opt *Options) AddFlags(flagSet *flag.FlagSet) { - tlsFlagsConfig().AddFlags(flagSet) - - flagSet.String(pluginBinary, "", deprecatedSidecar+"The location of the plugin binary") - flagSet.String(pluginConfigurationFile, "", deprecatedSidecar+"A path pointing to the plugin's configuration file, made available to the plugin with the --config arg") - flagSet.String(pluginLogLevel, defaultPluginLogLevel, "Set the log level of the plugin's logger") - flagSet.String(remoteServer, "", "The remote storage gRPC server address as host:port") - flagSet.Duration(remoteConnectionTimeout, defaultConnectionTimeout, "The remote storage gRPC server connection timeout") -} - -// InitFromViper initializes Options with properties from viper -func (opt *Options) InitFromViper(v *viper.Viper) error { - opt.Configuration.PluginBinary = v.GetString(pluginBinary) - opt.Configuration.PluginConfigurationFile = v.GetString(pluginConfigurationFile) - opt.Configuration.PluginLogLevel = v.GetString(pluginLogLevel) - opt.Configuration.RemoteServerAddr = v.GetString(remoteServer) - var err error - opt.Configuration.RemoteTLS, err = tlsFlagsConfig().InitFromViper(v) - if err != nil { - return fmt.Errorf("failed to parse gRPC storage TLS options: %w", err) - } - opt.Configuration.RemoteConnectTimeout = v.GetDuration(remoteConnectionTimeout) - opt.Configuration.TenancyOpts = tenancy.InitFromViper(v) - if opt.Configuration.PluginBinary != "" { - log.Printf(deprecatedSidecar + "using sidecar model of grpc-plugin storage, please upgrade to 'remote' gRPC storage. https://github.com/jaegertracing/jaeger/issues/4647") - } - return nil -} diff --git a/vendor/modules.txt b/vendor/modules.txt index daed90a44d1..e98b2ed645f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -654,11 +654,7 @@ github.com/jaegertracing/jaeger/pkg/healthcheck github.com/jaegertracing/jaeger/pkg/metrics github.com/jaegertracing/jaeger/pkg/netutils github.com/jaegertracing/jaeger/pkg/recoveryhandler -github.com/jaegertracing/jaeger/pkg/tenancy github.com/jaegertracing/jaeger/pkg/version -github.com/jaegertracing/jaeger/plugin -github.com/jaegertracing/jaeger/plugin/storage/grpc -github.com/jaegertracing/jaeger/plugin/storage/grpc/config github.com/jaegertracing/jaeger/plugin/storage/grpc/shared github.com/jaegertracing/jaeger/ports github.com/jaegertracing/jaeger/proto-gen/api_v2