From 2d320999470a7df7ea9d88a0cc5846c65d6b7484 Mon Sep 17 00:00:00 2001 From: Olivier Boucher Date: Sat, 24 Nov 2018 14:38:45 -0500 Subject: [PATCH 01/30] Add New Storage Plugin Framework Still a work in progress. Related to issue #422. Leverages Hashicorp's go-plugin. New set of protos for the use of plugin maintainers. Missing tests. Still need to create a plugin binary for the memory backend. Signed-off-by: Olivier Boucher Added Memory GRPC Plugin. Renamed packages (#422) Renamed packages from "external" to "grpc". Changed storage type to "grpc-plugin". Added cmd/memory-grpc-plugin that uses the memory backend as a grpc plugin. Added go-plugin dependency to Glide. Added task to generate plugin protos to Makefile. Signed-off-by: Olivier Boucher Refactored gRPC storage plugin protos Now makes use of protos from model/proto/model.proto and removed mapping functions. Plugin invoker calls the plugin binary directly instead of relying on sh. Signed-off-by: Olivier Boucher Refactored gRPC plugin protos to use defined models Removed mapping code. Removed used of sh, calling plugin binary directly. Signed-off-by: Olivier Boucher Removed .editorconfig file Signed-off-by: Olivier Boucher Added support for gRPC plugin configuration Configuration file is passed down to the plugin through the --config argument. It is the plugin's responsability to parse the file and initialize itself. Signed-off-by: Olivier Boucher Added benchmark for noop SpanWriter vs gRPC based noop plugin Fixed issues related to proto changes. Deleted memory-grpc-plugin since it was no longer relevant. Signed-off-by: Olivier Boucher Updated gRPC plugin & protos to implement latest SpanReader Added dependencies to Gopkg.lock since Glide -> dep transition happened recently. Signed-off-by: Olivier Boucher Fixed proto generation introduced when switching to Dep Changed json tags to match when TraceID was not a proto. Signed-off-by: Olivier Boucher proto fix Fixed issue introduced moving TraceID to model.proto Added proper annotations to storage.proto instead of exposing TraceID in model.proto. Tests are back to green. Signed-off-by: Olivier Boucher Added tests for gRPC storage factory and options Moved DependencyLink to model.proto since it had to be used and the existing struct did not implement any Marshaler/Unmarshaler methods. Changed storage configuration to allow testing via mocks. Added DependencyReader interface to the StoragePlugin interface. Signed-off-by: Olivier Boucher --- Gopkg.lock | 49 +- cmd/noop-grpc-plugin/load_test.go | 75 + cmd/noop-grpc-plugin/main.go | 92 + pkg/grpc/config/config.go | 69 + plugin/storage/factory.go | 6 +- plugin/storage/grpc/factory.go | 83 + plugin/storage/grpc/factory_test.go | 105 + plugin/storage/grpc/options.go | 39 + plugin/storage/grpc/options_test.go | 22 + plugin/storage/grpc/plugin.go | 58 + plugin/storage/grpc/proto/storage.pb.go | 5327 +++++++++++++++++++++++ plugin/storage/grpc/shared/grpc.go | 335 ++ plugin/storage/grpc/shared/interface.go | 64 + 13 files changed, 6322 insertions(+), 2 deletions(-) create mode 100644 cmd/noop-grpc-plugin/load_test.go create mode 100644 cmd/noop-grpc-plugin/main.go create mode 100644 pkg/grpc/config/config.go create mode 100644 plugin/storage/grpc/factory.go create mode 100644 plugin/storage/grpc/factory_test.go create mode 100644 plugin/storage/grpc/options.go create mode 100644 plugin/storage/grpc/options_test.go create mode 100644 plugin/storage/grpc/plugin.go create mode 100644 plugin/storage/grpc/proto/storage.pb.go create mode 100644 plugin/storage/grpc/shared/grpc.go create mode 100644 plugin/storage/grpc/shared/interface.go diff --git a/Gopkg.lock b/Gopkg.lock index b4a3dcbd663..0cf0d042527 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -443,6 +443,25 @@ pruneopts = "UT" revision = "e80d13ce29ede4452c43dea11e79b9bc8a15b478" +[[projects]] + digest = "1:f6ecb0dc7d965d75815729fd300cc0cd17004fb2d6172a7f37192494936942e5" + name = "github.com/hashicorp/go-hclog" + packages = ["."] + pruneopts = "UT" + revision = "6907afbebd2eef854f0be9194eb79b0ba75d7b29" + version = "v0.8.0" + +[[projects]] + digest = "1:5e1aece859ec4195f3d16dd3b64a0f111e186b9e95d75141465595063e3a5254" + name = "github.com/hashicorp/go-plugin" + packages = [ + ".", + "internal/plugin", + ] + pruneopts = "UT" + revision = "52e1c4730856c1438ced7597c9b5c585a7bd06a2" + version = "v1.0.0" + [[projects]] digest = "1:c0d19ab64b32ce9fe5cf4ddceba78d5bc9807f0016db6b1183599da3dcc24d10" name = "github.com/hashicorp/hcl" @@ -462,6 +481,14 @@ revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241" version = "v1.0.0" +[[projects]] + branch = "master" + digest = "1:a4826c308e84f5f161b90b54a814f0be7d112b80164b9b884698a6903ea47ab3" + name = "github.com/hashicorp/yamux" + packages = ["."] + pruneopts = "UT" + revision = "2f1d1f20f75d5404f53b9edf6b53ed5505508675" + [[projects]] digest = "1:870d441fe217b8e689d7949fef6e43efbc787e50f200cb1e70dbca9204a1d6be" name = "github.com/inconshreveable/mousetrap" @@ -515,6 +542,14 @@ revision = "c12348ce28de40eed0136aa2b644d0ee0650e56c" version = "v1.0.1" +[[projects]] + digest = "1:42eb1f52b84a06820cedc9baec2e710bfbda3ee6dac6cdb97f8b9a5066134ec6" + name = "github.com/mitchellh/go-testing-interface" + packages = ["."] + pruneopts = "UT" + revision = "6d0b8010fcc857872e42fc6c931227569016843c" + version = "v1.0.0" + [[projects]] digest = "1:53bc4cd4914cd7cd52139990d5170d6dc99067ae31c56530621b18b35fc30318" name = "github.com/mitchellh/mapstructure" @@ -545,6 +580,14 @@ pruneopts = "UT" revision = "138eaf8dc34d1c265aab931e3541149d667426ca" +[[projects]] + digest = "1:9ec6cf1df5ad1d55cf41a43b6b1e7e118a91bade4f68ff4303379343e40c0e25" + name = "github.com/oklog/run" + packages = ["."] + pruneopts = "UT" + revision = "4dadeb3030eda0273a12382bb2348ffc7c9d1a39" + version = "v1.0.0" + [[projects]] branch = "master" digest = "1:bccaead3121ab7964fd80fab704f612e5893fb5a2c581d520ec847ed8cfac27e" @@ -912,7 +955,7 @@ revision = "f467c93bbac2133ff463e1f93d18d8f9f3f04451" [[projects]] - digest = "1:0a1fea691bda5979304d27194e77e67737a321cab3f584107f1bddc5dc650e43" + digest = "1:901b6eff8ca26202049af4423616ccbfd22f8e59fa1ae9a95ca83f668666bffb" name = "google.golang.org/grpc" packages = [ ".", @@ -927,6 +970,8 @@ "encoding", "encoding/proto", "grpclog", + "health", + "health/grpc_health_v1", "internal", "internal/backoff", "internal/binarylog", @@ -1017,6 +1062,8 @@ "github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger/options", "github.com/grpc-ecosystem/grpc-gateway/runtime", "github.com/grpc-ecosystem/grpc-gateway/utilities", + "github.com/hashicorp/go-hclog", + "github.com/hashicorp/go-plugin", "github.com/kr/pretty", "github.com/opentracing-contrib/go-stdlib/nethttp", "github.com/opentracing/opentracing-go", diff --git a/cmd/noop-grpc-plugin/load_test.go b/cmd/noop-grpc-plugin/load_test.go new file mode 100644 index 00000000000..35a872c50e3 --- /dev/null +++ b/cmd/noop-grpc-plugin/load_test.go @@ -0,0 +1,75 @@ +package main + +import ( + "github.com/jaegertracing/jaeger/model" + "github.com/jaegertracing/jaeger/plugin/storage/grpc" + "github.com/spf13/viper" + "github.com/uber/jaeger-lib/metrics/prometheus" + "go.uber.org/zap" + "testing" + "time" +) + +var logger = zap.NewNop() + +func BenchmarkNoopSpanWriter(b *testing.B) { + s := &noopStore{} + + for n := 0; n < b.N; n++ { + s.WriteSpan(&model.Span{ + TraceID:model.NewTraceID(1, 2), + SpanID:model.NewSpanID(1), + OperationName: "test", + StartTime: time.Now(), + Duration: 1 * time.Second, + Process: model.NewProcess("process", []model.KeyValue{ + + }), + ProcessID: "process_id", + Tags: []model.KeyValue{ + { + Key:"test", + VStr: "", + }, + }, + }) + } +} + +func BenchmarkGRPCNoopSpanWriter(b *testing.B) { + v := viper.New() + + v.Set("grpc-storage-plugin.binary", "noop-grpc-plugin") + + f := grpc.NewFactory() + f.InitFromViper(v) + + metricsFactory := prometheus.New() + + f.Initialize( metricsFactory, logger) + + sw, err := f.CreateSpanWriter() + if err != nil { + b.Fatal(err) + } + + for n := 0; n < b.N; n++ { + sw.WriteSpan(&model.Span{ + TraceID:model.NewTraceID(1, 2), + SpanID:model.NewSpanID(1), + OperationName: "test", + StartTime: time.Now(), + Duration: 1 * time.Second, + Process: model.NewProcess("process", []model.KeyValue{ + + }), + ProcessID: "process_id", + Tags: []model.KeyValue{ + { + Key:"test", + VStr: "", + }, + }, + }) + } +} diff --git a/cmd/noop-grpc-plugin/main.go b/cmd/noop-grpc-plugin/main.go new file mode 100644 index 00000000000..ffa82e4b98b --- /dev/null +++ b/cmd/noop-grpc-plugin/main.go @@ -0,0 +1,92 @@ +// Copyright (c) 2018 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 main + +import ( + "context" + "flag" + "github.com/hashicorp/go-plugin" + "github.com/jaegertracing/jaeger/model" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" + "github.com/jaegertracing/jaeger/plugin/storage/memory" + "github.com/jaegertracing/jaeger/storage/spanstore" + "github.com/spf13/viper" + "path" + "strings" + "time" +) + +var configPath string + +func main() { + flag.StringVar(&configPath, "config", "", "A path to the plugin's configuration file") + flag.Parse() + + if configPath != "" { + viper.SetConfigFile(path.Base(configPath)) + viper.AddConfigPath(path.Dir(configPath)) + } + + v := viper.New() + v.AutomaticEnv() + v.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_")) + + opts := memory.Options{} + opts.InitFromViper(v) + + plugin.Serve(&plugin.ServeConfig{ + HandshakeConfig: shared.Handshake, + VersionedPlugins: map[int]plugin.PluginSet{ + 1: map[string]plugin.Plugin{ + shared.StoragePluginIdentifier: &shared.StorageGRPCPlugin{ + Impl: &noopStore{}, + }, + }, + }, + GRPCServer: plugin.DefaultGRPCServer, + }) +} + +type noopStore struct { + +} + +func (*noopStore) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { + return nil, nil +} + +func (*noopStore) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { + return nil, nil +} + +func (*noopStore) GetServices(ctx context.Context) ([]string, error) { + return nil, nil +} + +func (*noopStore) GetOperations(ctx context.Context, service string) ([]string, error) { + return nil, nil +} + +func (*noopStore) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { + return nil,nil +} + +func (*noopStore) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { + return nil, nil +} + +func (*noopStore) WriteSpan(span *model.Span) error { + return nil +} diff --git a/pkg/grpc/config/config.go b/pkg/grpc/config/config.go new file mode 100644 index 00000000000..b265ea1e6b8 --- /dev/null +++ b/pkg/grpc/config/config.go @@ -0,0 +1,69 @@ +// Copyright (c) 2018 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 ( + "fmt" + "github.com/hashicorp/go-hclog" + "github.com/hashicorp/go-plugin" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" + "os/exec" + "runtime" +) + +// Configuration describes the options to customize the storage behavior +type Configuration struct { + PluginBinary string `yaml:"binary"` + PluginConfigurationFile string `yaml:"configuration-file"` +} + +func (c *Configuration) Build() (shared.StoragePlugin, error) { + client := plugin.NewClient(&plugin.ClientConfig{ + HandshakeConfig: shared.Handshake, + VersionedPlugins: map[int]plugin.PluginSet{ + 1: shared.PluginMap, + }, + Cmd: exec.Command(c.PluginBinary, "--config", c.PluginConfigurationFile), + AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC}, + Logger: hclog.New(&hclog.LoggerOptions{ + Level: hclog.Warn, + }), + }) + + runtime.SetFinalizer(client, func(c *plugin.Client) { + c.Kill() + }) + + rpcClient, err := client.Client() + if err != nil { + return nil, fmt.Errorf("error attempting to connect to plugin rpc client: %s", err) + } + + raw, err := rpcClient.Dispense(shared.StoragePluginIdentifier) + if err != nil { + return nil, fmt.Errorf("unable to retrieve storage plugin instance: %s", err) + } + + storagePlugin, ok := raw.(shared.StoragePlugin) + if !ok { + return nil, fmt.Errorf("unexpected type for plugin \"%s\"", shared.StoragePluginIdentifier) + } + + return storagePlugin, nil +} + +type PluginBuilder interface { + Build() (shared.StoragePlugin, error) +} \ No newline at end of file diff --git a/plugin/storage/factory.go b/plugin/storage/factory.go index b98d1d9a475..788e5c7d382 100644 --- a/plugin/storage/factory.go +++ b/plugin/storage/factory.go @@ -26,6 +26,7 @@ import ( "github.com/jaegertracing/jaeger/plugin/storage/badger" "github.com/jaegertracing/jaeger/plugin/storage/cassandra" "github.com/jaegertracing/jaeger/plugin/storage/es" + "github.com/jaegertracing/jaeger/plugin/storage/grpc" "github.com/jaegertracing/jaeger/plugin/storage/kafka" "github.com/jaegertracing/jaeger/plugin/storage/memory" "github.com/jaegertracing/jaeger/storage" @@ -38,6 +39,7 @@ const ( elasticsearchStorageType = "elasticsearch" memoryStorageType = "memory" kafkaStorageType = "kafka" + grpcPluginStorageType = "grpc-plugin" badgerStorageType = "badger" downsamplingRatio = "downsampling.ratio" downsamplingHashSalt = "downsampling.hashsalt" @@ -48,7 +50,7 @@ const ( defaultDownsamplingHashSalt = "" ) -var allStorageTypes = []string{cassandraStorageType, elasticsearchStorageType, memoryStorageType, kafkaStorageType, badgerStorageType} +var allStorageTypes = []string{cassandraStorageType, elasticsearchStorageType, memoryStorageType, kafkaStorageType, badgerStorageType, grpcPluginStorageType} // Factory implements storage.Factory interface as a meta-factory for storage components. type Factory struct { @@ -90,6 +92,8 @@ func (f *Factory) getFactoryOfType(factoryType string) (storage.Factory, error) return kafka.NewFactory(), nil case badgerStorageType: return badger.NewFactory(), nil + case grpcPluginStorageType: + return grpc.NewFactory(), nil default: return nil, fmt.Errorf("Unknown storage type %s. Valid types are %v", factoryType, allStorageTypes) } diff --git a/plugin/storage/grpc/factory.go b/plugin/storage/grpc/factory.go new file mode 100644 index 00000000000..29a928f4e56 --- /dev/null +++ b/plugin/storage/grpc/factory.go @@ -0,0 +1,83 @@ +// Copyright (c) 2018 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" + "github.com/jaegertracing/jaeger/pkg/grpc/config" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" + "github.com/jaegertracing/jaeger/storage/dependencystore" + + "github.com/spf13/viper" + "github.com/uber/jaeger-lib/metrics" + "go.uber.org/zap" + + "github.com/jaegertracing/jaeger/storage/spanstore" +) + +type Factory struct { + options Options + metricsFactory metrics.Factory + logger *zap.Logger + + builder config.PluginBuilder + + store shared.StoragePlugin +} + +// NewFactory creates a new Factory. +func NewFactory() *Factory { + return &Factory{} +} + +// 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) { + f.options.InitFromViper(v) + 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 + + store, err := f.builder.Build() + if err != nil { + return err + } + + f.store = store + 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, nil +} + +// CreateSpanWriter implements storage.Factory +func (f *Factory) CreateSpanWriter() (spanstore.Writer, error) { + return f.store, nil +} + +// CreateDependencyReader implements storage.Factory +func (f *Factory) CreateDependencyReader() (dependencystore.Reader, error) { + return f.store, nil +} diff --git a/plugin/storage/grpc/factory_test.go b/plugin/storage/grpc/factory_test.go new file mode 100644 index 00000000000..613fab54b01 --- /dev/null +++ b/plugin/storage/grpc/factory_test.go @@ -0,0 +1,105 @@ +package grpc + +import ( + "context" + "errors" + "github.com/jaegertracing/jaeger/model" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" + "github.com/jaegertracing/jaeger/storage/spanstore" + "github.com/spf13/viper" + "github.com/uber/jaeger-lib/metrics" + "go.uber.org/zap" + "testing" + "time" + + "github.com/jaegertracing/jaeger/pkg/config" + "github.com/jaegertracing/jaeger/storage" + "github.com/stretchr/testify/assert" +) + +var _ storage.Factory = new(Factory) + +type mockPluginBuilder struct { + plugin *mockPlugin + err error +} + +func (b *mockPluginBuilder) Build() (shared.StoragePlugin, error) { + if b.err != nil { + return nil, b.err + } + return b.plugin, nil +} + +type mockPlugin struct { + +} + +func (*mockPlugin) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { + panic("implement me") +} + +func (*mockPlugin) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { + panic("implement me") +} + +func (*mockPlugin) GetServices(ctx context.Context) ([]string, error) { + panic("implement me") +} + +func (*mockPlugin) GetOperations(ctx context.Context, service string) ([]string, error) { + panic("implement me") +} + +func (*mockPlugin) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { + panic("implement me") +} + +func (*mockPlugin) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { + panic("implement me") +} + +func (*mockPlugin) WriteSpan(span *model.Span) error { + panic("implement me") +} + +func TestGRPCStorageFactory(t *testing.T) { + f := NewFactory() + v := viper.New() + f.InitFromViper(v) + + // after InitFromViper, f.builder points to a real plugin builder that will fail in unit tests, + // so we override it with a mock. + f.builder = &mockPluginBuilder{ + err: errors.New("made-up error"), + } + assert.EqualError(t, f.Initialize(metrics.NullFactory, zap.NewNop()), "made-up error") + + f.builder = &mockPluginBuilder{ + plugin: &mockPlugin{}, + } + assert.NoError(t, f.Initialize(metrics.NullFactory, zap.NewNop())) + + assert.NotNil(t, f.store) + reader, err := f.CreateSpanReader() + assert.NoError(t, err) + assert.Equal(t, f.store, reader) + writer, err := f.CreateSpanWriter() + assert.NoError(t, err) + assert.Equal(t, f.store, writer) + depReader, err := f.CreateDependencyReader() + assert.NoError(t, err) + assert.Equal(t, f.store, depReader) +} + +func TestWithConfiguration(t *testing.T) { + f := NewFactory() + v, command := config.Viperize(f.AddFlags) + command.ParseFlags([]string{ + "--grpc-storage-plugin.binary=noop-grpc-plugin", + "--grpc-storage-plugin.configuration-file=config.json", + }) + f.InitFromViper(v) + assert.Equal(t, f.options.Configuration.PluginBinary, "noop-grpc-plugin") + assert.Equal(t, f.options.Configuration.PluginConfigurationFile, "config.json") +} diff --git a/plugin/storage/grpc/options.go b/plugin/storage/grpc/options.go new file mode 100644 index 00000000000..94917671c45 --- /dev/null +++ b/plugin/storage/grpc/options.go @@ -0,0 +1,39 @@ +// Copyright (c) 2018 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" + "github.com/spf13/viper" + + "github.com/jaegertracing/jaeger/pkg/grpc/config" +) + +const pluginBinary = "grpc-storage-plugin.binary" +const pluginConfigurationFile = "grpc-storage-plugin.configuration-file" + +type Options struct { + Configuration config.Configuration +} + +func (opt *Options) AddFlags(flagSet *flag.FlagSet) { + flagSet.String(pluginBinary, "", "The location of the plugin binary") + flagSet.String(pluginConfigurationFile, "", "A path pointing to the plugin's configuration file, made available to the plugin with the --config arg") +} + +func (opt *Options) InitFromViper(v *viper.Viper) { + opt.Configuration.PluginBinary = v.GetString(pluginBinary) + opt.Configuration.PluginConfigurationFile = v.GetString(pluginConfigurationFile) +} diff --git a/plugin/storage/grpc/options_test.go b/plugin/storage/grpc/options_test.go new file mode 100644 index 00000000000..225849d6891 --- /dev/null +++ b/plugin/storage/grpc/options_test.go @@ -0,0 +1,22 @@ +package grpc + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/jaegertracing/jaeger/pkg/config" +) + +func TestOptionsWithFlags(t *testing.T) { + opts := &Options{} + v, command := config.Viperize(opts.AddFlags) + command.ParseFlags([]string{ + "--grpc-storage-plugin.binary=noop-grpc-plugin", + "--grpc-storage-plugin.configuration-file=config.json", + }) + opts.InitFromViper(v) + + assert.Equal(t, opts.Configuration.PluginBinary, "noop-grpc-plugin") + assert.Equal(t, opts.Configuration.PluginConfigurationFile, "config.json") +} diff --git a/plugin/storage/grpc/plugin.go b/plugin/storage/grpc/plugin.go new file mode 100644 index 00000000000..34da046953b --- /dev/null +++ b/plugin/storage/grpc/plugin.go @@ -0,0 +1,58 @@ +// Copyright (c) 2018 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 ( + "context" + "github.com/jaegertracing/jaeger/model" + "github.com/jaegertracing/jaeger/pkg/grpc/config" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" + "github.com/jaegertracing/jaeger/storage/spanstore" + "time" +) + +type Store struct { + config config.Configuration + + plugin shared.StoragePlugin +} + +func (s *Store) WriteSpan(span *model.Span) error { + return s.plugin.WriteSpan(span) +} + +func (s *Store) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { + return s.plugin.GetTrace(ctx, traceID) +} + +func (s *Store) GetServices(ctx context.Context) ([]string, error) { + return s.plugin.GetServices(ctx) +} + +func (s *Store) GetOperations(ctx context.Context, service string) ([]string, error) { + return s.plugin.GetOperations(ctx, service) +} + +func (s *Store) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { + return s.plugin.FindTraces(ctx, query) +} + +func (s *Store) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { + return s.plugin.FindTraceIDs(ctx, query) +} + +func (s *Store) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { + return s.plugin.GetDependencies(endTs, lookback) +} diff --git a/plugin/storage/grpc/proto/storage.pb.go b/plugin/storage/grpc/proto/storage.pb.go new file mode 100644 index 00000000000..480cb5669ce --- /dev/null +++ b/plugin/storage/grpc/proto/storage.pb.go @@ -0,0 +1,5327 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: storage.proto + +/* + Package proto is a generated protocol buffer package. + + It is generated from these files: + storage.proto + + It has these top-level messages: + GetDependenciesRequest + GetDependenciesSuccess + GetDependenciesResponse + WriteSpanRequest + WriteSpanResponse + GetTraceRequest + GetTraceSuccess + GetTraceResponse + GetServicesRequest + GetServicesSuccess + GetServicesResponse + GetOperationsRequest + GetOperationsSuccess + GetOperationsResponse + TraceQueryParameters + FindTracesRequest + FindTracesSuccess + FindTracesResponse + FindTraceIDsRequest + FindTraceIDsSuccess + FindTraceIDsResponse + EmptyResponse + StoragePluginError +*/ +package proto + +import proto1 "github.com/gogo/protobuf/proto" +import golang_proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import _ "github.com/gogo/protobuf/gogoproto" +import jaeger_api_v2 "github.com/jaegertracing/jaeger/model" +import _ "github.com/gogo/protobuf/types" +import _ "github.com/gogo/protobuf/types" + +import time "time" +import github_com_jaegertracing_jaeger_model "github.com/jaegertracing/jaeger/model" + +import context "golang.org/x/net/context" +import grpc "google.golang.org/grpc" + +import types "github.com/gogo/protobuf/types" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto1.Marshal +var _ = golang_proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto1.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type GetDependenciesRequest struct { + EndTimestamp time.Time `protobuf:"bytes,1,opt,name=end_timestamp,json=endTimestamp,stdtime" json:"end_timestamp"` + Lookback time.Duration `protobuf:"bytes,2,opt,name=lookback,stdduration" json:"lookback"` +} + +func (m *GetDependenciesRequest) Reset() { *m = GetDependenciesRequest{} } +func (m *GetDependenciesRequest) String() string { return proto1.CompactTextString(m) } +func (*GetDependenciesRequest) ProtoMessage() {} +func (*GetDependenciesRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{0} } + +func (m *GetDependenciesRequest) GetEndTimestamp() time.Time { + if m != nil { + return m.EndTimestamp + } + return time.Time{} +} + +func (m *GetDependenciesRequest) GetLookback() time.Duration { + if m != nil { + return m.Lookback + } + return 0 +} + +type GetDependenciesSuccess struct { + Dependencies []github_com_jaegertracing_jaeger_model.DependencyLink `protobuf:"bytes,1,rep,name=dependencies,customtype=github.com/jaegertracing/jaeger/model.DependencyLink" json:"dependencies"` +} + +func (m *GetDependenciesSuccess) Reset() { *m = GetDependenciesSuccess{} } +func (m *GetDependenciesSuccess) String() string { return proto1.CompactTextString(m) } +func (*GetDependenciesSuccess) ProtoMessage() {} +func (*GetDependenciesSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{1} } + +type GetDependenciesResponse struct { + // Types that are valid to be assigned to Response: + // *GetDependenciesResponse_Success + // *GetDependenciesResponse_Error + Response isGetDependenciesResponse_Response `protobuf_oneof:"response"` +} + +func (m *GetDependenciesResponse) Reset() { *m = GetDependenciesResponse{} } +func (m *GetDependenciesResponse) String() string { return proto1.CompactTextString(m) } +func (*GetDependenciesResponse) ProtoMessage() {} +func (*GetDependenciesResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{2} } + +type isGetDependenciesResponse_Response interface { + isGetDependenciesResponse_Response() + MarshalTo([]byte) (int, error) + Size() int +} + +type GetDependenciesResponse_Success struct { + Success *GetDependenciesSuccess `protobuf:"bytes,1,opt,name=success,oneof"` +} +type GetDependenciesResponse_Error struct { + Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` +} + +func (*GetDependenciesResponse_Success) isGetDependenciesResponse_Response() {} +func (*GetDependenciesResponse_Error) isGetDependenciesResponse_Response() {} + +func (m *GetDependenciesResponse) GetResponse() isGetDependenciesResponse_Response { + if m != nil { + return m.Response + } + return nil +} + +func (m *GetDependenciesResponse) GetSuccess() *GetDependenciesSuccess { + if x, ok := m.GetResponse().(*GetDependenciesResponse_Success); ok { + return x.Success + } + return nil +} + +func (m *GetDependenciesResponse) GetError() *StoragePluginError { + if x, ok := m.GetResponse().(*GetDependenciesResponse_Error); ok { + return x.Error + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*GetDependenciesResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { + return _GetDependenciesResponse_OneofMarshaler, _GetDependenciesResponse_OneofUnmarshaler, _GetDependenciesResponse_OneofSizer, []interface{}{ + (*GetDependenciesResponse_Success)(nil), + (*GetDependenciesResponse_Error)(nil), + } +} + +func _GetDependenciesResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { + m := msg.(*GetDependenciesResponse) + // response + switch x := m.Response.(type) { + case *GetDependenciesResponse_Success: + _ = b.EncodeVarint(1<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Success); err != nil { + return err + } + case *GetDependenciesResponse_Error: + _ = b.EncodeVarint(2<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Error); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("GetDependenciesResponse.Response has unexpected type %T", x) + } + return nil +} + +func _GetDependenciesResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { + m := msg.(*GetDependenciesResponse) + switch tag { + case 1: // response.success + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(GetDependenciesSuccess) + err := b.DecodeMessage(msg) + m.Response = &GetDependenciesResponse_Success{msg} + return true, err + case 2: // response.error + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(StoragePluginError) + err := b.DecodeMessage(msg) + m.Response = &GetDependenciesResponse_Error{msg} + return true, err + default: + return false, nil + } +} + +func _GetDependenciesResponse_OneofSizer(msg proto1.Message) (n int) { + m := msg.(*GetDependenciesResponse) + // response + switch x := m.Response.(type) { + case *GetDependenciesResponse_Success: + s := proto1.Size(x.Success) + n += proto1.SizeVarint(1<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case *GetDependenciesResponse_Error: + s := proto1.Size(x.Error) + n += proto1.SizeVarint(2<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type WriteSpanRequest struct { + Span *jaeger_api_v2.Span `protobuf:"bytes,1,opt,name=span" json:"span,omitempty"` +} + +func (m *WriteSpanRequest) Reset() { *m = WriteSpanRequest{} } +func (m *WriteSpanRequest) String() string { return proto1.CompactTextString(m) } +func (*WriteSpanRequest) ProtoMessage() {} +func (*WriteSpanRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{3} } + +func (m *WriteSpanRequest) GetSpan() *jaeger_api_v2.Span { + if m != nil { + return m.Span + } + return nil +} + +type WriteSpanResponse struct { + // Types that are valid to be assigned to Response: + // *WriteSpanResponse_Success + // *WriteSpanResponse_Error + Response isWriteSpanResponse_Response `protobuf_oneof:"response"` +} + +func (m *WriteSpanResponse) Reset() { *m = WriteSpanResponse{} } +func (m *WriteSpanResponse) String() string { return proto1.CompactTextString(m) } +func (*WriteSpanResponse) ProtoMessage() {} +func (*WriteSpanResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{4} } + +type isWriteSpanResponse_Response interface { + isWriteSpanResponse_Response() + MarshalTo([]byte) (int, error) + Size() int +} + +type WriteSpanResponse_Success struct { + Success *EmptyResponse `protobuf:"bytes,1,opt,name=success,oneof"` +} +type WriteSpanResponse_Error struct { + Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` +} + +func (*WriteSpanResponse_Success) isWriteSpanResponse_Response() {} +func (*WriteSpanResponse_Error) isWriteSpanResponse_Response() {} + +func (m *WriteSpanResponse) GetResponse() isWriteSpanResponse_Response { + if m != nil { + return m.Response + } + return nil +} + +func (m *WriteSpanResponse) GetSuccess() *EmptyResponse { + if x, ok := m.GetResponse().(*WriteSpanResponse_Success); ok { + return x.Success + } + return nil +} + +func (m *WriteSpanResponse) GetError() *StoragePluginError { + if x, ok := m.GetResponse().(*WriteSpanResponse_Error); ok { + return x.Error + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*WriteSpanResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { + return _WriteSpanResponse_OneofMarshaler, _WriteSpanResponse_OneofUnmarshaler, _WriteSpanResponse_OneofSizer, []interface{}{ + (*WriteSpanResponse_Success)(nil), + (*WriteSpanResponse_Error)(nil), + } +} + +func _WriteSpanResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { + m := msg.(*WriteSpanResponse) + // response + switch x := m.Response.(type) { + case *WriteSpanResponse_Success: + _ = b.EncodeVarint(1<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Success); err != nil { + return err + } + case *WriteSpanResponse_Error: + _ = b.EncodeVarint(2<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Error); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("WriteSpanResponse.Response has unexpected type %T", x) + } + return nil +} + +func _WriteSpanResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { + m := msg.(*WriteSpanResponse) + switch tag { + case 1: // response.success + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(EmptyResponse) + err := b.DecodeMessage(msg) + m.Response = &WriteSpanResponse_Success{msg} + return true, err + case 2: // response.error + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(StoragePluginError) + err := b.DecodeMessage(msg) + m.Response = &WriteSpanResponse_Error{msg} + return true, err + default: + return false, nil + } +} + +func _WriteSpanResponse_OneofSizer(msg proto1.Message) (n int) { + m := msg.(*WriteSpanResponse) + // response + switch x := m.Response.(type) { + case *WriteSpanResponse_Success: + s := proto1.Size(x.Success) + n += proto1.SizeVarint(1<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case *WriteSpanResponse_Error: + s := proto1.Size(x.Error) + n += proto1.SizeVarint(2<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type GetTraceRequest struct { + TraceID github_com_jaegertracing_jaeger_model.TraceID `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3,customtype=github.com/jaegertracing/jaeger/model.TraceID" json:"trace_id"` +} + +func (m *GetTraceRequest) Reset() { *m = GetTraceRequest{} } +func (m *GetTraceRequest) String() string { return proto1.CompactTextString(m) } +func (*GetTraceRequest) ProtoMessage() {} +func (*GetTraceRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{5} } + +type GetTraceSuccess struct { + Trace *jaeger_api_v2.Trace `protobuf:"bytes,1,opt,name=trace" json:"trace,omitempty"` +} + +func (m *GetTraceSuccess) Reset() { *m = GetTraceSuccess{} } +func (m *GetTraceSuccess) String() string { return proto1.CompactTextString(m) } +func (*GetTraceSuccess) ProtoMessage() {} +func (*GetTraceSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{6} } + +func (m *GetTraceSuccess) GetTrace() *jaeger_api_v2.Trace { + if m != nil { + return m.Trace + } + return nil +} + +type GetTraceResponse struct { + // Types that are valid to be assigned to Response: + // *GetTraceResponse_Success + // *GetTraceResponse_Error + Response isGetTraceResponse_Response `protobuf_oneof:"response"` +} + +func (m *GetTraceResponse) Reset() { *m = GetTraceResponse{} } +func (m *GetTraceResponse) String() string { return proto1.CompactTextString(m) } +func (*GetTraceResponse) ProtoMessage() {} +func (*GetTraceResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{7} } + +type isGetTraceResponse_Response interface { + isGetTraceResponse_Response() + MarshalTo([]byte) (int, error) + Size() int +} + +type GetTraceResponse_Success struct { + Success *GetTraceSuccess `protobuf:"bytes,1,opt,name=success,oneof"` +} +type GetTraceResponse_Error struct { + Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` +} + +func (*GetTraceResponse_Success) isGetTraceResponse_Response() {} +func (*GetTraceResponse_Error) isGetTraceResponse_Response() {} + +func (m *GetTraceResponse) GetResponse() isGetTraceResponse_Response { + if m != nil { + return m.Response + } + return nil +} + +func (m *GetTraceResponse) GetSuccess() *GetTraceSuccess { + if x, ok := m.GetResponse().(*GetTraceResponse_Success); ok { + return x.Success + } + return nil +} + +func (m *GetTraceResponse) GetError() *StoragePluginError { + if x, ok := m.GetResponse().(*GetTraceResponse_Error); ok { + return x.Error + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*GetTraceResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { + return _GetTraceResponse_OneofMarshaler, _GetTraceResponse_OneofUnmarshaler, _GetTraceResponse_OneofSizer, []interface{}{ + (*GetTraceResponse_Success)(nil), + (*GetTraceResponse_Error)(nil), + } +} + +func _GetTraceResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { + m := msg.(*GetTraceResponse) + // response + switch x := m.Response.(type) { + case *GetTraceResponse_Success: + _ = b.EncodeVarint(1<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Success); err != nil { + return err + } + case *GetTraceResponse_Error: + _ = b.EncodeVarint(2<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Error); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("GetTraceResponse.Response has unexpected type %T", x) + } + return nil +} + +func _GetTraceResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { + m := msg.(*GetTraceResponse) + switch tag { + case 1: // response.success + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(GetTraceSuccess) + err := b.DecodeMessage(msg) + m.Response = &GetTraceResponse_Success{msg} + return true, err + case 2: // response.error + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(StoragePluginError) + err := b.DecodeMessage(msg) + m.Response = &GetTraceResponse_Error{msg} + return true, err + default: + return false, nil + } +} + +func _GetTraceResponse_OneofSizer(msg proto1.Message) (n int) { + m := msg.(*GetTraceResponse) + // response + switch x := m.Response.(type) { + case *GetTraceResponse_Success: + s := proto1.Size(x.Success) + n += proto1.SizeVarint(1<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case *GetTraceResponse_Error: + s := proto1.Size(x.Error) + n += proto1.SizeVarint(2<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type GetServicesRequest struct { +} + +func (m *GetServicesRequest) Reset() { *m = GetServicesRequest{} } +func (m *GetServicesRequest) String() string { return proto1.CompactTextString(m) } +func (*GetServicesRequest) ProtoMessage() {} +func (*GetServicesRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{8} } + +type GetServicesSuccess struct { + Services []string `protobuf:"bytes,1,rep,name=services" json:"services,omitempty"` +} + +func (m *GetServicesSuccess) Reset() { *m = GetServicesSuccess{} } +func (m *GetServicesSuccess) String() string { return proto1.CompactTextString(m) } +func (*GetServicesSuccess) ProtoMessage() {} +func (*GetServicesSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{9} } + +func (m *GetServicesSuccess) GetServices() []string { + if m != nil { + return m.Services + } + return nil +} + +type GetServicesResponse struct { + // Types that are valid to be assigned to Response: + // *GetServicesResponse_Success + // *GetServicesResponse_Error + Response isGetServicesResponse_Response `protobuf_oneof:"response"` +} + +func (m *GetServicesResponse) Reset() { *m = GetServicesResponse{} } +func (m *GetServicesResponse) String() string { return proto1.CompactTextString(m) } +func (*GetServicesResponse) ProtoMessage() {} +func (*GetServicesResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{10} } + +type isGetServicesResponse_Response interface { + isGetServicesResponse_Response() + MarshalTo([]byte) (int, error) + Size() int +} + +type GetServicesResponse_Success struct { + Success *GetServicesSuccess `protobuf:"bytes,1,opt,name=success,oneof"` +} +type GetServicesResponse_Error struct { + Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` +} + +func (*GetServicesResponse_Success) isGetServicesResponse_Response() {} +func (*GetServicesResponse_Error) isGetServicesResponse_Response() {} + +func (m *GetServicesResponse) GetResponse() isGetServicesResponse_Response { + if m != nil { + return m.Response + } + return nil +} + +func (m *GetServicesResponse) GetSuccess() *GetServicesSuccess { + if x, ok := m.GetResponse().(*GetServicesResponse_Success); ok { + return x.Success + } + return nil +} + +func (m *GetServicesResponse) GetError() *StoragePluginError { + if x, ok := m.GetResponse().(*GetServicesResponse_Error); ok { + return x.Error + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*GetServicesResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { + return _GetServicesResponse_OneofMarshaler, _GetServicesResponse_OneofUnmarshaler, _GetServicesResponse_OneofSizer, []interface{}{ + (*GetServicesResponse_Success)(nil), + (*GetServicesResponse_Error)(nil), + } +} + +func _GetServicesResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { + m := msg.(*GetServicesResponse) + // response + switch x := m.Response.(type) { + case *GetServicesResponse_Success: + _ = b.EncodeVarint(1<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Success); err != nil { + return err + } + case *GetServicesResponse_Error: + _ = b.EncodeVarint(2<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Error); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("GetServicesResponse.Response has unexpected type %T", x) + } + return nil +} + +func _GetServicesResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { + m := msg.(*GetServicesResponse) + switch tag { + case 1: // response.success + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(GetServicesSuccess) + err := b.DecodeMessage(msg) + m.Response = &GetServicesResponse_Success{msg} + return true, err + case 2: // response.error + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(StoragePluginError) + err := b.DecodeMessage(msg) + m.Response = &GetServicesResponse_Error{msg} + return true, err + default: + return false, nil + } +} + +func _GetServicesResponse_OneofSizer(msg proto1.Message) (n int) { + m := msg.(*GetServicesResponse) + // response + switch x := m.Response.(type) { + case *GetServicesResponse_Success: + s := proto1.Size(x.Success) + n += proto1.SizeVarint(1<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case *GetServicesResponse_Error: + s := proto1.Size(x.Error) + n += proto1.SizeVarint(2<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type GetOperationsRequest struct { + Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` +} + +func (m *GetOperationsRequest) Reset() { *m = GetOperationsRequest{} } +func (m *GetOperationsRequest) String() string { return proto1.CompactTextString(m) } +func (*GetOperationsRequest) ProtoMessage() {} +func (*GetOperationsRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{11} } + +func (m *GetOperationsRequest) GetService() string { + if m != nil { + return m.Service + } + return "" +} + +type GetOperationsSuccess struct { + Operations []string `protobuf:"bytes,1,rep,name=operations" json:"operations,omitempty"` +} + +func (m *GetOperationsSuccess) Reset() { *m = GetOperationsSuccess{} } +func (m *GetOperationsSuccess) String() string { return proto1.CompactTextString(m) } +func (*GetOperationsSuccess) ProtoMessage() {} +func (*GetOperationsSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{12} } + +func (m *GetOperationsSuccess) GetOperations() []string { + if m != nil { + return m.Operations + } + return nil +} + +type GetOperationsResponse struct { + // Types that are valid to be assigned to Response: + // *GetOperationsResponse_Success + // *GetOperationsResponse_Error + Response isGetOperationsResponse_Response `protobuf_oneof:"response"` +} + +func (m *GetOperationsResponse) Reset() { *m = GetOperationsResponse{} } +func (m *GetOperationsResponse) String() string { return proto1.CompactTextString(m) } +func (*GetOperationsResponse) ProtoMessage() {} +func (*GetOperationsResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{13} } + +type isGetOperationsResponse_Response interface { + isGetOperationsResponse_Response() + MarshalTo([]byte) (int, error) + Size() int +} + +type GetOperationsResponse_Success struct { + Success *GetOperationsSuccess `protobuf:"bytes,1,opt,name=success,oneof"` +} +type GetOperationsResponse_Error struct { + Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` +} + +func (*GetOperationsResponse_Success) isGetOperationsResponse_Response() {} +func (*GetOperationsResponse_Error) isGetOperationsResponse_Response() {} + +func (m *GetOperationsResponse) GetResponse() isGetOperationsResponse_Response { + if m != nil { + return m.Response + } + return nil +} + +func (m *GetOperationsResponse) GetSuccess() *GetOperationsSuccess { + if x, ok := m.GetResponse().(*GetOperationsResponse_Success); ok { + return x.Success + } + return nil +} + +func (m *GetOperationsResponse) GetError() *StoragePluginError { + if x, ok := m.GetResponse().(*GetOperationsResponse_Error); ok { + return x.Error + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*GetOperationsResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { + return _GetOperationsResponse_OneofMarshaler, _GetOperationsResponse_OneofUnmarshaler, _GetOperationsResponse_OneofSizer, []interface{}{ + (*GetOperationsResponse_Success)(nil), + (*GetOperationsResponse_Error)(nil), + } +} + +func _GetOperationsResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { + m := msg.(*GetOperationsResponse) + // response + switch x := m.Response.(type) { + case *GetOperationsResponse_Success: + _ = b.EncodeVarint(1<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Success); err != nil { + return err + } + case *GetOperationsResponse_Error: + _ = b.EncodeVarint(2<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Error); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("GetOperationsResponse.Response has unexpected type %T", x) + } + return nil +} + +func _GetOperationsResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { + m := msg.(*GetOperationsResponse) + switch tag { + case 1: // response.success + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(GetOperationsSuccess) + err := b.DecodeMessage(msg) + m.Response = &GetOperationsResponse_Success{msg} + return true, err + case 2: // response.error + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(StoragePluginError) + err := b.DecodeMessage(msg) + m.Response = &GetOperationsResponse_Error{msg} + return true, err + default: + return false, nil + } +} + +func _GetOperationsResponse_OneofSizer(msg proto1.Message) (n int) { + m := msg.(*GetOperationsResponse) + // response + switch x := m.Response.(type) { + case *GetOperationsResponse_Success: + s := proto1.Size(x.Success) + n += proto1.SizeVarint(1<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case *GetOperationsResponse_Error: + s := proto1.Size(x.Error) + n += proto1.SizeVarint(2<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type TraceQueryParameters struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` + OperationName string `protobuf:"bytes,2,opt,name=operation_name,json=operationName,proto3" json:"operation_name,omitempty"` + Tags map[string]string `protobuf:"bytes,3,rep,name=tags" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + StartTimeMin time.Time `protobuf:"bytes,4,opt,name=start_time_min,json=startTimeMin,stdtime" json:"start_time_min"` + StartTimeMax time.Time `protobuf:"bytes,5,opt,name=start_time_max,json=startTimeMax,stdtime" json:"start_time_max"` + DurationMin time.Duration `protobuf:"bytes,6,opt,name=duration_min,json=durationMin,stdduration" json:"duration_min"` + DurationMax time.Duration `protobuf:"bytes,7,opt,name=duration_max,json=durationMax,stdduration" json:"duration_max"` + NumTraces int32 `protobuf:"varint,8,opt,name=num_traces,json=numTraces,proto3" json:"num_traces,omitempty"` +} + +func (m *TraceQueryParameters) Reset() { *m = TraceQueryParameters{} } +func (m *TraceQueryParameters) String() string { return proto1.CompactTextString(m) } +func (*TraceQueryParameters) ProtoMessage() {} +func (*TraceQueryParameters) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{14} } + +func (m *TraceQueryParameters) GetServiceName() string { + if m != nil { + return m.ServiceName + } + return "" +} + +func (m *TraceQueryParameters) GetOperationName() string { + if m != nil { + return m.OperationName + } + return "" +} + +func (m *TraceQueryParameters) GetTags() map[string]string { + if m != nil { + return m.Tags + } + return nil +} + +func (m *TraceQueryParameters) GetStartTimeMin() time.Time { + if m != nil { + return m.StartTimeMin + } + return time.Time{} +} + +func (m *TraceQueryParameters) GetStartTimeMax() time.Time { + if m != nil { + return m.StartTimeMax + } + return time.Time{} +} + +func (m *TraceQueryParameters) GetDurationMin() time.Duration { + if m != nil { + return m.DurationMin + } + return 0 +} + +func (m *TraceQueryParameters) GetDurationMax() time.Duration { + if m != nil { + return m.DurationMax + } + return 0 +} + +func (m *TraceQueryParameters) GetNumTraces() int32 { + if m != nil { + return m.NumTraces + } + return 0 +} + +type FindTracesRequest struct { + Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"` +} + +func (m *FindTracesRequest) Reset() { *m = FindTracesRequest{} } +func (m *FindTracesRequest) String() string { return proto1.CompactTextString(m) } +func (*FindTracesRequest) ProtoMessage() {} +func (*FindTracesRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{15} } + +func (m *FindTracesRequest) GetQuery() *TraceQueryParameters { + if m != nil { + return m.Query + } + return nil +} + +type FindTracesSuccess struct { + Traces []*jaeger_api_v2.Trace `protobuf:"bytes,1,rep,name=traces" json:"traces,omitempty"` +} + +func (m *FindTracesSuccess) Reset() { *m = FindTracesSuccess{} } +func (m *FindTracesSuccess) String() string { return proto1.CompactTextString(m) } +func (*FindTracesSuccess) ProtoMessage() {} +func (*FindTracesSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{16} } + +func (m *FindTracesSuccess) GetTraces() []*jaeger_api_v2.Trace { + if m != nil { + return m.Traces + } + return nil +} + +type FindTracesResponse struct { + // Types that are valid to be assigned to Response: + // *FindTracesResponse_Success + // *FindTracesResponse_Error + Response isFindTracesResponse_Response `protobuf_oneof:"response"` +} + +func (m *FindTracesResponse) Reset() { *m = FindTracesResponse{} } +func (m *FindTracesResponse) String() string { return proto1.CompactTextString(m) } +func (*FindTracesResponse) ProtoMessage() {} +func (*FindTracesResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{17} } + +type isFindTracesResponse_Response interface { + isFindTracesResponse_Response() + MarshalTo([]byte) (int, error) + Size() int +} + +type FindTracesResponse_Success struct { + Success *FindTracesSuccess `protobuf:"bytes,1,opt,name=success,oneof"` +} +type FindTracesResponse_Error struct { + Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` +} + +func (*FindTracesResponse_Success) isFindTracesResponse_Response() {} +func (*FindTracesResponse_Error) isFindTracesResponse_Response() {} + +func (m *FindTracesResponse) GetResponse() isFindTracesResponse_Response { + if m != nil { + return m.Response + } + return nil +} + +func (m *FindTracesResponse) GetSuccess() *FindTracesSuccess { + if x, ok := m.GetResponse().(*FindTracesResponse_Success); ok { + return x.Success + } + return nil +} + +func (m *FindTracesResponse) GetError() *StoragePluginError { + if x, ok := m.GetResponse().(*FindTracesResponse_Error); ok { + return x.Error + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*FindTracesResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { + return _FindTracesResponse_OneofMarshaler, _FindTracesResponse_OneofUnmarshaler, _FindTracesResponse_OneofSizer, []interface{}{ + (*FindTracesResponse_Success)(nil), + (*FindTracesResponse_Error)(nil), + } +} + +func _FindTracesResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { + m := msg.(*FindTracesResponse) + // response + switch x := m.Response.(type) { + case *FindTracesResponse_Success: + _ = b.EncodeVarint(1<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Success); err != nil { + return err + } + case *FindTracesResponse_Error: + _ = b.EncodeVarint(2<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Error); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("FindTracesResponse.Response has unexpected type %T", x) + } + return nil +} + +func _FindTracesResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { + m := msg.(*FindTracesResponse) + switch tag { + case 1: // response.success + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(FindTracesSuccess) + err := b.DecodeMessage(msg) + m.Response = &FindTracesResponse_Success{msg} + return true, err + case 2: // response.error + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(StoragePluginError) + err := b.DecodeMessage(msg) + m.Response = &FindTracesResponse_Error{msg} + return true, err + default: + return false, nil + } +} + +func _FindTracesResponse_OneofSizer(msg proto1.Message) (n int) { + m := msg.(*FindTracesResponse) + // response + switch x := m.Response.(type) { + case *FindTracesResponse_Success: + s := proto1.Size(x.Success) + n += proto1.SizeVarint(1<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case *FindTracesResponse_Error: + s := proto1.Size(x.Error) + n += proto1.SizeVarint(2<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type FindTraceIDsRequest struct { + Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"` +} + +func (m *FindTraceIDsRequest) Reset() { *m = FindTraceIDsRequest{} } +func (m *FindTraceIDsRequest) String() string { return proto1.CompactTextString(m) } +func (*FindTraceIDsRequest) ProtoMessage() {} +func (*FindTraceIDsRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{18} } + +func (m *FindTraceIDsRequest) GetQuery() *TraceQueryParameters { + if m != nil { + return m.Query + } + return nil +} + +type FindTraceIDsSuccess struct { + TraceIDs []github_com_jaegertracing_jaeger_model.TraceID `protobuf:"bytes,1,rep,name=trace_id,json=traceId,customtype=github.com/jaegertracing/jaeger/model.TraceID" json:"trace_id"` +} + +func (m *FindTraceIDsSuccess) Reset() { *m = FindTraceIDsSuccess{} } +func (m *FindTraceIDsSuccess) String() string { return proto1.CompactTextString(m) } +func (*FindTraceIDsSuccess) ProtoMessage() {} +func (*FindTraceIDsSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{19} } + +type FindTraceIDsResponse struct { + // Types that are valid to be assigned to Response: + // *FindTraceIDsResponse_Success + // *FindTraceIDsResponse_Error + Response isFindTraceIDsResponse_Response `protobuf_oneof:"response"` +} + +func (m *FindTraceIDsResponse) Reset() { *m = FindTraceIDsResponse{} } +func (m *FindTraceIDsResponse) String() string { return proto1.CompactTextString(m) } +func (*FindTraceIDsResponse) ProtoMessage() {} +func (*FindTraceIDsResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{20} } + +type isFindTraceIDsResponse_Response interface { + isFindTraceIDsResponse_Response() + MarshalTo([]byte) (int, error) + Size() int +} + +type FindTraceIDsResponse_Success struct { + Success *FindTraceIDsSuccess `protobuf:"bytes,1,opt,name=success,oneof"` +} +type FindTraceIDsResponse_Error struct { + Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` +} + +func (*FindTraceIDsResponse_Success) isFindTraceIDsResponse_Response() {} +func (*FindTraceIDsResponse_Error) isFindTraceIDsResponse_Response() {} + +func (m *FindTraceIDsResponse) GetResponse() isFindTraceIDsResponse_Response { + if m != nil { + return m.Response + } + return nil +} + +func (m *FindTraceIDsResponse) GetSuccess() *FindTraceIDsSuccess { + if x, ok := m.GetResponse().(*FindTraceIDsResponse_Success); ok { + return x.Success + } + return nil +} + +func (m *FindTraceIDsResponse) GetError() *StoragePluginError { + if x, ok := m.GetResponse().(*FindTraceIDsResponse_Error); ok { + return x.Error + } + return nil +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*FindTraceIDsResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { + return _FindTraceIDsResponse_OneofMarshaler, _FindTraceIDsResponse_OneofUnmarshaler, _FindTraceIDsResponse_OneofSizer, []interface{}{ + (*FindTraceIDsResponse_Success)(nil), + (*FindTraceIDsResponse_Error)(nil), + } +} + +func _FindTraceIDsResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { + m := msg.(*FindTraceIDsResponse) + // response + switch x := m.Response.(type) { + case *FindTraceIDsResponse_Success: + _ = b.EncodeVarint(1<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Success); err != nil { + return err + } + case *FindTraceIDsResponse_Error: + _ = b.EncodeVarint(2<<3 | proto1.WireBytes) + if err := b.EncodeMessage(x.Error); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("FindTraceIDsResponse.Response has unexpected type %T", x) + } + return nil +} + +func _FindTraceIDsResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { + m := msg.(*FindTraceIDsResponse) + switch tag { + case 1: // response.success + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(FindTraceIDsSuccess) + err := b.DecodeMessage(msg) + m.Response = &FindTraceIDsResponse_Success{msg} + return true, err + case 2: // response.error + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType + } + msg := new(StoragePluginError) + err := b.DecodeMessage(msg) + m.Response = &FindTraceIDsResponse_Error{msg} + return true, err + default: + return false, nil + } +} + +func _FindTraceIDsResponse_OneofSizer(msg proto1.Message) (n int) { + m := msg.(*FindTraceIDsResponse) + // response + switch x := m.Response.(type) { + case *FindTraceIDsResponse_Success: + s := proto1.Size(x.Success) + n += proto1.SizeVarint(1<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case *FindTraceIDsResponse_Error: + s := proto1.Size(x.Error) + n += proto1.SizeVarint(2<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type EmptyResponse struct { +} + +func (m *EmptyResponse) Reset() { *m = EmptyResponse{} } +func (m *EmptyResponse) String() string { return proto1.CompactTextString(m) } +func (*EmptyResponse) ProtoMessage() {} +func (*EmptyResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{21} } + +type StoragePluginError struct { + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (m *StoragePluginError) Reset() { *m = StoragePluginError{} } +func (m *StoragePluginError) String() string { return proto1.CompactTextString(m) } +func (*StoragePluginError) ProtoMessage() {} +func (*StoragePluginError) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{22} } + +func (m *StoragePluginError) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func init() { + proto1.RegisterType((*GetDependenciesRequest)(nil), "jaeger.api_v2.GetDependenciesRequest") + golang_proto.RegisterType((*GetDependenciesRequest)(nil), "jaeger.api_v2.GetDependenciesRequest") + proto1.RegisterType((*GetDependenciesSuccess)(nil), "jaeger.api_v2.GetDependenciesSuccess") + golang_proto.RegisterType((*GetDependenciesSuccess)(nil), "jaeger.api_v2.GetDependenciesSuccess") + proto1.RegisterType((*GetDependenciesResponse)(nil), "jaeger.api_v2.GetDependenciesResponse") + golang_proto.RegisterType((*GetDependenciesResponse)(nil), "jaeger.api_v2.GetDependenciesResponse") + proto1.RegisterType((*WriteSpanRequest)(nil), "jaeger.api_v2.WriteSpanRequest") + golang_proto.RegisterType((*WriteSpanRequest)(nil), "jaeger.api_v2.WriteSpanRequest") + proto1.RegisterType((*WriteSpanResponse)(nil), "jaeger.api_v2.WriteSpanResponse") + golang_proto.RegisterType((*WriteSpanResponse)(nil), "jaeger.api_v2.WriteSpanResponse") + proto1.RegisterType((*GetTraceRequest)(nil), "jaeger.api_v2.GetTraceRequest") + golang_proto.RegisterType((*GetTraceRequest)(nil), "jaeger.api_v2.GetTraceRequest") + proto1.RegisterType((*GetTraceSuccess)(nil), "jaeger.api_v2.GetTraceSuccess") + golang_proto.RegisterType((*GetTraceSuccess)(nil), "jaeger.api_v2.GetTraceSuccess") + proto1.RegisterType((*GetTraceResponse)(nil), "jaeger.api_v2.GetTraceResponse") + golang_proto.RegisterType((*GetTraceResponse)(nil), "jaeger.api_v2.GetTraceResponse") + proto1.RegisterType((*GetServicesRequest)(nil), "jaeger.api_v2.GetServicesRequest") + golang_proto.RegisterType((*GetServicesRequest)(nil), "jaeger.api_v2.GetServicesRequest") + proto1.RegisterType((*GetServicesSuccess)(nil), "jaeger.api_v2.GetServicesSuccess") + golang_proto.RegisterType((*GetServicesSuccess)(nil), "jaeger.api_v2.GetServicesSuccess") + proto1.RegisterType((*GetServicesResponse)(nil), "jaeger.api_v2.GetServicesResponse") + golang_proto.RegisterType((*GetServicesResponse)(nil), "jaeger.api_v2.GetServicesResponse") + proto1.RegisterType((*GetOperationsRequest)(nil), "jaeger.api_v2.GetOperationsRequest") + golang_proto.RegisterType((*GetOperationsRequest)(nil), "jaeger.api_v2.GetOperationsRequest") + proto1.RegisterType((*GetOperationsSuccess)(nil), "jaeger.api_v2.GetOperationsSuccess") + golang_proto.RegisterType((*GetOperationsSuccess)(nil), "jaeger.api_v2.GetOperationsSuccess") + proto1.RegisterType((*GetOperationsResponse)(nil), "jaeger.api_v2.GetOperationsResponse") + golang_proto.RegisterType((*GetOperationsResponse)(nil), "jaeger.api_v2.GetOperationsResponse") + proto1.RegisterType((*TraceQueryParameters)(nil), "jaeger.api_v2.TraceQueryParameters") + golang_proto.RegisterType((*TraceQueryParameters)(nil), "jaeger.api_v2.TraceQueryParameters") + proto1.RegisterType((*FindTracesRequest)(nil), "jaeger.api_v2.FindTracesRequest") + golang_proto.RegisterType((*FindTracesRequest)(nil), "jaeger.api_v2.FindTracesRequest") + proto1.RegisterType((*FindTracesSuccess)(nil), "jaeger.api_v2.FindTracesSuccess") + golang_proto.RegisterType((*FindTracesSuccess)(nil), "jaeger.api_v2.FindTracesSuccess") + proto1.RegisterType((*FindTracesResponse)(nil), "jaeger.api_v2.FindTracesResponse") + golang_proto.RegisterType((*FindTracesResponse)(nil), "jaeger.api_v2.FindTracesResponse") + proto1.RegisterType((*FindTraceIDsRequest)(nil), "jaeger.api_v2.FindTraceIDsRequest") + golang_proto.RegisterType((*FindTraceIDsRequest)(nil), "jaeger.api_v2.FindTraceIDsRequest") + proto1.RegisterType((*FindTraceIDsSuccess)(nil), "jaeger.api_v2.FindTraceIDsSuccess") + golang_proto.RegisterType((*FindTraceIDsSuccess)(nil), "jaeger.api_v2.FindTraceIDsSuccess") + proto1.RegisterType((*FindTraceIDsResponse)(nil), "jaeger.api_v2.FindTraceIDsResponse") + golang_proto.RegisterType((*FindTraceIDsResponse)(nil), "jaeger.api_v2.FindTraceIDsResponse") + proto1.RegisterType((*EmptyResponse)(nil), "jaeger.api_v2.EmptyResponse") + golang_proto.RegisterType((*EmptyResponse)(nil), "jaeger.api_v2.EmptyResponse") + proto1.RegisterType((*StoragePluginError)(nil), "jaeger.api_v2.StoragePluginError") + golang_proto.RegisterType((*StoragePluginError)(nil), "jaeger.api_v2.StoragePluginError") +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// Client API for StoragePlugin service + +type StoragePluginClient interface { + // dependencystore/Writer + // rpc WriteDependencies(WriteDependenciesRequest) returns (WriteDependenciesResponse); + // dependencystore/Reader + GetDependencies(ctx context.Context, in *GetDependenciesRequest, opts ...grpc.CallOption) (*GetDependenciesResponse, error) + // spanstore/Writer + WriteSpan(ctx context.Context, in *WriteSpanRequest, opts ...grpc.CallOption) (*WriteSpanResponse, error) + // spanstore/Reader + GetTrace(ctx context.Context, in *GetTraceRequest, opts ...grpc.CallOption) (*GetTraceResponse, error) + GetServices(ctx context.Context, in *GetServicesRequest, opts ...grpc.CallOption) (*GetServicesResponse, error) + GetOperations(ctx context.Context, in *GetOperationsRequest, opts ...grpc.CallOption) (*GetOperationsResponse, error) + FindTraces(ctx context.Context, in *FindTracesRequest, opts ...grpc.CallOption) (*FindTracesResponse, error) + FindTraceIDs(ctx context.Context, in *FindTraceIDsRequest, opts ...grpc.CallOption) (*FindTraceIDsResponse, error) +} + +type storagePluginClient struct { + cc *grpc.ClientConn +} + +func NewStoragePluginClient(cc *grpc.ClientConn) StoragePluginClient { + return &storagePluginClient{cc} +} + +func (c *storagePluginClient) GetDependencies(ctx context.Context, in *GetDependenciesRequest, opts ...grpc.CallOption) (*GetDependenciesResponse, error) { + out := new(GetDependenciesResponse) + err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/GetDependencies", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storagePluginClient) WriteSpan(ctx context.Context, in *WriteSpanRequest, opts ...grpc.CallOption) (*WriteSpanResponse, error) { + out := new(WriteSpanResponse) + err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/WriteSpan", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storagePluginClient) GetTrace(ctx context.Context, in *GetTraceRequest, opts ...grpc.CallOption) (*GetTraceResponse, error) { + out := new(GetTraceResponse) + err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/GetTrace", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storagePluginClient) GetServices(ctx context.Context, in *GetServicesRequest, opts ...grpc.CallOption) (*GetServicesResponse, error) { + out := new(GetServicesResponse) + err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/GetServices", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storagePluginClient) GetOperations(ctx context.Context, in *GetOperationsRequest, opts ...grpc.CallOption) (*GetOperationsResponse, error) { + out := new(GetOperationsResponse) + err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/GetOperations", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storagePluginClient) FindTraces(ctx context.Context, in *FindTracesRequest, opts ...grpc.CallOption) (*FindTracesResponse, error) { + out := new(FindTracesResponse) + err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/FindTraces", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *storagePluginClient) FindTraceIDs(ctx context.Context, in *FindTraceIDsRequest, opts ...grpc.CallOption) (*FindTraceIDsResponse, error) { + out := new(FindTraceIDsResponse) + err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/FindTraceIDs", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for StoragePlugin service + +type StoragePluginServer interface { + // dependencystore/Writer + // rpc WriteDependencies(WriteDependenciesRequest) returns (WriteDependenciesResponse); + // dependencystore/Reader + GetDependencies(context.Context, *GetDependenciesRequest) (*GetDependenciesResponse, error) + // spanstore/Writer + WriteSpan(context.Context, *WriteSpanRequest) (*WriteSpanResponse, error) + // spanstore/Reader + GetTrace(context.Context, *GetTraceRequest) (*GetTraceResponse, error) + GetServices(context.Context, *GetServicesRequest) (*GetServicesResponse, error) + GetOperations(context.Context, *GetOperationsRequest) (*GetOperationsResponse, error) + FindTraces(context.Context, *FindTracesRequest) (*FindTracesResponse, error) + FindTraceIDs(context.Context, *FindTraceIDsRequest) (*FindTraceIDsResponse, error) +} + +func RegisterStoragePluginServer(s *grpc.Server, srv StoragePluginServer) { + s.RegisterService(&_StoragePlugin_serviceDesc, srv) +} + +func _StoragePlugin_GetDependencies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDependenciesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoragePluginServer).GetDependencies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/jaeger.api_v2.StoragePlugin/GetDependencies", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoragePluginServer).GetDependencies(ctx, req.(*GetDependenciesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StoragePlugin_WriteSpan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(WriteSpanRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoragePluginServer).WriteSpan(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/jaeger.api_v2.StoragePlugin/WriteSpan", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoragePluginServer).WriteSpan(ctx, req.(*WriteSpanRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StoragePlugin_GetTrace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTraceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoragePluginServer).GetTrace(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/jaeger.api_v2.StoragePlugin/GetTrace", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoragePluginServer).GetTrace(ctx, req.(*GetTraceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StoragePlugin_GetServices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetServicesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoragePluginServer).GetServices(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/jaeger.api_v2.StoragePlugin/GetServices", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoragePluginServer).GetServices(ctx, req.(*GetServicesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StoragePlugin_GetOperations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetOperationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoragePluginServer).GetOperations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/jaeger.api_v2.StoragePlugin/GetOperations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoragePluginServer).GetOperations(ctx, req.(*GetOperationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StoragePlugin_FindTraces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindTracesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoragePluginServer).FindTraces(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/jaeger.api_v2.StoragePlugin/FindTraces", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoragePluginServer).FindTraces(ctx, req.(*FindTracesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _StoragePlugin_FindTraceIDs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindTraceIDsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StoragePluginServer).FindTraceIDs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/jaeger.api_v2.StoragePlugin/FindTraceIDs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StoragePluginServer).FindTraceIDs(ctx, req.(*FindTraceIDsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _StoragePlugin_serviceDesc = grpc.ServiceDesc{ + ServiceName: "jaeger.api_v2.StoragePlugin", + HandlerType: (*StoragePluginServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetDependencies", + Handler: _StoragePlugin_GetDependencies_Handler, + }, + { + MethodName: "WriteSpan", + Handler: _StoragePlugin_WriteSpan_Handler, + }, + { + MethodName: "GetTrace", + Handler: _StoragePlugin_GetTrace_Handler, + }, + { + MethodName: "GetServices", + Handler: _StoragePlugin_GetServices_Handler, + }, + { + MethodName: "GetOperations", + Handler: _StoragePlugin_GetOperations_Handler, + }, + { + MethodName: "FindTraces", + Handler: _StoragePlugin_FindTraces_Handler, + }, + { + MethodName: "FindTraceIDs", + Handler: _StoragePlugin_FindTraceIDs_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "storage.proto", +} + +func (m *GetDependenciesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetDependenciesRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdTime(m.EndTimestamp))) + n1, err := types.StdTimeMarshalTo(m.EndTimestamp, dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdDuration(m.Lookback))) + n2, err := types.StdDurationMarshalTo(m.Lookback, dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + return i, nil +} + +func (m *GetDependenciesSuccess) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetDependenciesSuccess) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Dependencies) > 0 { + for _, msg := range m.Dependencies { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *GetDependenciesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetDependenciesResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Response != nil { + nn3, err := m.Response.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn3 + } + return i, nil +} + +func (m *GetDependenciesResponse_Success) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Success != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) + n4, err := m.Success.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + return i, nil +} +func (m *GetDependenciesResponse_Error) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) + n5, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + return i, nil +} +func (m *WriteSpanRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WriteSpanRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Span != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Span.Size())) + n6, err := m.Span.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + return i, nil +} + +func (m *WriteSpanResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WriteSpanResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Response != nil { + nn7, err := m.Response.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn7 + } + return i, nil +} + +func (m *WriteSpanResponse_Success) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Success != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) + n8, err := m.Success.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + return i, nil +} +func (m *WriteSpanResponse_Error) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) + n9, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n9 + } + return i, nil +} +func (m *GetTraceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTraceRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.TraceID.Size())) + n10, err := m.TraceID.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n10 + return i, nil +} + +func (m *GetTraceSuccess) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTraceSuccess) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Trace != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Trace.Size())) + n11, err := m.Trace.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + return i, nil +} + +func (m *GetTraceResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTraceResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Response != nil { + nn12, err := m.Response.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn12 + } + return i, nil +} + +func (m *GetTraceResponse_Success) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Success != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) + n13, err := m.Success.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n13 + } + return i, nil +} +func (m *GetTraceResponse_Error) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) + n14, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n14 + } + return i, nil +} +func (m *GetServicesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetServicesRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func (m *GetServicesSuccess) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetServicesSuccess) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Services) > 0 { + for _, s := range m.Services { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *GetServicesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetServicesResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Response != nil { + nn15, err := m.Response.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn15 + } + return i, nil +} + +func (m *GetServicesResponse_Success) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Success != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) + n16, err := m.Success.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n16 + } + return i, nil +} +func (m *GetServicesResponse_Error) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) + n17, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n17 + } + return i, nil +} +func (m *GetOperationsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetOperationsRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Service) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(m.Service))) + i += copy(dAtA[i:], m.Service) + } + return i, nil +} + +func (m *GetOperationsSuccess) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetOperationsSuccess) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Operations) > 0 { + for _, s := range m.Operations { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + return i, nil +} + +func (m *GetOperationsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetOperationsResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Response != nil { + nn18, err := m.Response.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn18 + } + return i, nil +} + +func (m *GetOperationsResponse_Success) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Success != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) + n19, err := m.Success.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + } + return i, nil +} +func (m *GetOperationsResponse_Error) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) + n20, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n20 + } + return i, nil +} +func (m *TraceQueryParameters) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TraceQueryParameters) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.ServiceName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(m.ServiceName))) + i += copy(dAtA[i:], m.ServiceName) + } + if len(m.OperationName) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(m.OperationName))) + i += copy(dAtA[i:], m.OperationName) + } + if len(m.Tags) > 0 { + for k, _ := range m.Tags { + dAtA[i] = 0x1a + i++ + v := m.Tags[k] + mapSize := 1 + len(k) + sovStorage(uint64(len(k))) + 1 + len(v) + sovStorage(uint64(len(v))) + i = encodeVarintStorage(dAtA, i, uint64(mapSize)) + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(k))) + i += copy(dAtA[i:], k) + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(v))) + i += copy(dAtA[i:], v) + } + } + dAtA[i] = 0x22 + i++ + i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdTime(m.StartTimeMin))) + n21, err := types.StdTimeMarshalTo(m.StartTimeMin, dAtA[i:]) + if err != nil { + return 0, err + } + i += n21 + dAtA[i] = 0x2a + i++ + i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdTime(m.StartTimeMax))) + n22, err := types.StdTimeMarshalTo(m.StartTimeMax, dAtA[i:]) + if err != nil { + return 0, err + } + i += n22 + dAtA[i] = 0x32 + i++ + i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdDuration(m.DurationMin))) + n23, err := types.StdDurationMarshalTo(m.DurationMin, dAtA[i:]) + if err != nil { + return 0, err + } + i += n23 + dAtA[i] = 0x3a + i++ + i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdDuration(m.DurationMax))) + n24, err := types.StdDurationMarshalTo(m.DurationMax, dAtA[i:]) + if err != nil { + return 0, err + } + i += n24 + if m.NumTraces != 0 { + dAtA[i] = 0x40 + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.NumTraces)) + } + return i, nil +} + +func (m *FindTracesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FindTracesRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Query != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Query.Size())) + n25, err := m.Query.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n25 + } + return i, nil +} + +func (m *FindTracesSuccess) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FindTracesSuccess) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Traces) > 0 { + for _, msg := range m.Traces { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *FindTracesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FindTracesResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Response != nil { + nn26, err := m.Response.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn26 + } + return i, nil +} + +func (m *FindTracesResponse_Success) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Success != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) + n27, err := m.Success.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n27 + } + return i, nil +} +func (m *FindTracesResponse_Error) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) + n28, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n28 + } + return i, nil +} +func (m *FindTraceIDsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FindTraceIDsRequest) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Query != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Query.Size())) + n29, err := m.Query.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n29 + } + return i, nil +} + +func (m *FindTraceIDsSuccess) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FindTraceIDsSuccess) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.TraceIDs) > 0 { + for _, msg := range m.TraceIDs { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *FindTraceIDsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FindTraceIDsResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Response != nil { + nn30, err := m.Response.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn30 + } + return i, nil +} + +func (m *FindTraceIDsResponse_Success) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Success != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) + n31, err := m.Success.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n31 + } + return i, nil +} +func (m *FindTraceIDsResponse_Error) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.Error != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) + n32, err := m.Error.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n32 + } + return i, nil +} +func (m *EmptyResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EmptyResponse) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + return i, nil +} + +func (m *StoragePluginError) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StoragePluginError) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Message) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintStorage(dAtA, i, uint64(len(m.Message))) + i += copy(dAtA[i:], m.Message) + } + return i, nil +} + +func encodeVarintStorage(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *GetDependenciesRequest) Size() (n int) { + var l int + _ = l + l = types.SizeOfStdTime(m.EndTimestamp) + n += 1 + l + sovStorage(uint64(l)) + l = types.SizeOfStdDuration(m.Lookback) + n += 1 + l + sovStorage(uint64(l)) + return n +} + +func (m *GetDependenciesSuccess) Size() (n int) { + var l int + _ = l + if len(m.Dependencies) > 0 { + for _, e := range m.Dependencies { + l = e.Size() + n += 1 + l + sovStorage(uint64(l)) + } + } + return n +} + +func (m *GetDependenciesResponse) Size() (n int) { + var l int + _ = l + if m.Response != nil { + n += m.Response.Size() + } + return n +} + +func (m *GetDependenciesResponse_Success) Size() (n int) { + var l int + _ = l + if m.Success != nil { + l = m.Success.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *GetDependenciesResponse_Error) Size() (n int) { + var l int + _ = l + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *WriteSpanRequest) Size() (n int) { + var l int + _ = l + if m.Span != nil { + l = m.Span.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} + +func (m *WriteSpanResponse) Size() (n int) { + var l int + _ = l + if m.Response != nil { + n += m.Response.Size() + } + return n +} + +func (m *WriteSpanResponse_Success) Size() (n int) { + var l int + _ = l + if m.Success != nil { + l = m.Success.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *WriteSpanResponse_Error) Size() (n int) { + var l int + _ = l + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *GetTraceRequest) Size() (n int) { + var l int + _ = l + l = m.TraceID.Size() + n += 1 + l + sovStorage(uint64(l)) + return n +} + +func (m *GetTraceSuccess) Size() (n int) { + var l int + _ = l + if m.Trace != nil { + l = m.Trace.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} + +func (m *GetTraceResponse) Size() (n int) { + var l int + _ = l + if m.Response != nil { + n += m.Response.Size() + } + return n +} + +func (m *GetTraceResponse_Success) Size() (n int) { + var l int + _ = l + if m.Success != nil { + l = m.Success.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *GetTraceResponse_Error) Size() (n int) { + var l int + _ = l + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *GetServicesRequest) Size() (n int) { + var l int + _ = l + return n +} + +func (m *GetServicesSuccess) Size() (n int) { + var l int + _ = l + if len(m.Services) > 0 { + for _, s := range m.Services { + l = len(s) + n += 1 + l + sovStorage(uint64(l)) + } + } + return n +} + +func (m *GetServicesResponse) Size() (n int) { + var l int + _ = l + if m.Response != nil { + n += m.Response.Size() + } + return n +} + +func (m *GetServicesResponse_Success) Size() (n int) { + var l int + _ = l + if m.Success != nil { + l = m.Success.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *GetServicesResponse_Error) Size() (n int) { + var l int + _ = l + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *GetOperationsRequest) Size() (n int) { + var l int + _ = l + l = len(m.Service) + if l > 0 { + n += 1 + l + sovStorage(uint64(l)) + } + return n +} + +func (m *GetOperationsSuccess) Size() (n int) { + var l int + _ = l + if len(m.Operations) > 0 { + for _, s := range m.Operations { + l = len(s) + n += 1 + l + sovStorage(uint64(l)) + } + } + return n +} + +func (m *GetOperationsResponse) Size() (n int) { + var l int + _ = l + if m.Response != nil { + n += m.Response.Size() + } + return n +} + +func (m *GetOperationsResponse_Success) Size() (n int) { + var l int + _ = l + if m.Success != nil { + l = m.Success.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *GetOperationsResponse_Error) Size() (n int) { + var l int + _ = l + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *TraceQueryParameters) Size() (n int) { + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovStorage(uint64(l)) + } + l = len(m.OperationName) + if l > 0 { + n += 1 + l + sovStorage(uint64(l)) + } + if len(m.Tags) > 0 { + for k, v := range m.Tags { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovStorage(uint64(len(k))) + 1 + len(v) + sovStorage(uint64(len(v))) + n += mapEntrySize + 1 + sovStorage(uint64(mapEntrySize)) + } + } + l = types.SizeOfStdTime(m.StartTimeMin) + n += 1 + l + sovStorage(uint64(l)) + l = types.SizeOfStdTime(m.StartTimeMax) + n += 1 + l + sovStorage(uint64(l)) + l = types.SizeOfStdDuration(m.DurationMin) + n += 1 + l + sovStorage(uint64(l)) + l = types.SizeOfStdDuration(m.DurationMax) + n += 1 + l + sovStorage(uint64(l)) + if m.NumTraces != 0 { + n += 1 + sovStorage(uint64(m.NumTraces)) + } + return n +} + +func (m *FindTracesRequest) Size() (n int) { + var l int + _ = l + if m.Query != nil { + l = m.Query.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} + +func (m *FindTracesSuccess) Size() (n int) { + var l int + _ = l + if len(m.Traces) > 0 { + for _, e := range m.Traces { + l = e.Size() + n += 1 + l + sovStorage(uint64(l)) + } + } + return n +} + +func (m *FindTracesResponse) Size() (n int) { + var l int + _ = l + if m.Response != nil { + n += m.Response.Size() + } + return n +} + +func (m *FindTracesResponse_Success) Size() (n int) { + var l int + _ = l + if m.Success != nil { + l = m.Success.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *FindTracesResponse_Error) Size() (n int) { + var l int + _ = l + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *FindTraceIDsRequest) Size() (n int) { + var l int + _ = l + if m.Query != nil { + l = m.Query.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} + +func (m *FindTraceIDsSuccess) Size() (n int) { + var l int + _ = l + if len(m.TraceIDs) > 0 { + for _, e := range m.TraceIDs { + l = e.Size() + n += 1 + l + sovStorage(uint64(l)) + } + } + return n +} + +func (m *FindTraceIDsResponse) Size() (n int) { + var l int + _ = l + if m.Response != nil { + n += m.Response.Size() + } + return n +} + +func (m *FindTraceIDsResponse_Success) Size() (n int) { + var l int + _ = l + if m.Success != nil { + l = m.Success.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *FindTraceIDsResponse_Error) Size() (n int) { + var l int + _ = l + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovStorage(uint64(l)) + } + return n +} +func (m *EmptyResponse) Size() (n int) { + var l int + _ = l + return n +} + +func (m *StoragePluginError) Size() (n int) { + var l int + _ = l + l = len(m.Message) + if l > 0 { + n += 1 + l + sovStorage(uint64(l)) + } + return n +} + +func sovStorage(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozStorage(x uint64) (n int) { + return sovStorage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GetDependenciesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetDependenciesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetDependenciesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTimestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := types.StdTimeUnmarshal(&m.EndTimestamp, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lookback", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := types.StdDurationUnmarshal(&m.Lookback, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetDependenciesSuccess) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetDependenciesSuccess: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetDependenciesSuccess: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Dependencies", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_jaegertracing_jaeger_model.DependencyLink + m.Dependencies = append(m.Dependencies, v) + if err := m.Dependencies[len(m.Dependencies)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetDependenciesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetDependenciesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetDependenciesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GetDependenciesSuccess{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &GetDependenciesResponse_Success{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &StoragePluginError{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &GetDependenciesResponse_Error{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WriteSpanRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WriteSpanRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WriteSpanRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Span", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Span == nil { + m.Span = &jaeger_api_v2.Span{} + } + if err := m.Span.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WriteSpanResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WriteSpanResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WriteSpanResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &EmptyResponse{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &WriteSpanResponse_Success{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &StoragePluginError{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &WriteSpanResponse_Error{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetTraceRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTraceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTraceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TraceID", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TraceID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetTraceSuccess) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTraceSuccess: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTraceSuccess: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Trace", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Trace == nil { + m.Trace = &jaeger_api_v2.Trace{} + } + if err := m.Trace.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetTraceResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetTraceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetTraceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GetTraceSuccess{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &GetTraceResponse_Success{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &StoragePluginError{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &GetTraceResponse_Error{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetServicesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetServicesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetServicesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetServicesSuccess) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetServicesSuccess: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetServicesSuccess: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Services", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Services = append(m.Services, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetServicesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetServicesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetServicesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GetServicesSuccess{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &GetServicesResponse_Success{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &StoragePluginError{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &GetServicesResponse_Error{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetOperationsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetOperationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetOperationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Service = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetOperationsSuccess) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetOperationsSuccess: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetOperationsSuccess: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Operations", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operations = append(m.Operations, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetOperationsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GetOperationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GetOperationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &GetOperationsSuccess{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &GetOperationsResponse_Success{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &StoragePluginError{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &GetOperationsResponse_Error{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TraceQueryParameters) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TraceQueryParameters: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TraceQueryParameters: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperationName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperationName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Tags == nil { + m.Tags = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthStorage + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthStorage + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Tags[mapkey] = mapvalue + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTimeMin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := types.StdTimeUnmarshal(&m.StartTimeMin, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTimeMax", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := types.StdTimeUnmarshal(&m.StartTimeMax, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DurationMin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := types.StdDurationUnmarshal(&m.DurationMin, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DurationMax", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := types.StdDurationUnmarshal(&m.DurationMax, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NumTraces", wireType) + } + m.NumTraces = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NumTraces |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FindTracesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FindTracesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FindTracesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Query == nil { + m.Query = &TraceQueryParameters{} + } + if err := m.Query.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FindTracesSuccess) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FindTracesSuccess: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FindTracesSuccess: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Traces", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Traces = append(m.Traces, &jaeger_api_v2.Trace{}) + if err := m.Traces[len(m.Traces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FindTracesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FindTracesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FindTracesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &FindTracesSuccess{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &FindTracesResponse_Success{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &StoragePluginError{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &FindTracesResponse_Error{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FindTraceIDsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FindTraceIDsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FindTraceIDsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Query == nil { + m.Query = &TraceQueryParameters{} + } + if err := m.Query.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FindTraceIDsSuccess) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FindTraceIDsSuccess: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FindTraceIDsSuccess: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TraceIDs", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_jaegertracing_jaeger_model.TraceID + m.TraceIDs = append(m.TraceIDs, v) + if err := m.TraceIDs[len(m.TraceIDs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FindTraceIDsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FindTraceIDsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FindTraceIDsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &FindTraceIDsSuccess{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &FindTraceIDsResponse_Success{v} + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &StoragePluginError{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Response = &FindTraceIDsResponse_Error{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EmptyResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EmptyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EmptyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StoragePluginError) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StoragePluginError: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StoragePluginError: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowStorage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthStorage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipStorage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthStorage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipStorage(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStorage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStorage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStorage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthStorage + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowStorage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipStorage(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthStorage = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowStorage = fmt.Errorf("proto: integer overflow") +) + +func init() { proto1.RegisterFile("storage.proto", fileDescriptorStorage) } +func init() { golang_proto.RegisterFile("storage.proto", fileDescriptorStorage) } + +var fileDescriptorStorage = []byte{ + // 1076 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdf, 0x6e, 0x1b, 0xc5, + 0x17, 0xce, 0x26, 0x71, 0x6c, 0x1f, 0xdb, 0x6d, 0x3a, 0xf1, 0xef, 0x57, 0x63, 0x81, 0xed, 0x6c, + 0x29, 0x44, 0x88, 0xae, 0xab, 0x80, 0xa0, 0x2d, 0x2d, 0x25, 0x56, 0xd2, 0x34, 0xfc, 0x09, 0xe9, + 0x26, 0x52, 0xa5, 0x82, 0xe4, 0x4e, 0xec, 0x61, 0x59, 0xe2, 0x9d, 0x75, 0x77, 0x66, 0xa3, 0x98, + 0xa7, 0xe0, 0x02, 0x24, 0x10, 0x42, 0x5c, 0x94, 0x07, 0xe1, 0xb2, 0x97, 0x5c, 0x73, 0x11, 0x50, + 0xb8, 0xe5, 0x21, 0xd0, 0xce, 0xce, 0x6c, 0xbc, 0xe3, 0xd8, 0x2d, 0x11, 0xbe, 0xda, 0x9d, 0x99, + 0xef, 0x7c, 0x73, 0xce, 0x77, 0xe6, 0xcc, 0x19, 0x28, 0x31, 0xee, 0x07, 0xd8, 0x21, 0x56, 0x3f, + 0xf0, 0xb9, 0x8f, 0x4a, 0x5f, 0x61, 0xe2, 0x90, 0xc0, 0xc2, 0x7d, 0xb7, 0x7d, 0xb8, 0x5a, 0x2d, + 0x3b, 0xbe, 0xe3, 0x8b, 0x95, 0x66, 0xf4, 0x17, 0x83, 0xaa, 0x05, 0xcf, 0xef, 0x92, 0x9e, 0x1c, + 0xd4, 0x1d, 0xdf, 0x77, 0x7a, 0xa4, 0x29, 0x46, 0xfb, 0xe1, 0x17, 0x4d, 0xee, 0x7a, 0x84, 0x71, + 0xec, 0xf5, 0x25, 0xa0, 0xa6, 0x03, 0xba, 0x61, 0x80, 0xb9, 0xeb, 0xd3, 0x78, 0xdd, 0xfc, 0xc5, + 0x80, 0xff, 0x6f, 0x12, 0xbe, 0x4e, 0xfa, 0x84, 0x76, 0x09, 0xed, 0xb8, 0x84, 0xd9, 0xe4, 0x49, + 0x48, 0x18, 0x47, 0x5b, 0x50, 0x22, 0xb4, 0xdb, 0x4e, 0x18, 0x2b, 0x46, 0xc3, 0x58, 0x29, 0xac, + 0x56, 0xad, 0x98, 0xd2, 0x52, 0x94, 0xd6, 0x9e, 0x42, 0xb4, 0x72, 0xcf, 0x8e, 0xeb, 0x33, 0xdf, + 0xfc, 0x51, 0x37, 0xec, 0x22, 0xa1, 0xdd, 0x64, 0x1e, 0xdd, 0x85, 0x5c, 0xcf, 0xf7, 0x0f, 0xf6, + 0x71, 0xe7, 0xa0, 0x32, 0x2b, 0x58, 0x5e, 0x1a, 0x61, 0x59, 0x97, 0x8e, 0xc5, 0x24, 0xdf, 0x47, + 0x24, 0x89, 0x91, 0xf9, 0xf5, 0x88, 0x97, 0xbb, 0x61, 0xa7, 0x43, 0x18, 0x43, 0x8f, 0xa1, 0xd8, + 0x1d, 0x9a, 0xae, 0x18, 0x8d, 0xb9, 0x95, 0x62, 0xeb, 0x76, 0xc4, 0xf1, 0xfb, 0x71, 0xfd, 0x6d, + 0xc7, 0xe5, 0x5f, 0x86, 0xfb, 0x56, 0xc7, 0xf7, 0x9a, 0xb1, 0xb8, 0x3c, 0xc0, 0x1d, 0x97, 0x3a, + 0x72, 0xd4, 0x8c, 0xc5, 0x4c, 0x88, 0x07, 0x1f, 0xbb, 0xf4, 0xc0, 0x4e, 0x31, 0x9a, 0x4f, 0x0d, + 0xb8, 0x3c, 0x22, 0x11, 0xeb, 0xfb, 0x94, 0x11, 0xb4, 0x06, 0x59, 0x16, 0x3b, 0x22, 0xd5, 0xb9, + 0x6a, 0xa5, 0x72, 0x68, 0x9d, 0xed, 0xf5, 0xfd, 0x19, 0x5b, 0xd9, 0xa1, 0x9b, 0x90, 0x21, 0x41, + 0xe0, 0x07, 0x52, 0x98, 0x65, 0x8d, 0x60, 0x37, 0x3e, 0x21, 0x3b, 0xbd, 0xd0, 0x71, 0xe9, 0x46, + 0x04, 0xbc, 0x3f, 0x63, 0xc7, 0x16, 0x2d, 0x80, 0x5c, 0x20, 0x3d, 0x31, 0xdf, 0x83, 0xc5, 0x87, + 0x81, 0xcb, 0xc9, 0x6e, 0x1f, 0x53, 0x95, 0xc1, 0xd7, 0x61, 0x9e, 0xf5, 0x31, 0x95, 0xae, 0x2d, + 0xe9, 0xcc, 0x11, 0x52, 0x00, 0xcc, 0x6f, 0x0d, 0xb8, 0x34, 0x64, 0x2d, 0x83, 0xbb, 0xa1, 0x07, + 0xf7, 0xb2, 0xc6, 0xb0, 0xe1, 0xf5, 0xf9, 0x40, 0xc1, 0xa7, 0x10, 0x13, 0x85, 0x8b, 0x9b, 0x84, + 0xef, 0x05, 0xb8, 0x43, 0x54, 0x48, 0x9f, 0x41, 0x2e, 0xca, 0x20, 0x69, 0xbb, 0x5d, 0xe1, 0x54, + 0xb1, 0xf5, 0x81, 0x4c, 0xf5, 0xb5, 0x17, 0x4b, 0xb5, 0x60, 0xdb, 0x5a, 0x3f, 0x39, 0xae, 0x67, + 0xe5, 0xaf, 0x9d, 0x15, 0x8c, 0x5b, 0x5d, 0xf3, 0xce, 0xe9, 0x7e, 0xea, 0x78, 0xbd, 0x01, 0x19, + 0xb1, 0x2a, 0x15, 0x28, 0x6b, 0x91, 0xc4, 0xbe, 0xc5, 0x10, 0xf3, 0x3b, 0x03, 0x16, 0x4f, 0xfd, + 0x95, 0x22, 0xde, 0xd2, 0x45, 0xac, 0x8d, 0x9e, 0x90, 0xe1, 0x1d, 0xa7, 0x20, 0x63, 0x19, 0xd0, + 0x26, 0xe1, 0xbb, 0x24, 0x38, 0x74, 0x3b, 0x49, 0x79, 0x9b, 0xd7, 0x53, 0xb3, 0x2a, 0xde, 0x2a, + 0xe4, 0x98, 0x9c, 0x12, 0xa5, 0x94, 0xb7, 0x93, 0xb1, 0xf9, 0xa3, 0x01, 0x4b, 0x29, 0x22, 0x19, + 0xe2, 0x1d, 0x3d, 0xc4, 0xe5, 0xd1, 0x10, 0xb5, 0x7d, 0xa6, 0x10, 0xe5, 0x75, 0x28, 0x6f, 0x12, + 0xfe, 0x69, 0x9f, 0xc4, 0xd7, 0x48, 0x72, 0x8d, 0x55, 0x20, 0x2b, 0x23, 0x10, 0xde, 0xe5, 0x6d, + 0x35, 0x34, 0xdf, 0xd1, 0x2c, 0x94, 0x06, 0x35, 0x00, 0x3f, 0x99, 0x94, 0x2a, 0x0c, 0xcd, 0x98, + 0x3f, 0x1b, 0xf0, 0x3f, 0x6d, 0x2b, 0xa9, 0xc4, 0x5d, 0x5d, 0x89, 0x2b, 0xa3, 0x4a, 0x8c, 0xec, + 0x37, 0x05, 0x2d, 0x9e, 0xce, 0x43, 0x59, 0x1c, 0xaa, 0x07, 0x21, 0x09, 0x06, 0x3b, 0x38, 0xc0, + 0x1e, 0xe1, 0x24, 0x60, 0x68, 0x19, 0x8a, 0x32, 0xfa, 0x36, 0xc5, 0x9e, 0x52, 0xa4, 0x20, 0xe7, + 0xb6, 0xb1, 0x47, 0xd0, 0x55, 0xb8, 0x90, 0xc4, 0x1a, 0x83, 0x66, 0x05, 0xa8, 0x94, 0xcc, 0x0a, + 0xd8, 0x1a, 0xcc, 0x73, 0xec, 0xb0, 0xca, 0x5c, 0x63, 0x6e, 0xa5, 0xb0, 0x7a, 0xed, 0xac, 0xba, + 0xd0, 0x36, 0xb7, 0xf6, 0xb0, 0xc3, 0x36, 0x28, 0x0f, 0x06, 0xb6, 0x30, 0x45, 0x1f, 0xc2, 0x05, + 0xc6, 0x71, 0xc0, 0x45, 0x8b, 0x69, 0x7b, 0x2e, 0xad, 0xcc, 0xff, 0x9b, 0x0e, 0x23, 0x6c, 0xa3, + 0x95, 0x4f, 0x5c, 0xaa, 0x73, 0xe1, 0xa3, 0x4a, 0xe6, 0x7c, 0x5c, 0xf8, 0x08, 0xdd, 0x83, 0xa2, + 0xea, 0x92, 0xc2, 0xab, 0x85, 0x17, 0xef, 0x58, 0x05, 0x65, 0x18, 0xf9, 0x94, 0xe2, 0xc1, 0x47, + 0x95, 0xec, 0x79, 0x78, 0xf0, 0x11, 0x7a, 0x05, 0x80, 0x86, 0x5e, 0x5b, 0x5c, 0x32, 0xac, 0x92, + 0x6b, 0x18, 0x2b, 0x19, 0x3b, 0x4f, 0x43, 0x4f, 0x88, 0xcc, 0xaa, 0xef, 0x42, 0x3e, 0x51, 0x16, + 0x2d, 0xc2, 0xdc, 0x01, 0x19, 0xc8, 0xbc, 0x46, 0xbf, 0xa8, 0x0c, 0x99, 0x43, 0xdc, 0x0b, 0x55, + 0x1a, 0xe3, 0xc1, 0xad, 0xd9, 0x1b, 0x86, 0xb9, 0x0d, 0x97, 0xee, 0xb9, 0xb4, 0x1b, 0xd3, 0xa8, + 0x72, 0xb9, 0x09, 0x99, 0x27, 0x51, 0xde, 0xc6, 0x1c, 0xe0, 0xb3, 0x12, 0x6b, 0xc7, 0x16, 0xe6, + 0xda, 0x30, 0x9f, 0x2a, 0xa6, 0x37, 0x61, 0x41, 0x3a, 0x6e, 0x88, 0x93, 0x72, 0xf6, 0x0d, 0x2a, + 0x31, 0xe6, 0x0f, 0x06, 0xa0, 0x61, 0x9f, 0x64, 0x5d, 0xdd, 0xd6, 0xeb, 0xaa, 0xa1, 0xb1, 0x8c, + 0xec, 0x3b, 0x85, 0xa2, 0xda, 0x81, 0xa5, 0x64, 0x9b, 0xad, 0xf5, 0xff, 0x42, 0x30, 0x96, 0x66, + 0x54, 0x92, 0x7d, 0x9e, 0xea, 0x71, 0xd1, 0x73, 0x66, 0xed, 0xbc, 0x3d, 0x2e, 0x97, 0x78, 0x9b, + 0x34, 0xb9, 0x9f, 0x0c, 0x28, 0xa7, 0xe3, 0x90, 0x22, 0xbf, 0xaf, 0x8b, 0x6c, 0x8e, 0x13, 0xf9, + 0xd4, 0xd7, 0x29, 0xc8, 0x7c, 0x11, 0x4a, 0xa9, 0x77, 0x85, 0x69, 0x01, 0x1a, 0xb5, 0x8d, 0xae, + 0x75, 0x8f, 0x30, 0x86, 0x9d, 0xe4, 0x5a, 0x97, 0xc3, 0xd5, 0xbf, 0xe7, 0xa1, 0x94, 0x32, 0x40, + 0x8f, 0x45, 0x5f, 0x1f, 0x7e, 0x87, 0xa1, 0xe7, 0xbc, 0xd3, 0x64, 0x72, 0xab, 0xaf, 0x3d, 0x0f, + 0x26, 0xb5, 0xdb, 0x86, 0x7c, 0xf2, 0x7e, 0x42, 0x75, 0xcd, 0x48, 0x7f, 0x97, 0x55, 0x1b, 0xe3, + 0x01, 0x92, 0xef, 0x23, 0xc8, 0xa9, 0x77, 0x01, 0x1a, 0xf7, 0x60, 0x50, 0x6c, 0xf5, 0xb1, 0xeb, + 0x92, 0x6c, 0x0f, 0x0a, 0x43, 0x1d, 0x18, 0x4d, 0xe8, 0xce, 0x8a, 0xd2, 0x9c, 0x04, 0x91, 0xac, + 0x8f, 0xa0, 0x94, 0xea, 0x66, 0x68, 0x62, 0xaf, 0x53, 0xcc, 0xaf, 0x4e, 0x06, 0x49, 0xee, 0x07, + 0x00, 0xa7, 0x15, 0x8d, 0xc6, 0x17, 0xbb, 0x62, 0x5d, 0x9e, 0x80, 0x90, 0x94, 0x0f, 0xa1, 0x38, + 0x7c, 0x7e, 0xd1, 0xa4, 0xc3, 0xad, 0x68, 0xaf, 0x4c, 0xc4, 0xc4, 0xc4, 0xad, 0xcb, 0xcf, 0x4e, + 0x6a, 0xc6, 0x6f, 0x27, 0x35, 0xe3, 0xcf, 0x93, 0x9a, 0xf1, 0xeb, 0x5f, 0x35, 0xe3, 0x51, 0x26, + 0xbe, 0xd9, 0x17, 0xc4, 0xe7, 0xad, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x63, 0x7a, 0xfc, 0x43, + 0xe5, 0x0d, 0x00, 0x00, +} diff --git a/plugin/storage/grpc/shared/grpc.go b/plugin/storage/grpc/shared/grpc.go new file mode 100644 index 00000000000..be0e35e9fd4 --- /dev/null +++ b/plugin/storage/grpc/shared/grpc.go @@ -0,0 +1,335 @@ +// Copyright (c) 2018 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 shared + +import ( + "context" + "fmt" + "time" + + "github.com/jaegertracing/jaeger/model" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/proto" + "github.com/jaegertracing/jaeger/storage/spanstore" +) + +type GRPCClient struct { + client proto.StoragePluginClient +} + +func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { + resp, err := c.client.GetTrace(ctx, &proto.GetTraceRequest{ + TraceID: traceID, + }) + if err != nil { + return nil, fmt.Errorf("grpc error: %s", err) + } + + switch t := resp.Response.(type) { + case *proto.GetTraceResponse_Success: + return t.Success.Trace, nil + case *proto.GetTraceResponse_Error: + return nil, fmt.Errorf("plugin error: %s", t.Error.Message) + default: + panic("unreachable") + } +} + +func (c *GRPCClient) GetServices(ctx context.Context) ([]string, error) { + resp, err := c.client.GetServices(ctx, &proto.GetServicesRequest{}) + if err != nil { + return nil, fmt.Errorf("grpc error: %s", err) + } + + switch t := resp.Response.(type) { + case *proto.GetServicesResponse_Success: + return t.Success.Services, nil + case *proto.GetServicesResponse_Error: + return nil, fmt.Errorf("plugin error: %s", t.Error.Message) + default: + panic("unreachable") + } +} + +func (c *GRPCClient) GetOperations(ctx context.Context, service string) ([]string, error) { + resp, err := c.client.GetOperations(ctx, &proto.GetOperationsRequest{ + Service: service, + }) + if err != nil { + return nil, fmt.Errorf("grpc error: %s", err) + } + + switch t := resp.Response.(type) { + case *proto.GetOperationsResponse_Success: + return t.Success.Operations, nil + case *proto.GetOperationsResponse_Error: + return nil, fmt.Errorf("plugin error: %s", t.Error.Message) + default: + panic("unreachable") + } +} + +func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { + resp, err := c.client.FindTraces(context.Background(), &proto.FindTracesRequest{ + Query: &proto.TraceQueryParameters{ + ServiceName: query.ServiceName, + OperationName: query.OperationName, + Tags: query.Tags, + StartTimeMin: query.StartTimeMin, + StartTimeMax: query.StartTimeMax, + DurationMin: query.DurationMin, + DurationMax: query.DurationMax, + NumTraces: int32(query.NumTraces), + }, + }) + if err != nil { + return nil, fmt.Errorf("grpc error: %s", err) + } + + switch t := resp.Response.(type) { + case *proto.FindTracesResponse_Success: + return t.Success.Traces, nil + case *proto.FindTracesResponse_Error: + return nil, fmt.Errorf("plugin error: %s", t.Error.Message) + default: + panic("unreachable") + } +} + +func (c *GRPCClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { + resp, err := c.client.FindTraceIDs(context.Background(), &proto.FindTraceIDsRequest{ + Query: &proto.TraceQueryParameters{ + ServiceName: query.ServiceName, + OperationName: query.OperationName, + Tags: query.Tags, + StartTimeMin: query.StartTimeMin, + StartTimeMax: query.StartTimeMax, + DurationMin: query.DurationMin, + DurationMax: query.DurationMax, + NumTraces: int32(query.NumTraces), + }, + }) + if err != nil { + return nil, fmt.Errorf("grpc error: %s", err) + } + + switch t := resp.Response.(type) { + case *proto.FindTraceIDsResponse_Success: + return t.Success.TraceIDs, nil + case *proto.FindTraceIDsResponse_Error: + return nil, fmt.Errorf("plugin error: %s", t.Error.Message) + default: + panic("unreachable") + } +} + +func (c *GRPCClient) WriteSpan(span *model.Span) error { + resp, err := c.client.WriteSpan(context.Background(), &proto.WriteSpanRequest{ + Span: span, + }) + if err != nil { + return fmt.Errorf("grpc error: %s", err) + } + + switch t := resp.Response.(type) { + case *proto.WriteSpanResponse_Success: + return nil + case *proto.WriteSpanResponse_Error: + return fmt.Errorf("plugin error: %s", t.Error.Message) + default: + panic("unreachable") + } +} + +func (c *GRPCClient) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { + resp, err := c.client.GetDependencies(context.Background(), &proto.GetDependenciesRequest{ + EndTimestamp: endTs, + Lookback: lookback, + }) + if err != nil { + return nil, fmt.Errorf("grpc error: %s", err) + } + + switch t := resp.Response.(type) { + case *proto.GetDependenciesResponse_Success: + return t.Success.Dependencies, nil + case *proto.GetDependenciesResponse_Error: + return nil, fmt.Errorf("plugin error: %s", t.Error.Message) + default: + panic("unreachable") + } +} + +type GRPCServer struct { + Impl StoragePlugin +} + + +func (s *GRPCServer) GetDependencies(ctx context.Context, r *proto.GetDependenciesRequest) (*proto.GetDependenciesResponse, error) { + deps, err := s.Impl.GetDependencies(r.EndTimestamp, r.Lookback) + if err != nil { + return &proto.GetDependenciesResponse{ + Response: &proto.GetDependenciesResponse_Error{ + Error: &proto.StoragePluginError{ + Message: err.Error(), + }, + }, + }, nil + } + return &proto.GetDependenciesResponse{ + Response: &proto.GetDependenciesResponse_Success{ + Success: &proto.GetDependenciesSuccess{ + Dependencies: deps, + }, + }, + }, nil +} + +func (s *GRPCServer) WriteSpan(ctx context.Context, r *proto.WriteSpanRequest) (*proto.WriteSpanResponse, error) { + err := s.Impl.WriteSpan(r.Span) + if err != nil { + return &proto.WriteSpanResponse{ + Response: &proto.WriteSpanResponse_Error{ + Error: &proto.StoragePluginError{ + Message: err.Error(), + }, + }, + }, nil + } + return &proto.WriteSpanResponse{ + Response: &proto.WriteSpanResponse_Success{ + Success: &proto.EmptyResponse{}, + }, + }, nil +} + +func (s *GRPCServer) GetTrace(ctx context.Context, r *proto.GetTraceRequest) (*proto.GetTraceResponse, error) { + trace, err := s.Impl.GetTrace(ctx, r.TraceID) + if err != nil { + return &proto.GetTraceResponse{ + Response: &proto.GetTraceResponse_Error{ + Error: &proto.StoragePluginError{ + Message: err.Error(), + }, + }, + }, nil + } + return &proto.GetTraceResponse{ + Response: &proto.GetTraceResponse_Success{ + Success: &proto.GetTraceSuccess{ + Trace: trace, + }, + }, + }, nil +} + +func (s *GRPCServer) GetServices(ctx context.Context, r *proto.GetServicesRequest) (*proto.GetServicesResponse, error) { + services, err := s.Impl.GetServices(ctx) + if err != nil { + return &proto.GetServicesResponse{ + Response: &proto.GetServicesResponse_Error{ + Error: &proto.StoragePluginError{ + Message: err.Error(), + }, + }, + }, nil + } + return &proto.GetServicesResponse{ + Response: &proto.GetServicesResponse_Success{ + Success: &proto.GetServicesSuccess{ + Services: services, + }, + }, + }, nil +} + +func (s *GRPCServer) GetOperations(ctx context.Context, r *proto.GetOperationsRequest) (*proto.GetOperationsResponse, error) { + operations, err := s.Impl.GetOperations(ctx, r.Service) + if err != nil { + return &proto.GetOperationsResponse{ + Response: &proto.GetOperationsResponse_Error{ + Error: &proto.StoragePluginError{ + Message: err.Error(), + }, + }, + }, nil + } + return &proto.GetOperationsResponse{ + Response: &proto.GetOperationsResponse_Success{ + Success: &proto.GetOperationsSuccess{ + Operations: operations, + }, + }, + }, nil +} + +func (s *GRPCServer) FindTraces(ctx context.Context, r *proto.FindTracesRequest) (*proto.FindTracesResponse, error) { + traces, err := s.Impl.FindTraces(ctx, &spanstore.TraceQueryParameters{ + ServiceName: r.Query.ServiceName, + OperationName: r.Query.OperationName, + Tags: r.Query.Tags, + StartTimeMin: r.Query.StartTimeMin, + StartTimeMax: r.Query.StartTimeMax, + DurationMin: r.Query.DurationMin, + DurationMax: r.Query.DurationMax, + NumTraces: int(r.Query.NumTraces), + }) + if err != nil { + return &proto.FindTracesResponse{ + Response: &proto.FindTracesResponse_Error{ + Error: &proto.StoragePluginError{ + Message: err.Error(), + }, + }, + }, nil + } + return &proto.FindTracesResponse{ + Response: &proto.FindTracesResponse_Success{ + Success: &proto.FindTracesSuccess{ + Traces: traces, + }, + }, + }, nil +} + +func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *proto.FindTraceIDsRequest) (*proto.FindTraceIDsResponse, error) { + traceIDs, err := s.Impl.FindTraceIDs(ctx, &spanstore.TraceQueryParameters{ + ServiceName: r.Query.ServiceName, + OperationName: r.Query.OperationName, + Tags: r.Query.Tags, + StartTimeMin: r.Query.StartTimeMin, + StartTimeMax: r.Query.StartTimeMax, + DurationMin: r.Query.DurationMin, + DurationMax: r.Query.DurationMax, + NumTraces: int(r.Query.NumTraces), + }) + if err != nil { + return &proto.FindTraceIDsResponse{ + Response: &proto.FindTraceIDsResponse_Error{ + Error: &proto.StoragePluginError{ + Message: err.Error(), + }, + }, + }, nil + } + return &proto.FindTraceIDsResponse{ + Response: &proto.FindTraceIDsResponse_Success{ + Success: &proto.FindTraceIDsSuccess{ + TraceIDs: traceIDs, + }, + }, + }, nil +} + + diff --git a/plugin/storage/grpc/shared/interface.go b/plugin/storage/grpc/shared/interface.go new file mode 100644 index 00000000000..9b6ceeaff49 --- /dev/null +++ b/plugin/storage/grpc/shared/interface.go @@ -0,0 +1,64 @@ +// Copyright (c) 2018 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 shared + +import ( + "context" + "github.com/jaegertracing/jaeger/storage/dependencystore" + + "github.com/hashicorp/go-plugin" + "google.golang.org/grpc" + + "github.com/jaegertracing/jaeger/plugin/storage/grpc/proto" + "github.com/jaegertracing/jaeger/storage/spanstore" +) + +// StoragePluginIdentifier is the identifier that is shared by plugin and host. +const StoragePluginIdentifier = "storage_plugin" + +// Handshake is a common handshake that is shared by plugin and host. +var Handshake = plugin.HandshakeConfig{ + MagicCookieKey: "STORAGE_PLUGIN", + MagicCookieValue: "jaeger", +} + +// PluginMap is the map of plugins we can dispense. +var PluginMap = map[string]plugin.Plugin{ + StoragePluginIdentifier: &StorageGRPCPlugin{}, +} + +// StoragePlugin is the interface we're exposing as a plugin. +type StoragePlugin interface { + spanstore.Reader + spanstore.Writer + dependencystore.Reader +} + +// This is the implementation of plugin.GRPCPlugin so we can serve/consume this. +type StorageGRPCPlugin struct { + plugin.Plugin + // Concrete implementation, written in Go. This is only used for plugins + // that are written in Go. + Impl StoragePlugin +} + +func (p *StorageGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { + proto.RegisterStoragePluginServer(s, &GRPCServer{Impl: p.Impl}) + return nil +} + +func (*StorageGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) { + return &GRPCClient{client: proto.NewStoragePluginClient(c)}, nil +} From 1a21e65e5f1fc3eee4ff9b4f0deb3be89c3224dd Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Fri, 5 Apr 2019 13:55:53 +0100 Subject: [PATCH 02/30] Remove old generated storage file Signed-off-by: Charles Dixon --- plugin/storage/grpc/proto/storage.pb.go | 5327 ----------------------- 1 file changed, 5327 deletions(-) delete mode 100644 plugin/storage/grpc/proto/storage.pb.go diff --git a/plugin/storage/grpc/proto/storage.pb.go b/plugin/storage/grpc/proto/storage.pb.go deleted file mode 100644 index 480cb5669ce..00000000000 --- a/plugin/storage/grpc/proto/storage.pb.go +++ /dev/null @@ -1,5327 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: storage.proto - -/* - Package proto is a generated protocol buffer package. - - It is generated from these files: - storage.proto - - It has these top-level messages: - GetDependenciesRequest - GetDependenciesSuccess - GetDependenciesResponse - WriteSpanRequest - WriteSpanResponse - GetTraceRequest - GetTraceSuccess - GetTraceResponse - GetServicesRequest - GetServicesSuccess - GetServicesResponse - GetOperationsRequest - GetOperationsSuccess - GetOperationsResponse - TraceQueryParameters - FindTracesRequest - FindTracesSuccess - FindTracesResponse - FindTraceIDsRequest - FindTraceIDsSuccess - FindTraceIDsResponse - EmptyResponse - StoragePluginError -*/ -package proto - -import proto1 "github.com/gogo/protobuf/proto" -import golang_proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import jaeger_api_v2 "github.com/jaegertracing/jaeger/model" -import _ "github.com/gogo/protobuf/types" -import _ "github.com/gogo/protobuf/types" - -import time "time" -import github_com_jaegertracing_jaeger_model "github.com/jaegertracing/jaeger/model" - -import context "golang.org/x/net/context" -import grpc "google.golang.org/grpc" - -import types "github.com/gogo/protobuf/types" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto1.Marshal -var _ = golang_proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto1.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type GetDependenciesRequest struct { - EndTimestamp time.Time `protobuf:"bytes,1,opt,name=end_timestamp,json=endTimestamp,stdtime" json:"end_timestamp"` - Lookback time.Duration `protobuf:"bytes,2,opt,name=lookback,stdduration" json:"lookback"` -} - -func (m *GetDependenciesRequest) Reset() { *m = GetDependenciesRequest{} } -func (m *GetDependenciesRequest) String() string { return proto1.CompactTextString(m) } -func (*GetDependenciesRequest) ProtoMessage() {} -func (*GetDependenciesRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{0} } - -func (m *GetDependenciesRequest) GetEndTimestamp() time.Time { - if m != nil { - return m.EndTimestamp - } - return time.Time{} -} - -func (m *GetDependenciesRequest) GetLookback() time.Duration { - if m != nil { - return m.Lookback - } - return 0 -} - -type GetDependenciesSuccess struct { - Dependencies []github_com_jaegertracing_jaeger_model.DependencyLink `protobuf:"bytes,1,rep,name=dependencies,customtype=github.com/jaegertracing/jaeger/model.DependencyLink" json:"dependencies"` -} - -func (m *GetDependenciesSuccess) Reset() { *m = GetDependenciesSuccess{} } -func (m *GetDependenciesSuccess) String() string { return proto1.CompactTextString(m) } -func (*GetDependenciesSuccess) ProtoMessage() {} -func (*GetDependenciesSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{1} } - -type GetDependenciesResponse struct { - // Types that are valid to be assigned to Response: - // *GetDependenciesResponse_Success - // *GetDependenciesResponse_Error - Response isGetDependenciesResponse_Response `protobuf_oneof:"response"` -} - -func (m *GetDependenciesResponse) Reset() { *m = GetDependenciesResponse{} } -func (m *GetDependenciesResponse) String() string { return proto1.CompactTextString(m) } -func (*GetDependenciesResponse) ProtoMessage() {} -func (*GetDependenciesResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{2} } - -type isGetDependenciesResponse_Response interface { - isGetDependenciesResponse_Response() - MarshalTo([]byte) (int, error) - Size() int -} - -type GetDependenciesResponse_Success struct { - Success *GetDependenciesSuccess `protobuf:"bytes,1,opt,name=success,oneof"` -} -type GetDependenciesResponse_Error struct { - Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` -} - -func (*GetDependenciesResponse_Success) isGetDependenciesResponse_Response() {} -func (*GetDependenciesResponse_Error) isGetDependenciesResponse_Response() {} - -func (m *GetDependenciesResponse) GetResponse() isGetDependenciesResponse_Response { - if m != nil { - return m.Response - } - return nil -} - -func (m *GetDependenciesResponse) GetSuccess() *GetDependenciesSuccess { - if x, ok := m.GetResponse().(*GetDependenciesResponse_Success); ok { - return x.Success - } - return nil -} - -func (m *GetDependenciesResponse) GetError() *StoragePluginError { - if x, ok := m.GetResponse().(*GetDependenciesResponse_Error); ok { - return x.Error - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*GetDependenciesResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { - return _GetDependenciesResponse_OneofMarshaler, _GetDependenciesResponse_OneofUnmarshaler, _GetDependenciesResponse_OneofSizer, []interface{}{ - (*GetDependenciesResponse_Success)(nil), - (*GetDependenciesResponse_Error)(nil), - } -} - -func _GetDependenciesResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { - m := msg.(*GetDependenciesResponse) - // response - switch x := m.Response.(type) { - case *GetDependenciesResponse_Success: - _ = b.EncodeVarint(1<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Success); err != nil { - return err - } - case *GetDependenciesResponse_Error: - _ = b.EncodeVarint(2<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Error); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("GetDependenciesResponse.Response has unexpected type %T", x) - } - return nil -} - -func _GetDependenciesResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { - m := msg.(*GetDependenciesResponse) - switch tag { - case 1: // response.success - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(GetDependenciesSuccess) - err := b.DecodeMessage(msg) - m.Response = &GetDependenciesResponse_Success{msg} - return true, err - case 2: // response.error - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(StoragePluginError) - err := b.DecodeMessage(msg) - m.Response = &GetDependenciesResponse_Error{msg} - return true, err - default: - return false, nil - } -} - -func _GetDependenciesResponse_OneofSizer(msg proto1.Message) (n int) { - m := msg.(*GetDependenciesResponse) - // response - switch x := m.Response.(type) { - case *GetDependenciesResponse_Success: - s := proto1.Size(x.Success) - n += proto1.SizeVarint(1<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case *GetDependenciesResponse_Error: - s := proto1.Size(x.Error) - n += proto1.SizeVarint(2<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type WriteSpanRequest struct { - Span *jaeger_api_v2.Span `protobuf:"bytes,1,opt,name=span" json:"span,omitempty"` -} - -func (m *WriteSpanRequest) Reset() { *m = WriteSpanRequest{} } -func (m *WriteSpanRequest) String() string { return proto1.CompactTextString(m) } -func (*WriteSpanRequest) ProtoMessage() {} -func (*WriteSpanRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{3} } - -func (m *WriteSpanRequest) GetSpan() *jaeger_api_v2.Span { - if m != nil { - return m.Span - } - return nil -} - -type WriteSpanResponse struct { - // Types that are valid to be assigned to Response: - // *WriteSpanResponse_Success - // *WriteSpanResponse_Error - Response isWriteSpanResponse_Response `protobuf_oneof:"response"` -} - -func (m *WriteSpanResponse) Reset() { *m = WriteSpanResponse{} } -func (m *WriteSpanResponse) String() string { return proto1.CompactTextString(m) } -func (*WriteSpanResponse) ProtoMessage() {} -func (*WriteSpanResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{4} } - -type isWriteSpanResponse_Response interface { - isWriteSpanResponse_Response() - MarshalTo([]byte) (int, error) - Size() int -} - -type WriteSpanResponse_Success struct { - Success *EmptyResponse `protobuf:"bytes,1,opt,name=success,oneof"` -} -type WriteSpanResponse_Error struct { - Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` -} - -func (*WriteSpanResponse_Success) isWriteSpanResponse_Response() {} -func (*WriteSpanResponse_Error) isWriteSpanResponse_Response() {} - -func (m *WriteSpanResponse) GetResponse() isWriteSpanResponse_Response { - if m != nil { - return m.Response - } - return nil -} - -func (m *WriteSpanResponse) GetSuccess() *EmptyResponse { - if x, ok := m.GetResponse().(*WriteSpanResponse_Success); ok { - return x.Success - } - return nil -} - -func (m *WriteSpanResponse) GetError() *StoragePluginError { - if x, ok := m.GetResponse().(*WriteSpanResponse_Error); ok { - return x.Error - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*WriteSpanResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { - return _WriteSpanResponse_OneofMarshaler, _WriteSpanResponse_OneofUnmarshaler, _WriteSpanResponse_OneofSizer, []interface{}{ - (*WriteSpanResponse_Success)(nil), - (*WriteSpanResponse_Error)(nil), - } -} - -func _WriteSpanResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { - m := msg.(*WriteSpanResponse) - // response - switch x := m.Response.(type) { - case *WriteSpanResponse_Success: - _ = b.EncodeVarint(1<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Success); err != nil { - return err - } - case *WriteSpanResponse_Error: - _ = b.EncodeVarint(2<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Error); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("WriteSpanResponse.Response has unexpected type %T", x) - } - return nil -} - -func _WriteSpanResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { - m := msg.(*WriteSpanResponse) - switch tag { - case 1: // response.success - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(EmptyResponse) - err := b.DecodeMessage(msg) - m.Response = &WriteSpanResponse_Success{msg} - return true, err - case 2: // response.error - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(StoragePluginError) - err := b.DecodeMessage(msg) - m.Response = &WriteSpanResponse_Error{msg} - return true, err - default: - return false, nil - } -} - -func _WriteSpanResponse_OneofSizer(msg proto1.Message) (n int) { - m := msg.(*WriteSpanResponse) - // response - switch x := m.Response.(type) { - case *WriteSpanResponse_Success: - s := proto1.Size(x.Success) - n += proto1.SizeVarint(1<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case *WriteSpanResponse_Error: - s := proto1.Size(x.Error) - n += proto1.SizeVarint(2<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type GetTraceRequest struct { - TraceID github_com_jaegertracing_jaeger_model.TraceID `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3,customtype=github.com/jaegertracing/jaeger/model.TraceID" json:"trace_id"` -} - -func (m *GetTraceRequest) Reset() { *m = GetTraceRequest{} } -func (m *GetTraceRequest) String() string { return proto1.CompactTextString(m) } -func (*GetTraceRequest) ProtoMessage() {} -func (*GetTraceRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{5} } - -type GetTraceSuccess struct { - Trace *jaeger_api_v2.Trace `protobuf:"bytes,1,opt,name=trace" json:"trace,omitempty"` -} - -func (m *GetTraceSuccess) Reset() { *m = GetTraceSuccess{} } -func (m *GetTraceSuccess) String() string { return proto1.CompactTextString(m) } -func (*GetTraceSuccess) ProtoMessage() {} -func (*GetTraceSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{6} } - -func (m *GetTraceSuccess) GetTrace() *jaeger_api_v2.Trace { - if m != nil { - return m.Trace - } - return nil -} - -type GetTraceResponse struct { - // Types that are valid to be assigned to Response: - // *GetTraceResponse_Success - // *GetTraceResponse_Error - Response isGetTraceResponse_Response `protobuf_oneof:"response"` -} - -func (m *GetTraceResponse) Reset() { *m = GetTraceResponse{} } -func (m *GetTraceResponse) String() string { return proto1.CompactTextString(m) } -func (*GetTraceResponse) ProtoMessage() {} -func (*GetTraceResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{7} } - -type isGetTraceResponse_Response interface { - isGetTraceResponse_Response() - MarshalTo([]byte) (int, error) - Size() int -} - -type GetTraceResponse_Success struct { - Success *GetTraceSuccess `protobuf:"bytes,1,opt,name=success,oneof"` -} -type GetTraceResponse_Error struct { - Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` -} - -func (*GetTraceResponse_Success) isGetTraceResponse_Response() {} -func (*GetTraceResponse_Error) isGetTraceResponse_Response() {} - -func (m *GetTraceResponse) GetResponse() isGetTraceResponse_Response { - if m != nil { - return m.Response - } - return nil -} - -func (m *GetTraceResponse) GetSuccess() *GetTraceSuccess { - if x, ok := m.GetResponse().(*GetTraceResponse_Success); ok { - return x.Success - } - return nil -} - -func (m *GetTraceResponse) GetError() *StoragePluginError { - if x, ok := m.GetResponse().(*GetTraceResponse_Error); ok { - return x.Error - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*GetTraceResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { - return _GetTraceResponse_OneofMarshaler, _GetTraceResponse_OneofUnmarshaler, _GetTraceResponse_OneofSizer, []interface{}{ - (*GetTraceResponse_Success)(nil), - (*GetTraceResponse_Error)(nil), - } -} - -func _GetTraceResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { - m := msg.(*GetTraceResponse) - // response - switch x := m.Response.(type) { - case *GetTraceResponse_Success: - _ = b.EncodeVarint(1<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Success); err != nil { - return err - } - case *GetTraceResponse_Error: - _ = b.EncodeVarint(2<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Error); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("GetTraceResponse.Response has unexpected type %T", x) - } - return nil -} - -func _GetTraceResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { - m := msg.(*GetTraceResponse) - switch tag { - case 1: // response.success - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(GetTraceSuccess) - err := b.DecodeMessage(msg) - m.Response = &GetTraceResponse_Success{msg} - return true, err - case 2: // response.error - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(StoragePluginError) - err := b.DecodeMessage(msg) - m.Response = &GetTraceResponse_Error{msg} - return true, err - default: - return false, nil - } -} - -func _GetTraceResponse_OneofSizer(msg proto1.Message) (n int) { - m := msg.(*GetTraceResponse) - // response - switch x := m.Response.(type) { - case *GetTraceResponse_Success: - s := proto1.Size(x.Success) - n += proto1.SizeVarint(1<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case *GetTraceResponse_Error: - s := proto1.Size(x.Error) - n += proto1.SizeVarint(2<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type GetServicesRequest struct { -} - -func (m *GetServicesRequest) Reset() { *m = GetServicesRequest{} } -func (m *GetServicesRequest) String() string { return proto1.CompactTextString(m) } -func (*GetServicesRequest) ProtoMessage() {} -func (*GetServicesRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{8} } - -type GetServicesSuccess struct { - Services []string `protobuf:"bytes,1,rep,name=services" json:"services,omitempty"` -} - -func (m *GetServicesSuccess) Reset() { *m = GetServicesSuccess{} } -func (m *GetServicesSuccess) String() string { return proto1.CompactTextString(m) } -func (*GetServicesSuccess) ProtoMessage() {} -func (*GetServicesSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{9} } - -func (m *GetServicesSuccess) GetServices() []string { - if m != nil { - return m.Services - } - return nil -} - -type GetServicesResponse struct { - // Types that are valid to be assigned to Response: - // *GetServicesResponse_Success - // *GetServicesResponse_Error - Response isGetServicesResponse_Response `protobuf_oneof:"response"` -} - -func (m *GetServicesResponse) Reset() { *m = GetServicesResponse{} } -func (m *GetServicesResponse) String() string { return proto1.CompactTextString(m) } -func (*GetServicesResponse) ProtoMessage() {} -func (*GetServicesResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{10} } - -type isGetServicesResponse_Response interface { - isGetServicesResponse_Response() - MarshalTo([]byte) (int, error) - Size() int -} - -type GetServicesResponse_Success struct { - Success *GetServicesSuccess `protobuf:"bytes,1,opt,name=success,oneof"` -} -type GetServicesResponse_Error struct { - Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` -} - -func (*GetServicesResponse_Success) isGetServicesResponse_Response() {} -func (*GetServicesResponse_Error) isGetServicesResponse_Response() {} - -func (m *GetServicesResponse) GetResponse() isGetServicesResponse_Response { - if m != nil { - return m.Response - } - return nil -} - -func (m *GetServicesResponse) GetSuccess() *GetServicesSuccess { - if x, ok := m.GetResponse().(*GetServicesResponse_Success); ok { - return x.Success - } - return nil -} - -func (m *GetServicesResponse) GetError() *StoragePluginError { - if x, ok := m.GetResponse().(*GetServicesResponse_Error); ok { - return x.Error - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*GetServicesResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { - return _GetServicesResponse_OneofMarshaler, _GetServicesResponse_OneofUnmarshaler, _GetServicesResponse_OneofSizer, []interface{}{ - (*GetServicesResponse_Success)(nil), - (*GetServicesResponse_Error)(nil), - } -} - -func _GetServicesResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { - m := msg.(*GetServicesResponse) - // response - switch x := m.Response.(type) { - case *GetServicesResponse_Success: - _ = b.EncodeVarint(1<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Success); err != nil { - return err - } - case *GetServicesResponse_Error: - _ = b.EncodeVarint(2<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Error); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("GetServicesResponse.Response has unexpected type %T", x) - } - return nil -} - -func _GetServicesResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { - m := msg.(*GetServicesResponse) - switch tag { - case 1: // response.success - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(GetServicesSuccess) - err := b.DecodeMessage(msg) - m.Response = &GetServicesResponse_Success{msg} - return true, err - case 2: // response.error - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(StoragePluginError) - err := b.DecodeMessage(msg) - m.Response = &GetServicesResponse_Error{msg} - return true, err - default: - return false, nil - } -} - -func _GetServicesResponse_OneofSizer(msg proto1.Message) (n int) { - m := msg.(*GetServicesResponse) - // response - switch x := m.Response.(type) { - case *GetServicesResponse_Success: - s := proto1.Size(x.Success) - n += proto1.SizeVarint(1<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case *GetServicesResponse_Error: - s := proto1.Size(x.Error) - n += proto1.SizeVarint(2<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type GetOperationsRequest struct { - Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` -} - -func (m *GetOperationsRequest) Reset() { *m = GetOperationsRequest{} } -func (m *GetOperationsRequest) String() string { return proto1.CompactTextString(m) } -func (*GetOperationsRequest) ProtoMessage() {} -func (*GetOperationsRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{11} } - -func (m *GetOperationsRequest) GetService() string { - if m != nil { - return m.Service - } - return "" -} - -type GetOperationsSuccess struct { - Operations []string `protobuf:"bytes,1,rep,name=operations" json:"operations,omitempty"` -} - -func (m *GetOperationsSuccess) Reset() { *m = GetOperationsSuccess{} } -func (m *GetOperationsSuccess) String() string { return proto1.CompactTextString(m) } -func (*GetOperationsSuccess) ProtoMessage() {} -func (*GetOperationsSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{12} } - -func (m *GetOperationsSuccess) GetOperations() []string { - if m != nil { - return m.Operations - } - return nil -} - -type GetOperationsResponse struct { - // Types that are valid to be assigned to Response: - // *GetOperationsResponse_Success - // *GetOperationsResponse_Error - Response isGetOperationsResponse_Response `protobuf_oneof:"response"` -} - -func (m *GetOperationsResponse) Reset() { *m = GetOperationsResponse{} } -func (m *GetOperationsResponse) String() string { return proto1.CompactTextString(m) } -func (*GetOperationsResponse) ProtoMessage() {} -func (*GetOperationsResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{13} } - -type isGetOperationsResponse_Response interface { - isGetOperationsResponse_Response() - MarshalTo([]byte) (int, error) - Size() int -} - -type GetOperationsResponse_Success struct { - Success *GetOperationsSuccess `protobuf:"bytes,1,opt,name=success,oneof"` -} -type GetOperationsResponse_Error struct { - Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` -} - -func (*GetOperationsResponse_Success) isGetOperationsResponse_Response() {} -func (*GetOperationsResponse_Error) isGetOperationsResponse_Response() {} - -func (m *GetOperationsResponse) GetResponse() isGetOperationsResponse_Response { - if m != nil { - return m.Response - } - return nil -} - -func (m *GetOperationsResponse) GetSuccess() *GetOperationsSuccess { - if x, ok := m.GetResponse().(*GetOperationsResponse_Success); ok { - return x.Success - } - return nil -} - -func (m *GetOperationsResponse) GetError() *StoragePluginError { - if x, ok := m.GetResponse().(*GetOperationsResponse_Error); ok { - return x.Error - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*GetOperationsResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { - return _GetOperationsResponse_OneofMarshaler, _GetOperationsResponse_OneofUnmarshaler, _GetOperationsResponse_OneofSizer, []interface{}{ - (*GetOperationsResponse_Success)(nil), - (*GetOperationsResponse_Error)(nil), - } -} - -func _GetOperationsResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { - m := msg.(*GetOperationsResponse) - // response - switch x := m.Response.(type) { - case *GetOperationsResponse_Success: - _ = b.EncodeVarint(1<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Success); err != nil { - return err - } - case *GetOperationsResponse_Error: - _ = b.EncodeVarint(2<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Error); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("GetOperationsResponse.Response has unexpected type %T", x) - } - return nil -} - -func _GetOperationsResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { - m := msg.(*GetOperationsResponse) - switch tag { - case 1: // response.success - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(GetOperationsSuccess) - err := b.DecodeMessage(msg) - m.Response = &GetOperationsResponse_Success{msg} - return true, err - case 2: // response.error - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(StoragePluginError) - err := b.DecodeMessage(msg) - m.Response = &GetOperationsResponse_Error{msg} - return true, err - default: - return false, nil - } -} - -func _GetOperationsResponse_OneofSizer(msg proto1.Message) (n int) { - m := msg.(*GetOperationsResponse) - // response - switch x := m.Response.(type) { - case *GetOperationsResponse_Success: - s := proto1.Size(x.Success) - n += proto1.SizeVarint(1<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case *GetOperationsResponse_Error: - s := proto1.Size(x.Error) - n += proto1.SizeVarint(2<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type TraceQueryParameters struct { - ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` - OperationName string `protobuf:"bytes,2,opt,name=operation_name,json=operationName,proto3" json:"operation_name,omitempty"` - Tags map[string]string `protobuf:"bytes,3,rep,name=tags" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - StartTimeMin time.Time `protobuf:"bytes,4,opt,name=start_time_min,json=startTimeMin,stdtime" json:"start_time_min"` - StartTimeMax time.Time `protobuf:"bytes,5,opt,name=start_time_max,json=startTimeMax,stdtime" json:"start_time_max"` - DurationMin time.Duration `protobuf:"bytes,6,opt,name=duration_min,json=durationMin,stdduration" json:"duration_min"` - DurationMax time.Duration `protobuf:"bytes,7,opt,name=duration_max,json=durationMax,stdduration" json:"duration_max"` - NumTraces int32 `protobuf:"varint,8,opt,name=num_traces,json=numTraces,proto3" json:"num_traces,omitempty"` -} - -func (m *TraceQueryParameters) Reset() { *m = TraceQueryParameters{} } -func (m *TraceQueryParameters) String() string { return proto1.CompactTextString(m) } -func (*TraceQueryParameters) ProtoMessage() {} -func (*TraceQueryParameters) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{14} } - -func (m *TraceQueryParameters) GetServiceName() string { - if m != nil { - return m.ServiceName - } - return "" -} - -func (m *TraceQueryParameters) GetOperationName() string { - if m != nil { - return m.OperationName - } - return "" -} - -func (m *TraceQueryParameters) GetTags() map[string]string { - if m != nil { - return m.Tags - } - return nil -} - -func (m *TraceQueryParameters) GetStartTimeMin() time.Time { - if m != nil { - return m.StartTimeMin - } - return time.Time{} -} - -func (m *TraceQueryParameters) GetStartTimeMax() time.Time { - if m != nil { - return m.StartTimeMax - } - return time.Time{} -} - -func (m *TraceQueryParameters) GetDurationMin() time.Duration { - if m != nil { - return m.DurationMin - } - return 0 -} - -func (m *TraceQueryParameters) GetDurationMax() time.Duration { - if m != nil { - return m.DurationMax - } - return 0 -} - -func (m *TraceQueryParameters) GetNumTraces() int32 { - if m != nil { - return m.NumTraces - } - return 0 -} - -type FindTracesRequest struct { - Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"` -} - -func (m *FindTracesRequest) Reset() { *m = FindTracesRequest{} } -func (m *FindTracesRequest) String() string { return proto1.CompactTextString(m) } -func (*FindTracesRequest) ProtoMessage() {} -func (*FindTracesRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{15} } - -func (m *FindTracesRequest) GetQuery() *TraceQueryParameters { - if m != nil { - return m.Query - } - return nil -} - -type FindTracesSuccess struct { - Traces []*jaeger_api_v2.Trace `protobuf:"bytes,1,rep,name=traces" json:"traces,omitempty"` -} - -func (m *FindTracesSuccess) Reset() { *m = FindTracesSuccess{} } -func (m *FindTracesSuccess) String() string { return proto1.CompactTextString(m) } -func (*FindTracesSuccess) ProtoMessage() {} -func (*FindTracesSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{16} } - -func (m *FindTracesSuccess) GetTraces() []*jaeger_api_v2.Trace { - if m != nil { - return m.Traces - } - return nil -} - -type FindTracesResponse struct { - // Types that are valid to be assigned to Response: - // *FindTracesResponse_Success - // *FindTracesResponse_Error - Response isFindTracesResponse_Response `protobuf_oneof:"response"` -} - -func (m *FindTracesResponse) Reset() { *m = FindTracesResponse{} } -func (m *FindTracesResponse) String() string { return proto1.CompactTextString(m) } -func (*FindTracesResponse) ProtoMessage() {} -func (*FindTracesResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{17} } - -type isFindTracesResponse_Response interface { - isFindTracesResponse_Response() - MarshalTo([]byte) (int, error) - Size() int -} - -type FindTracesResponse_Success struct { - Success *FindTracesSuccess `protobuf:"bytes,1,opt,name=success,oneof"` -} -type FindTracesResponse_Error struct { - Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` -} - -func (*FindTracesResponse_Success) isFindTracesResponse_Response() {} -func (*FindTracesResponse_Error) isFindTracesResponse_Response() {} - -func (m *FindTracesResponse) GetResponse() isFindTracesResponse_Response { - if m != nil { - return m.Response - } - return nil -} - -func (m *FindTracesResponse) GetSuccess() *FindTracesSuccess { - if x, ok := m.GetResponse().(*FindTracesResponse_Success); ok { - return x.Success - } - return nil -} - -func (m *FindTracesResponse) GetError() *StoragePluginError { - if x, ok := m.GetResponse().(*FindTracesResponse_Error); ok { - return x.Error - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*FindTracesResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { - return _FindTracesResponse_OneofMarshaler, _FindTracesResponse_OneofUnmarshaler, _FindTracesResponse_OneofSizer, []interface{}{ - (*FindTracesResponse_Success)(nil), - (*FindTracesResponse_Error)(nil), - } -} - -func _FindTracesResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { - m := msg.(*FindTracesResponse) - // response - switch x := m.Response.(type) { - case *FindTracesResponse_Success: - _ = b.EncodeVarint(1<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Success); err != nil { - return err - } - case *FindTracesResponse_Error: - _ = b.EncodeVarint(2<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Error); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("FindTracesResponse.Response has unexpected type %T", x) - } - return nil -} - -func _FindTracesResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { - m := msg.(*FindTracesResponse) - switch tag { - case 1: // response.success - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(FindTracesSuccess) - err := b.DecodeMessage(msg) - m.Response = &FindTracesResponse_Success{msg} - return true, err - case 2: // response.error - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(StoragePluginError) - err := b.DecodeMessage(msg) - m.Response = &FindTracesResponse_Error{msg} - return true, err - default: - return false, nil - } -} - -func _FindTracesResponse_OneofSizer(msg proto1.Message) (n int) { - m := msg.(*FindTracesResponse) - // response - switch x := m.Response.(type) { - case *FindTracesResponse_Success: - s := proto1.Size(x.Success) - n += proto1.SizeVarint(1<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case *FindTracesResponse_Error: - s := proto1.Size(x.Error) - n += proto1.SizeVarint(2<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type FindTraceIDsRequest struct { - Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"` -} - -func (m *FindTraceIDsRequest) Reset() { *m = FindTraceIDsRequest{} } -func (m *FindTraceIDsRequest) String() string { return proto1.CompactTextString(m) } -func (*FindTraceIDsRequest) ProtoMessage() {} -func (*FindTraceIDsRequest) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{18} } - -func (m *FindTraceIDsRequest) GetQuery() *TraceQueryParameters { - if m != nil { - return m.Query - } - return nil -} - -type FindTraceIDsSuccess struct { - TraceIDs []github_com_jaegertracing_jaeger_model.TraceID `protobuf:"bytes,1,rep,name=trace_id,json=traceId,customtype=github.com/jaegertracing/jaeger/model.TraceID" json:"trace_id"` -} - -func (m *FindTraceIDsSuccess) Reset() { *m = FindTraceIDsSuccess{} } -func (m *FindTraceIDsSuccess) String() string { return proto1.CompactTextString(m) } -func (*FindTraceIDsSuccess) ProtoMessage() {} -func (*FindTraceIDsSuccess) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{19} } - -type FindTraceIDsResponse struct { - // Types that are valid to be assigned to Response: - // *FindTraceIDsResponse_Success - // *FindTraceIDsResponse_Error - Response isFindTraceIDsResponse_Response `protobuf_oneof:"response"` -} - -func (m *FindTraceIDsResponse) Reset() { *m = FindTraceIDsResponse{} } -func (m *FindTraceIDsResponse) String() string { return proto1.CompactTextString(m) } -func (*FindTraceIDsResponse) ProtoMessage() {} -func (*FindTraceIDsResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{20} } - -type isFindTraceIDsResponse_Response interface { - isFindTraceIDsResponse_Response() - MarshalTo([]byte) (int, error) - Size() int -} - -type FindTraceIDsResponse_Success struct { - Success *FindTraceIDsSuccess `protobuf:"bytes,1,opt,name=success,oneof"` -} -type FindTraceIDsResponse_Error struct { - Error *StoragePluginError `protobuf:"bytes,2,opt,name=error,oneof"` -} - -func (*FindTraceIDsResponse_Success) isFindTraceIDsResponse_Response() {} -func (*FindTraceIDsResponse_Error) isFindTraceIDsResponse_Response() {} - -func (m *FindTraceIDsResponse) GetResponse() isFindTraceIDsResponse_Response { - if m != nil { - return m.Response - } - return nil -} - -func (m *FindTraceIDsResponse) GetSuccess() *FindTraceIDsSuccess { - if x, ok := m.GetResponse().(*FindTraceIDsResponse_Success); ok { - return x.Success - } - return nil -} - -func (m *FindTraceIDsResponse) GetError() *StoragePluginError { - if x, ok := m.GetResponse().(*FindTraceIDsResponse_Error); ok { - return x.Error - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*FindTraceIDsResponse) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { - return _FindTraceIDsResponse_OneofMarshaler, _FindTraceIDsResponse_OneofUnmarshaler, _FindTraceIDsResponse_OneofSizer, []interface{}{ - (*FindTraceIDsResponse_Success)(nil), - (*FindTraceIDsResponse_Error)(nil), - } -} - -func _FindTraceIDsResponse_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { - m := msg.(*FindTraceIDsResponse) - // response - switch x := m.Response.(type) { - case *FindTraceIDsResponse_Success: - _ = b.EncodeVarint(1<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Success); err != nil { - return err - } - case *FindTraceIDsResponse_Error: - _ = b.EncodeVarint(2<<3 | proto1.WireBytes) - if err := b.EncodeMessage(x.Error); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("FindTraceIDsResponse.Response has unexpected type %T", x) - } - return nil -} - -func _FindTraceIDsResponse_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { - m := msg.(*FindTraceIDsResponse) - switch tag { - case 1: // response.success - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(FindTraceIDsSuccess) - err := b.DecodeMessage(msg) - m.Response = &FindTraceIDsResponse_Success{msg} - return true, err - case 2: // response.error - if wire != proto1.WireBytes { - return true, proto1.ErrInternalBadWireType - } - msg := new(StoragePluginError) - err := b.DecodeMessage(msg) - m.Response = &FindTraceIDsResponse_Error{msg} - return true, err - default: - return false, nil - } -} - -func _FindTraceIDsResponse_OneofSizer(msg proto1.Message) (n int) { - m := msg.(*FindTraceIDsResponse) - // response - switch x := m.Response.(type) { - case *FindTraceIDsResponse_Success: - s := proto1.Size(x.Success) - n += proto1.SizeVarint(1<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case *FindTraceIDsResponse_Error: - s := proto1.Size(x.Error) - n += proto1.SizeVarint(2<<3 | proto1.WireBytes) - n += proto1.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type EmptyResponse struct { -} - -func (m *EmptyResponse) Reset() { *m = EmptyResponse{} } -func (m *EmptyResponse) String() string { return proto1.CompactTextString(m) } -func (*EmptyResponse) ProtoMessage() {} -func (*EmptyResponse) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{21} } - -type StoragePluginError struct { - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` -} - -func (m *StoragePluginError) Reset() { *m = StoragePluginError{} } -func (m *StoragePluginError) String() string { return proto1.CompactTextString(m) } -func (*StoragePluginError) ProtoMessage() {} -func (*StoragePluginError) Descriptor() ([]byte, []int) { return fileDescriptorStorage, []int{22} } - -func (m *StoragePluginError) GetMessage() string { - if m != nil { - return m.Message - } - return "" -} - -func init() { - proto1.RegisterType((*GetDependenciesRequest)(nil), "jaeger.api_v2.GetDependenciesRequest") - golang_proto.RegisterType((*GetDependenciesRequest)(nil), "jaeger.api_v2.GetDependenciesRequest") - proto1.RegisterType((*GetDependenciesSuccess)(nil), "jaeger.api_v2.GetDependenciesSuccess") - golang_proto.RegisterType((*GetDependenciesSuccess)(nil), "jaeger.api_v2.GetDependenciesSuccess") - proto1.RegisterType((*GetDependenciesResponse)(nil), "jaeger.api_v2.GetDependenciesResponse") - golang_proto.RegisterType((*GetDependenciesResponse)(nil), "jaeger.api_v2.GetDependenciesResponse") - proto1.RegisterType((*WriteSpanRequest)(nil), "jaeger.api_v2.WriteSpanRequest") - golang_proto.RegisterType((*WriteSpanRequest)(nil), "jaeger.api_v2.WriteSpanRequest") - proto1.RegisterType((*WriteSpanResponse)(nil), "jaeger.api_v2.WriteSpanResponse") - golang_proto.RegisterType((*WriteSpanResponse)(nil), "jaeger.api_v2.WriteSpanResponse") - proto1.RegisterType((*GetTraceRequest)(nil), "jaeger.api_v2.GetTraceRequest") - golang_proto.RegisterType((*GetTraceRequest)(nil), "jaeger.api_v2.GetTraceRequest") - proto1.RegisterType((*GetTraceSuccess)(nil), "jaeger.api_v2.GetTraceSuccess") - golang_proto.RegisterType((*GetTraceSuccess)(nil), "jaeger.api_v2.GetTraceSuccess") - proto1.RegisterType((*GetTraceResponse)(nil), "jaeger.api_v2.GetTraceResponse") - golang_proto.RegisterType((*GetTraceResponse)(nil), "jaeger.api_v2.GetTraceResponse") - proto1.RegisterType((*GetServicesRequest)(nil), "jaeger.api_v2.GetServicesRequest") - golang_proto.RegisterType((*GetServicesRequest)(nil), "jaeger.api_v2.GetServicesRequest") - proto1.RegisterType((*GetServicesSuccess)(nil), "jaeger.api_v2.GetServicesSuccess") - golang_proto.RegisterType((*GetServicesSuccess)(nil), "jaeger.api_v2.GetServicesSuccess") - proto1.RegisterType((*GetServicesResponse)(nil), "jaeger.api_v2.GetServicesResponse") - golang_proto.RegisterType((*GetServicesResponse)(nil), "jaeger.api_v2.GetServicesResponse") - proto1.RegisterType((*GetOperationsRequest)(nil), "jaeger.api_v2.GetOperationsRequest") - golang_proto.RegisterType((*GetOperationsRequest)(nil), "jaeger.api_v2.GetOperationsRequest") - proto1.RegisterType((*GetOperationsSuccess)(nil), "jaeger.api_v2.GetOperationsSuccess") - golang_proto.RegisterType((*GetOperationsSuccess)(nil), "jaeger.api_v2.GetOperationsSuccess") - proto1.RegisterType((*GetOperationsResponse)(nil), "jaeger.api_v2.GetOperationsResponse") - golang_proto.RegisterType((*GetOperationsResponse)(nil), "jaeger.api_v2.GetOperationsResponse") - proto1.RegisterType((*TraceQueryParameters)(nil), "jaeger.api_v2.TraceQueryParameters") - golang_proto.RegisterType((*TraceQueryParameters)(nil), "jaeger.api_v2.TraceQueryParameters") - proto1.RegisterType((*FindTracesRequest)(nil), "jaeger.api_v2.FindTracesRequest") - golang_proto.RegisterType((*FindTracesRequest)(nil), "jaeger.api_v2.FindTracesRequest") - proto1.RegisterType((*FindTracesSuccess)(nil), "jaeger.api_v2.FindTracesSuccess") - golang_proto.RegisterType((*FindTracesSuccess)(nil), "jaeger.api_v2.FindTracesSuccess") - proto1.RegisterType((*FindTracesResponse)(nil), "jaeger.api_v2.FindTracesResponse") - golang_proto.RegisterType((*FindTracesResponse)(nil), "jaeger.api_v2.FindTracesResponse") - proto1.RegisterType((*FindTraceIDsRequest)(nil), "jaeger.api_v2.FindTraceIDsRequest") - golang_proto.RegisterType((*FindTraceIDsRequest)(nil), "jaeger.api_v2.FindTraceIDsRequest") - proto1.RegisterType((*FindTraceIDsSuccess)(nil), "jaeger.api_v2.FindTraceIDsSuccess") - golang_proto.RegisterType((*FindTraceIDsSuccess)(nil), "jaeger.api_v2.FindTraceIDsSuccess") - proto1.RegisterType((*FindTraceIDsResponse)(nil), "jaeger.api_v2.FindTraceIDsResponse") - golang_proto.RegisterType((*FindTraceIDsResponse)(nil), "jaeger.api_v2.FindTraceIDsResponse") - proto1.RegisterType((*EmptyResponse)(nil), "jaeger.api_v2.EmptyResponse") - golang_proto.RegisterType((*EmptyResponse)(nil), "jaeger.api_v2.EmptyResponse") - proto1.RegisterType((*StoragePluginError)(nil), "jaeger.api_v2.StoragePluginError") - golang_proto.RegisterType((*StoragePluginError)(nil), "jaeger.api_v2.StoragePluginError") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for StoragePlugin service - -type StoragePluginClient interface { - // dependencystore/Writer - // rpc WriteDependencies(WriteDependenciesRequest) returns (WriteDependenciesResponse); - // dependencystore/Reader - GetDependencies(ctx context.Context, in *GetDependenciesRequest, opts ...grpc.CallOption) (*GetDependenciesResponse, error) - // spanstore/Writer - WriteSpan(ctx context.Context, in *WriteSpanRequest, opts ...grpc.CallOption) (*WriteSpanResponse, error) - // spanstore/Reader - GetTrace(ctx context.Context, in *GetTraceRequest, opts ...grpc.CallOption) (*GetTraceResponse, error) - GetServices(ctx context.Context, in *GetServicesRequest, opts ...grpc.CallOption) (*GetServicesResponse, error) - GetOperations(ctx context.Context, in *GetOperationsRequest, opts ...grpc.CallOption) (*GetOperationsResponse, error) - FindTraces(ctx context.Context, in *FindTracesRequest, opts ...grpc.CallOption) (*FindTracesResponse, error) - FindTraceIDs(ctx context.Context, in *FindTraceIDsRequest, opts ...grpc.CallOption) (*FindTraceIDsResponse, error) -} - -type storagePluginClient struct { - cc *grpc.ClientConn -} - -func NewStoragePluginClient(cc *grpc.ClientConn) StoragePluginClient { - return &storagePluginClient{cc} -} - -func (c *storagePluginClient) GetDependencies(ctx context.Context, in *GetDependenciesRequest, opts ...grpc.CallOption) (*GetDependenciesResponse, error) { - out := new(GetDependenciesResponse) - err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/GetDependencies", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *storagePluginClient) WriteSpan(ctx context.Context, in *WriteSpanRequest, opts ...grpc.CallOption) (*WriteSpanResponse, error) { - out := new(WriteSpanResponse) - err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/WriteSpan", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *storagePluginClient) GetTrace(ctx context.Context, in *GetTraceRequest, opts ...grpc.CallOption) (*GetTraceResponse, error) { - out := new(GetTraceResponse) - err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/GetTrace", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *storagePluginClient) GetServices(ctx context.Context, in *GetServicesRequest, opts ...grpc.CallOption) (*GetServicesResponse, error) { - out := new(GetServicesResponse) - err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/GetServices", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *storagePluginClient) GetOperations(ctx context.Context, in *GetOperationsRequest, opts ...grpc.CallOption) (*GetOperationsResponse, error) { - out := new(GetOperationsResponse) - err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/GetOperations", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *storagePluginClient) FindTraces(ctx context.Context, in *FindTracesRequest, opts ...grpc.CallOption) (*FindTracesResponse, error) { - out := new(FindTracesResponse) - err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/FindTraces", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *storagePluginClient) FindTraceIDs(ctx context.Context, in *FindTraceIDsRequest, opts ...grpc.CallOption) (*FindTraceIDsResponse, error) { - out := new(FindTraceIDsResponse) - err := grpc.Invoke(ctx, "/jaeger.api_v2.StoragePlugin/FindTraceIDs", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for StoragePlugin service - -type StoragePluginServer interface { - // dependencystore/Writer - // rpc WriteDependencies(WriteDependenciesRequest) returns (WriteDependenciesResponse); - // dependencystore/Reader - GetDependencies(context.Context, *GetDependenciesRequest) (*GetDependenciesResponse, error) - // spanstore/Writer - WriteSpan(context.Context, *WriteSpanRequest) (*WriteSpanResponse, error) - // spanstore/Reader - GetTrace(context.Context, *GetTraceRequest) (*GetTraceResponse, error) - GetServices(context.Context, *GetServicesRequest) (*GetServicesResponse, error) - GetOperations(context.Context, *GetOperationsRequest) (*GetOperationsResponse, error) - FindTraces(context.Context, *FindTracesRequest) (*FindTracesResponse, error) - FindTraceIDs(context.Context, *FindTraceIDsRequest) (*FindTraceIDsResponse, error) -} - -func RegisterStoragePluginServer(s *grpc.Server, srv StoragePluginServer) { - s.RegisterService(&_StoragePlugin_serviceDesc, srv) -} - -func _StoragePlugin_GetDependencies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetDependenciesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StoragePluginServer).GetDependencies(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jaeger.api_v2.StoragePlugin/GetDependencies", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StoragePluginServer).GetDependencies(ctx, req.(*GetDependenciesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _StoragePlugin_WriteSpan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(WriteSpanRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StoragePluginServer).WriteSpan(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jaeger.api_v2.StoragePlugin/WriteSpan", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StoragePluginServer).WriteSpan(ctx, req.(*WriteSpanRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _StoragePlugin_GetTrace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetTraceRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StoragePluginServer).GetTrace(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jaeger.api_v2.StoragePlugin/GetTrace", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StoragePluginServer).GetTrace(ctx, req.(*GetTraceRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _StoragePlugin_GetServices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetServicesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StoragePluginServer).GetServices(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jaeger.api_v2.StoragePlugin/GetServices", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StoragePluginServer).GetServices(ctx, req.(*GetServicesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _StoragePlugin_GetOperations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetOperationsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StoragePluginServer).GetOperations(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jaeger.api_v2.StoragePlugin/GetOperations", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StoragePluginServer).GetOperations(ctx, req.(*GetOperationsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _StoragePlugin_FindTraces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FindTracesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StoragePluginServer).FindTraces(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jaeger.api_v2.StoragePlugin/FindTraces", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StoragePluginServer).FindTraces(ctx, req.(*FindTracesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _StoragePlugin_FindTraceIDs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FindTraceIDsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StoragePluginServer).FindTraceIDs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/jaeger.api_v2.StoragePlugin/FindTraceIDs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StoragePluginServer).FindTraceIDs(ctx, req.(*FindTraceIDsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _StoragePlugin_serviceDesc = grpc.ServiceDesc{ - ServiceName: "jaeger.api_v2.StoragePlugin", - HandlerType: (*StoragePluginServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetDependencies", - Handler: _StoragePlugin_GetDependencies_Handler, - }, - { - MethodName: "WriteSpan", - Handler: _StoragePlugin_WriteSpan_Handler, - }, - { - MethodName: "GetTrace", - Handler: _StoragePlugin_GetTrace_Handler, - }, - { - MethodName: "GetServices", - Handler: _StoragePlugin_GetServices_Handler, - }, - { - MethodName: "GetOperations", - Handler: _StoragePlugin_GetOperations_Handler, - }, - { - MethodName: "FindTraces", - Handler: _StoragePlugin_FindTraces_Handler, - }, - { - MethodName: "FindTraceIDs", - Handler: _StoragePlugin_FindTraceIDs_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "storage.proto", -} - -func (m *GetDependenciesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetDependenciesRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdTime(m.EndTimestamp))) - n1, err := types.StdTimeMarshalTo(m.EndTimestamp, dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdDuration(m.Lookback))) - n2, err := types.StdDurationMarshalTo(m.Lookback, dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - return i, nil -} - -func (m *GetDependenciesSuccess) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetDependenciesSuccess) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Dependencies) > 0 { - for _, msg := range m.Dependencies { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *GetDependenciesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetDependenciesResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Response != nil { - nn3, err := m.Response.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn3 - } - return i, nil -} - -func (m *GetDependenciesResponse_Success) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Success != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) - n4, err := m.Success.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } - return i, nil -} -func (m *GetDependenciesResponse_Error) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) - n5, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n5 - } - return i, nil -} -func (m *WriteSpanRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WriteSpanRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Span != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Span.Size())) - n6, err := m.Span.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n6 - } - return i, nil -} - -func (m *WriteSpanResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WriteSpanResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Response != nil { - nn7, err := m.Response.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn7 - } - return i, nil -} - -func (m *WriteSpanResponse_Success) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Success != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) - n8, err := m.Success.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n8 - } - return i, nil -} -func (m *WriteSpanResponse_Error) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) - n9, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n9 - } - return i, nil -} -func (m *GetTraceRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetTraceRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.TraceID.Size())) - n10, err := m.TraceID.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n10 - return i, nil -} - -func (m *GetTraceSuccess) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetTraceSuccess) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Trace != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Trace.Size())) - n11, err := m.Trace.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n11 - } - return i, nil -} - -func (m *GetTraceResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetTraceResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Response != nil { - nn12, err := m.Response.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn12 - } - return i, nil -} - -func (m *GetTraceResponse_Success) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Success != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) - n13, err := m.Success.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n13 - } - return i, nil -} -func (m *GetTraceResponse_Error) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) - n14, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n14 - } - return i, nil -} -func (m *GetServicesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetServicesRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func (m *GetServicesSuccess) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetServicesSuccess) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Services) > 0 { - for _, s := range m.Services { - dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - return i, nil -} - -func (m *GetServicesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetServicesResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Response != nil { - nn15, err := m.Response.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn15 - } - return i, nil -} - -func (m *GetServicesResponse_Success) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Success != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) - n16, err := m.Success.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n16 - } - return i, nil -} -func (m *GetServicesResponse_Error) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) - n17, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n17 - } - return i, nil -} -func (m *GetOperationsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetOperationsRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Service) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(m.Service))) - i += copy(dAtA[i:], m.Service) - } - return i, nil -} - -func (m *GetOperationsSuccess) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetOperationsSuccess) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Operations) > 0 { - for _, s := range m.Operations { - dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - return i, nil -} - -func (m *GetOperationsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetOperationsResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Response != nil { - nn18, err := m.Response.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn18 - } - return i, nil -} - -func (m *GetOperationsResponse_Success) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Success != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) - n19, err := m.Success.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n19 - } - return i, nil -} -func (m *GetOperationsResponse_Error) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) - n20, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n20 - } - return i, nil -} -func (m *TraceQueryParameters) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TraceQueryParameters) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.ServiceName) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(m.ServiceName))) - i += copy(dAtA[i:], m.ServiceName) - } - if len(m.OperationName) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(m.OperationName))) - i += copy(dAtA[i:], m.OperationName) - } - if len(m.Tags) > 0 { - for k, _ := range m.Tags { - dAtA[i] = 0x1a - i++ - v := m.Tags[k] - mapSize := 1 + len(k) + sovStorage(uint64(len(k))) + 1 + len(v) + sovStorage(uint64(len(v))) - i = encodeVarintStorage(dAtA, i, uint64(mapSize)) - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(k))) - i += copy(dAtA[i:], k) - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(v))) - i += copy(dAtA[i:], v) - } - } - dAtA[i] = 0x22 - i++ - i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdTime(m.StartTimeMin))) - n21, err := types.StdTimeMarshalTo(m.StartTimeMin, dAtA[i:]) - if err != nil { - return 0, err - } - i += n21 - dAtA[i] = 0x2a - i++ - i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdTime(m.StartTimeMax))) - n22, err := types.StdTimeMarshalTo(m.StartTimeMax, dAtA[i:]) - if err != nil { - return 0, err - } - i += n22 - dAtA[i] = 0x32 - i++ - i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdDuration(m.DurationMin))) - n23, err := types.StdDurationMarshalTo(m.DurationMin, dAtA[i:]) - if err != nil { - return 0, err - } - i += n23 - dAtA[i] = 0x3a - i++ - i = encodeVarintStorage(dAtA, i, uint64(types.SizeOfStdDuration(m.DurationMax))) - n24, err := types.StdDurationMarshalTo(m.DurationMax, dAtA[i:]) - if err != nil { - return 0, err - } - i += n24 - if m.NumTraces != 0 { - dAtA[i] = 0x40 - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.NumTraces)) - } - return i, nil -} - -func (m *FindTracesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FindTracesRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Query != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Query.Size())) - n25, err := m.Query.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n25 - } - return i, nil -} - -func (m *FindTracesSuccess) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FindTracesSuccess) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Traces) > 0 { - for _, msg := range m.Traces { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *FindTracesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FindTracesResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Response != nil { - nn26, err := m.Response.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn26 - } - return i, nil -} - -func (m *FindTracesResponse_Success) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Success != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) - n27, err := m.Success.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n27 - } - return i, nil -} -func (m *FindTracesResponse_Error) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) - n28, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n28 - } - return i, nil -} -func (m *FindTraceIDsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FindTraceIDsRequest) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Query != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Query.Size())) - n29, err := m.Query.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n29 - } - return i, nil -} - -func (m *FindTraceIDsSuccess) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FindTraceIDsSuccess) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.TraceIDs) > 0 { - for _, msg := range m.TraceIDs { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *FindTraceIDsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FindTraceIDsResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Response != nil { - nn30, err := m.Response.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn30 - } - return i, nil -} - -func (m *FindTraceIDsResponse_Success) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Success != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Success.Size())) - n31, err := m.Success.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n31 - } - return i, nil -} -func (m *FindTraceIDsResponse_Error) MarshalTo(dAtA []byte) (int, error) { - i := 0 - if m.Error != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintStorage(dAtA, i, uint64(m.Error.Size())) - n32, err := m.Error.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n32 - } - return i, nil -} -func (m *EmptyResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *EmptyResponse) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func (m *StoragePluginError) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StoragePluginError) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Message) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintStorage(dAtA, i, uint64(len(m.Message))) - i += copy(dAtA[i:], m.Message) - } - return i, nil -} - -func encodeVarintStorage(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *GetDependenciesRequest) Size() (n int) { - var l int - _ = l - l = types.SizeOfStdTime(m.EndTimestamp) - n += 1 + l + sovStorage(uint64(l)) - l = types.SizeOfStdDuration(m.Lookback) - n += 1 + l + sovStorage(uint64(l)) - return n -} - -func (m *GetDependenciesSuccess) Size() (n int) { - var l int - _ = l - if len(m.Dependencies) > 0 { - for _, e := range m.Dependencies { - l = e.Size() - n += 1 + l + sovStorage(uint64(l)) - } - } - return n -} - -func (m *GetDependenciesResponse) Size() (n int) { - var l int - _ = l - if m.Response != nil { - n += m.Response.Size() - } - return n -} - -func (m *GetDependenciesResponse_Success) Size() (n int) { - var l int - _ = l - if m.Success != nil { - l = m.Success.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *GetDependenciesResponse_Error) Size() (n int) { - var l int - _ = l - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *WriteSpanRequest) Size() (n int) { - var l int - _ = l - if m.Span != nil { - l = m.Span.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} - -func (m *WriteSpanResponse) Size() (n int) { - var l int - _ = l - if m.Response != nil { - n += m.Response.Size() - } - return n -} - -func (m *WriteSpanResponse_Success) Size() (n int) { - var l int - _ = l - if m.Success != nil { - l = m.Success.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *WriteSpanResponse_Error) Size() (n int) { - var l int - _ = l - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *GetTraceRequest) Size() (n int) { - var l int - _ = l - l = m.TraceID.Size() - n += 1 + l + sovStorage(uint64(l)) - return n -} - -func (m *GetTraceSuccess) Size() (n int) { - var l int - _ = l - if m.Trace != nil { - l = m.Trace.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} - -func (m *GetTraceResponse) Size() (n int) { - var l int - _ = l - if m.Response != nil { - n += m.Response.Size() - } - return n -} - -func (m *GetTraceResponse_Success) Size() (n int) { - var l int - _ = l - if m.Success != nil { - l = m.Success.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *GetTraceResponse_Error) Size() (n int) { - var l int - _ = l - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *GetServicesRequest) Size() (n int) { - var l int - _ = l - return n -} - -func (m *GetServicesSuccess) Size() (n int) { - var l int - _ = l - if len(m.Services) > 0 { - for _, s := range m.Services { - l = len(s) - n += 1 + l + sovStorage(uint64(l)) - } - } - return n -} - -func (m *GetServicesResponse) Size() (n int) { - var l int - _ = l - if m.Response != nil { - n += m.Response.Size() - } - return n -} - -func (m *GetServicesResponse_Success) Size() (n int) { - var l int - _ = l - if m.Success != nil { - l = m.Success.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *GetServicesResponse_Error) Size() (n int) { - var l int - _ = l - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *GetOperationsRequest) Size() (n int) { - var l int - _ = l - l = len(m.Service) - if l > 0 { - n += 1 + l + sovStorage(uint64(l)) - } - return n -} - -func (m *GetOperationsSuccess) Size() (n int) { - var l int - _ = l - if len(m.Operations) > 0 { - for _, s := range m.Operations { - l = len(s) - n += 1 + l + sovStorage(uint64(l)) - } - } - return n -} - -func (m *GetOperationsResponse) Size() (n int) { - var l int - _ = l - if m.Response != nil { - n += m.Response.Size() - } - return n -} - -func (m *GetOperationsResponse_Success) Size() (n int) { - var l int - _ = l - if m.Success != nil { - l = m.Success.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *GetOperationsResponse_Error) Size() (n int) { - var l int - _ = l - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *TraceQueryParameters) Size() (n int) { - var l int - _ = l - l = len(m.ServiceName) - if l > 0 { - n += 1 + l + sovStorage(uint64(l)) - } - l = len(m.OperationName) - if l > 0 { - n += 1 + l + sovStorage(uint64(l)) - } - if len(m.Tags) > 0 { - for k, v := range m.Tags { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovStorage(uint64(len(k))) + 1 + len(v) + sovStorage(uint64(len(v))) - n += mapEntrySize + 1 + sovStorage(uint64(mapEntrySize)) - } - } - l = types.SizeOfStdTime(m.StartTimeMin) - n += 1 + l + sovStorage(uint64(l)) - l = types.SizeOfStdTime(m.StartTimeMax) - n += 1 + l + sovStorage(uint64(l)) - l = types.SizeOfStdDuration(m.DurationMin) - n += 1 + l + sovStorage(uint64(l)) - l = types.SizeOfStdDuration(m.DurationMax) - n += 1 + l + sovStorage(uint64(l)) - if m.NumTraces != 0 { - n += 1 + sovStorage(uint64(m.NumTraces)) - } - return n -} - -func (m *FindTracesRequest) Size() (n int) { - var l int - _ = l - if m.Query != nil { - l = m.Query.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} - -func (m *FindTracesSuccess) Size() (n int) { - var l int - _ = l - if len(m.Traces) > 0 { - for _, e := range m.Traces { - l = e.Size() - n += 1 + l + sovStorage(uint64(l)) - } - } - return n -} - -func (m *FindTracesResponse) Size() (n int) { - var l int - _ = l - if m.Response != nil { - n += m.Response.Size() - } - return n -} - -func (m *FindTracesResponse_Success) Size() (n int) { - var l int - _ = l - if m.Success != nil { - l = m.Success.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *FindTracesResponse_Error) Size() (n int) { - var l int - _ = l - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *FindTraceIDsRequest) Size() (n int) { - var l int - _ = l - if m.Query != nil { - l = m.Query.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} - -func (m *FindTraceIDsSuccess) Size() (n int) { - var l int - _ = l - if len(m.TraceIDs) > 0 { - for _, e := range m.TraceIDs { - l = e.Size() - n += 1 + l + sovStorage(uint64(l)) - } - } - return n -} - -func (m *FindTraceIDsResponse) Size() (n int) { - var l int - _ = l - if m.Response != nil { - n += m.Response.Size() - } - return n -} - -func (m *FindTraceIDsResponse_Success) Size() (n int) { - var l int - _ = l - if m.Success != nil { - l = m.Success.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *FindTraceIDsResponse_Error) Size() (n int) { - var l int - _ = l - if m.Error != nil { - l = m.Error.Size() - n += 1 + l + sovStorage(uint64(l)) - } - return n -} -func (m *EmptyResponse) Size() (n int) { - var l int - _ = l - return n -} - -func (m *StoragePluginError) Size() (n int) { - var l int - _ = l - l = len(m.Message) - if l > 0 { - n += 1 + l + sovStorage(uint64(l)) - } - return n -} - -func sovStorage(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozStorage(x uint64) (n int) { - return sovStorage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GetDependenciesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetDependenciesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetDependenciesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndTimestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := types.StdTimeUnmarshal(&m.EndTimestamp, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lookback", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := types.StdDurationUnmarshal(&m.Lookback, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetDependenciesSuccess) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetDependenciesSuccess: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetDependenciesSuccess: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dependencies", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_jaegertracing_jaeger_model.DependencyLink - m.Dependencies = append(m.Dependencies, v) - if err := m.Dependencies[len(m.Dependencies)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetDependenciesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetDependenciesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetDependenciesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &GetDependenciesSuccess{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &GetDependenciesResponse_Success{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &StoragePluginError{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &GetDependenciesResponse_Error{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WriteSpanRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WriteSpanRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WriteSpanRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Span", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Span == nil { - m.Span = &jaeger_api_v2.Span{} - } - if err := m.Span.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WriteSpanResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WriteSpanResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WriteSpanResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &EmptyResponse{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &WriteSpanResponse_Success{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &StoragePluginError{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &WriteSpanResponse_Error{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetTraceRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetTraceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetTraceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TraceID", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TraceID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetTraceSuccess) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetTraceSuccess: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetTraceSuccess: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Trace", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Trace == nil { - m.Trace = &jaeger_api_v2.Trace{} - } - if err := m.Trace.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetTraceResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetTraceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetTraceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &GetTraceSuccess{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &GetTraceResponse_Success{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &StoragePluginError{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &GetTraceResponse_Error{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetServicesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetServicesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetServicesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetServicesSuccess) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetServicesSuccess: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetServicesSuccess: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Services", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Services = append(m.Services, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetServicesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetServicesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetServicesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &GetServicesSuccess{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &GetServicesResponse_Success{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &StoragePluginError{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &GetServicesResponse_Error{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetOperationsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetOperationsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetOperationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Service", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Service = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetOperationsSuccess) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetOperationsSuccess: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetOperationsSuccess: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Operations", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Operations = append(m.Operations, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetOperationsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetOperationsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetOperationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &GetOperationsSuccess{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &GetOperationsResponse_Success{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &StoragePluginError{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &GetOperationsResponse_Error{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TraceQueryParameters) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TraceQueryParameters: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TraceQueryParameters: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperationName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OperationName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Tags == nil { - m.Tags = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthStorage - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthStorage - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Tags[mapkey] = mapvalue - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTimeMin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := types.StdTimeUnmarshal(&m.StartTimeMin, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTimeMax", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := types.StdTimeUnmarshal(&m.StartTimeMax, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DurationMin", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := types.StdDurationUnmarshal(&m.DurationMin, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DurationMax", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := types.StdDurationUnmarshal(&m.DurationMax, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumTraces", wireType) - } - m.NumTraces = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NumTraces |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FindTracesRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FindTracesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FindTracesRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Query == nil { - m.Query = &TraceQueryParameters{} - } - if err := m.Query.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FindTracesSuccess) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FindTracesSuccess: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FindTracesSuccess: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Traces", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Traces = append(m.Traces, &jaeger_api_v2.Trace{}) - if err := m.Traces[len(m.Traces)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FindTracesResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FindTracesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FindTracesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &FindTracesSuccess{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &FindTracesResponse_Success{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &StoragePluginError{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &FindTracesResponse_Error{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FindTraceIDsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FindTraceIDsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FindTraceIDsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Query", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Query == nil { - m.Query = &TraceQueryParameters{} - } - if err := m.Query.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FindTraceIDsSuccess) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FindTraceIDsSuccess: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FindTraceIDsSuccess: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TraceIDs", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - var v github_com_jaegertracing_jaeger_model.TraceID - m.TraceIDs = append(m.TraceIDs, v) - if err := m.TraceIDs[len(m.TraceIDs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *FindTraceIDsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FindTraceIDsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FindTraceIDsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &FindTraceIDsSuccess{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &FindTraceIDsResponse_Success{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Error", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &StoragePluginError{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Response = &FindTraceIDsResponse_Error{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *EmptyResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: EmptyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: EmptyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StoragePluginError) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StoragePluginError: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StoragePluginError: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowStorage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthStorage - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipStorage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthStorage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipStorage(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStorage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStorage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStorage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthStorage - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowStorage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipStorage(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthStorage = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowStorage = fmt.Errorf("proto: integer overflow") -) - -func init() { proto1.RegisterFile("storage.proto", fileDescriptorStorage) } -func init() { golang_proto.RegisterFile("storage.proto", fileDescriptorStorage) } - -var fileDescriptorStorage = []byte{ - // 1076 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xdf, 0x6e, 0x1b, 0xc5, - 0x17, 0xce, 0x26, 0x71, 0x6c, 0x1f, 0xdb, 0x6d, 0x3a, 0xf1, 0xef, 0x57, 0x63, 0x81, 0xed, 0x6c, - 0x29, 0x44, 0x88, 0xae, 0xab, 0x80, 0xa0, 0x2d, 0x2d, 0x25, 0x56, 0xd2, 0x34, 0xfc, 0x09, 0xe9, - 0x26, 0x52, 0xa5, 0x82, 0xe4, 0x4e, 0xec, 0x61, 0x59, 0xe2, 0x9d, 0x75, 0x77, 0x66, 0xa3, 0x98, - 0xa7, 0xe0, 0x02, 0x24, 0x10, 0x42, 0x5c, 0x94, 0x07, 0xe1, 0xb2, 0x97, 0x5c, 0x73, 0x11, 0x50, - 0xb8, 0xe5, 0x21, 0xd0, 0xce, 0xce, 0x6c, 0xbc, 0xe3, 0xd8, 0x2d, 0x11, 0xbe, 0xda, 0x9d, 0x99, - 0xef, 0x7c, 0x73, 0xce, 0x77, 0xe6, 0xcc, 0x19, 0x28, 0x31, 0xee, 0x07, 0xd8, 0x21, 0x56, 0x3f, - 0xf0, 0xb9, 0x8f, 0x4a, 0x5f, 0x61, 0xe2, 0x90, 0xc0, 0xc2, 0x7d, 0xb7, 0x7d, 0xb8, 0x5a, 0x2d, - 0x3b, 0xbe, 0xe3, 0x8b, 0x95, 0x66, 0xf4, 0x17, 0x83, 0xaa, 0x05, 0xcf, 0xef, 0x92, 0x9e, 0x1c, - 0xd4, 0x1d, 0xdf, 0x77, 0x7a, 0xa4, 0x29, 0x46, 0xfb, 0xe1, 0x17, 0x4d, 0xee, 0x7a, 0x84, 0x71, - 0xec, 0xf5, 0x25, 0xa0, 0xa6, 0x03, 0xba, 0x61, 0x80, 0xb9, 0xeb, 0xd3, 0x78, 0xdd, 0xfc, 0xc5, - 0x80, 0xff, 0x6f, 0x12, 0xbe, 0x4e, 0xfa, 0x84, 0x76, 0x09, 0xed, 0xb8, 0x84, 0xd9, 0xe4, 0x49, - 0x48, 0x18, 0x47, 0x5b, 0x50, 0x22, 0xb4, 0xdb, 0x4e, 0x18, 0x2b, 0x46, 0xc3, 0x58, 0x29, 0xac, - 0x56, 0xad, 0x98, 0xd2, 0x52, 0x94, 0xd6, 0x9e, 0x42, 0xb4, 0x72, 0xcf, 0x8e, 0xeb, 0x33, 0xdf, - 0xfc, 0x51, 0x37, 0xec, 0x22, 0xa1, 0xdd, 0x64, 0x1e, 0xdd, 0x85, 0x5c, 0xcf, 0xf7, 0x0f, 0xf6, - 0x71, 0xe7, 0xa0, 0x32, 0x2b, 0x58, 0x5e, 0x1a, 0x61, 0x59, 0x97, 0x8e, 0xc5, 0x24, 0xdf, 0x47, - 0x24, 0x89, 0x91, 0xf9, 0xf5, 0x88, 0x97, 0xbb, 0x61, 0xa7, 0x43, 0x18, 0x43, 0x8f, 0xa1, 0xd8, - 0x1d, 0x9a, 0xae, 0x18, 0x8d, 0xb9, 0x95, 0x62, 0xeb, 0x76, 0xc4, 0xf1, 0xfb, 0x71, 0xfd, 0x6d, - 0xc7, 0xe5, 0x5f, 0x86, 0xfb, 0x56, 0xc7, 0xf7, 0x9a, 0xb1, 0xb8, 0x3c, 0xc0, 0x1d, 0x97, 0x3a, - 0x72, 0xd4, 0x8c, 0xc5, 0x4c, 0x88, 0x07, 0x1f, 0xbb, 0xf4, 0xc0, 0x4e, 0x31, 0x9a, 0x4f, 0x0d, - 0xb8, 0x3c, 0x22, 0x11, 0xeb, 0xfb, 0x94, 0x11, 0xb4, 0x06, 0x59, 0x16, 0x3b, 0x22, 0xd5, 0xb9, - 0x6a, 0xa5, 0x72, 0x68, 0x9d, 0xed, 0xf5, 0xfd, 0x19, 0x5b, 0xd9, 0xa1, 0x9b, 0x90, 0x21, 0x41, - 0xe0, 0x07, 0x52, 0x98, 0x65, 0x8d, 0x60, 0x37, 0x3e, 0x21, 0x3b, 0xbd, 0xd0, 0x71, 0xe9, 0x46, - 0x04, 0xbc, 0x3f, 0x63, 0xc7, 0x16, 0x2d, 0x80, 0x5c, 0x20, 0x3d, 0x31, 0xdf, 0x83, 0xc5, 0x87, - 0x81, 0xcb, 0xc9, 0x6e, 0x1f, 0x53, 0x95, 0xc1, 0xd7, 0x61, 0x9e, 0xf5, 0x31, 0x95, 0xae, 0x2d, - 0xe9, 0xcc, 0x11, 0x52, 0x00, 0xcc, 0x6f, 0x0d, 0xb8, 0x34, 0x64, 0x2d, 0x83, 0xbb, 0xa1, 0x07, - 0xf7, 0xb2, 0xc6, 0xb0, 0xe1, 0xf5, 0xf9, 0x40, 0xc1, 0xa7, 0x10, 0x13, 0x85, 0x8b, 0x9b, 0x84, - 0xef, 0x05, 0xb8, 0x43, 0x54, 0x48, 0x9f, 0x41, 0x2e, 0xca, 0x20, 0x69, 0xbb, 0x5d, 0xe1, 0x54, - 0xb1, 0xf5, 0x81, 0x4c, 0xf5, 0xb5, 0x17, 0x4b, 0xb5, 0x60, 0xdb, 0x5a, 0x3f, 0x39, 0xae, 0x67, - 0xe5, 0xaf, 0x9d, 0x15, 0x8c, 0x5b, 0x5d, 0xf3, 0xce, 0xe9, 0x7e, 0xea, 0x78, 0xbd, 0x01, 0x19, - 0xb1, 0x2a, 0x15, 0x28, 0x6b, 0x91, 0xc4, 0xbe, 0xc5, 0x10, 0xf3, 0x3b, 0x03, 0x16, 0x4f, 0xfd, - 0x95, 0x22, 0xde, 0xd2, 0x45, 0xac, 0x8d, 0x9e, 0x90, 0xe1, 0x1d, 0xa7, 0x20, 0x63, 0x19, 0xd0, - 0x26, 0xe1, 0xbb, 0x24, 0x38, 0x74, 0x3b, 0x49, 0x79, 0x9b, 0xd7, 0x53, 0xb3, 0x2a, 0xde, 0x2a, - 0xe4, 0x98, 0x9c, 0x12, 0xa5, 0x94, 0xb7, 0x93, 0xb1, 0xf9, 0xa3, 0x01, 0x4b, 0x29, 0x22, 0x19, - 0xe2, 0x1d, 0x3d, 0xc4, 0xe5, 0xd1, 0x10, 0xb5, 0x7d, 0xa6, 0x10, 0xe5, 0x75, 0x28, 0x6f, 0x12, - 0xfe, 0x69, 0x9f, 0xc4, 0xd7, 0x48, 0x72, 0x8d, 0x55, 0x20, 0x2b, 0x23, 0x10, 0xde, 0xe5, 0x6d, - 0x35, 0x34, 0xdf, 0xd1, 0x2c, 0x94, 0x06, 0x35, 0x00, 0x3f, 0x99, 0x94, 0x2a, 0x0c, 0xcd, 0x98, - 0x3f, 0x1b, 0xf0, 0x3f, 0x6d, 0x2b, 0xa9, 0xc4, 0x5d, 0x5d, 0x89, 0x2b, 0xa3, 0x4a, 0x8c, 0xec, - 0x37, 0x05, 0x2d, 0x9e, 0xce, 0x43, 0x59, 0x1c, 0xaa, 0x07, 0x21, 0x09, 0x06, 0x3b, 0x38, 0xc0, - 0x1e, 0xe1, 0x24, 0x60, 0x68, 0x19, 0x8a, 0x32, 0xfa, 0x36, 0xc5, 0x9e, 0x52, 0xa4, 0x20, 0xe7, - 0xb6, 0xb1, 0x47, 0xd0, 0x55, 0xb8, 0x90, 0xc4, 0x1a, 0x83, 0x66, 0x05, 0xa8, 0x94, 0xcc, 0x0a, - 0xd8, 0x1a, 0xcc, 0x73, 0xec, 0xb0, 0xca, 0x5c, 0x63, 0x6e, 0xa5, 0xb0, 0x7a, 0xed, 0xac, 0xba, - 0xd0, 0x36, 0xb7, 0xf6, 0xb0, 0xc3, 0x36, 0x28, 0x0f, 0x06, 0xb6, 0x30, 0x45, 0x1f, 0xc2, 0x05, - 0xc6, 0x71, 0xc0, 0x45, 0x8b, 0x69, 0x7b, 0x2e, 0xad, 0xcc, 0xff, 0x9b, 0x0e, 0x23, 0x6c, 0xa3, - 0x95, 0x4f, 0x5c, 0xaa, 0x73, 0xe1, 0xa3, 0x4a, 0xe6, 0x7c, 0x5c, 0xf8, 0x08, 0xdd, 0x83, 0xa2, - 0xea, 0x92, 0xc2, 0xab, 0x85, 0x17, 0xef, 0x58, 0x05, 0x65, 0x18, 0xf9, 0x94, 0xe2, 0xc1, 0x47, - 0x95, 0xec, 0x79, 0x78, 0xf0, 0x11, 0x7a, 0x05, 0x80, 0x86, 0x5e, 0x5b, 0x5c, 0x32, 0xac, 0x92, - 0x6b, 0x18, 0x2b, 0x19, 0x3b, 0x4f, 0x43, 0x4f, 0x88, 0xcc, 0xaa, 0xef, 0x42, 0x3e, 0x51, 0x16, - 0x2d, 0xc2, 0xdc, 0x01, 0x19, 0xc8, 0xbc, 0x46, 0xbf, 0xa8, 0x0c, 0x99, 0x43, 0xdc, 0x0b, 0x55, - 0x1a, 0xe3, 0xc1, 0xad, 0xd9, 0x1b, 0x86, 0xb9, 0x0d, 0x97, 0xee, 0xb9, 0xb4, 0x1b, 0xd3, 0xa8, - 0x72, 0xb9, 0x09, 0x99, 0x27, 0x51, 0xde, 0xc6, 0x1c, 0xe0, 0xb3, 0x12, 0x6b, 0xc7, 0x16, 0xe6, - 0xda, 0x30, 0x9f, 0x2a, 0xa6, 0x37, 0x61, 0x41, 0x3a, 0x6e, 0x88, 0x93, 0x72, 0xf6, 0x0d, 0x2a, - 0x31, 0xe6, 0x0f, 0x06, 0xa0, 0x61, 0x9f, 0x64, 0x5d, 0xdd, 0xd6, 0xeb, 0xaa, 0xa1, 0xb1, 0x8c, - 0xec, 0x3b, 0x85, 0xa2, 0xda, 0x81, 0xa5, 0x64, 0x9b, 0xad, 0xf5, 0xff, 0x42, 0x30, 0x96, 0x66, - 0x54, 0x92, 0x7d, 0x9e, 0xea, 0x71, 0xd1, 0x73, 0x66, 0xed, 0xbc, 0x3d, 0x2e, 0x97, 0x78, 0x9b, - 0x34, 0xb9, 0x9f, 0x0c, 0x28, 0xa7, 0xe3, 0x90, 0x22, 0xbf, 0xaf, 0x8b, 0x6c, 0x8e, 0x13, 0xf9, - 0xd4, 0xd7, 0x29, 0xc8, 0x7c, 0x11, 0x4a, 0xa9, 0x77, 0x85, 0x69, 0x01, 0x1a, 0xb5, 0x8d, 0xae, - 0x75, 0x8f, 0x30, 0x86, 0x9d, 0xe4, 0x5a, 0x97, 0xc3, 0xd5, 0xbf, 0xe7, 0xa1, 0x94, 0x32, 0x40, - 0x8f, 0x45, 0x5f, 0x1f, 0x7e, 0x87, 0xa1, 0xe7, 0xbc, 0xd3, 0x64, 0x72, 0xab, 0xaf, 0x3d, 0x0f, - 0x26, 0xb5, 0xdb, 0x86, 0x7c, 0xf2, 0x7e, 0x42, 0x75, 0xcd, 0x48, 0x7f, 0x97, 0x55, 0x1b, 0xe3, - 0x01, 0x92, 0xef, 0x23, 0xc8, 0xa9, 0x77, 0x01, 0x1a, 0xf7, 0x60, 0x50, 0x6c, 0xf5, 0xb1, 0xeb, - 0x92, 0x6c, 0x0f, 0x0a, 0x43, 0x1d, 0x18, 0x4d, 0xe8, 0xce, 0x8a, 0xd2, 0x9c, 0x04, 0x91, 0xac, - 0x8f, 0xa0, 0x94, 0xea, 0x66, 0x68, 0x62, 0xaf, 0x53, 0xcc, 0xaf, 0x4e, 0x06, 0x49, 0xee, 0x07, - 0x00, 0xa7, 0x15, 0x8d, 0xc6, 0x17, 0xbb, 0x62, 0x5d, 0x9e, 0x80, 0x90, 0x94, 0x0f, 0xa1, 0x38, - 0x7c, 0x7e, 0xd1, 0xa4, 0xc3, 0xad, 0x68, 0xaf, 0x4c, 0xc4, 0xc4, 0xc4, 0xad, 0xcb, 0xcf, 0x4e, - 0x6a, 0xc6, 0x6f, 0x27, 0x35, 0xe3, 0xcf, 0x93, 0x9a, 0xf1, 0xeb, 0x5f, 0x35, 0xe3, 0x51, 0x26, - 0xbe, 0xd9, 0x17, 0xc4, 0xe7, 0xad, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x63, 0x7a, 0xfc, 0x43, - 0xe5, 0x0d, 0x00, 0x00, -} From 70f43dc7d3b51ab2eab29429a9f1b81501fa81a9 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Fri, 5 Apr 2019 14:41:07 +0100 Subject: [PATCH 03/30] Update plugin grpc interface/implementation Signed-off-by: Charles Dixon --- plugin/storage/grpc/shared/grpc.go | 327 +++++++++++------------- plugin/storage/grpc/shared/interface.go | 16 +- 2 files changed, 162 insertions(+), 181 deletions(-) diff --git a/plugin/storage/grpc/shared/grpc.go b/plugin/storage/grpc/shared/grpc.go index be0e35e9fd4..7d162b7552e 100644 --- a/plugin/storage/grpc/shared/grpc.go +++ b/plugin/storage/grpc/shared/grpc.go @@ -17,72 +17,73 @@ package shared import ( "context" "fmt" + "io" "time" "github.com/jaegertracing/jaeger/model" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/proto" + "github.com/jaegertracing/jaeger/proto-gen/storage_v1" "github.com/jaegertracing/jaeger/storage/spanstore" ) +// temporary +const span_batch_size = 1000 + type GRPCClient struct { - client proto.StoragePluginClient + readerClient storage_v1.SpanReaderPluginClient + writerClient storage_v1.SpanWriterPluginClient + depsReaderClient storage_v1.DependenciesReaderPluginClient } func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - resp, err := c.client.GetTrace(ctx, &proto.GetTraceRequest{ + stream, err := c.readerClient.GetTrace(ctx, &storage_v1.GetTraceRequest{ TraceID: traceID, }) if err != nil { - return nil, fmt.Errorf("grpc error: %s", err) + return nil, fmt.Errorf("plugin error: %s", err) } - switch t := resp.Response.(type) { - case *proto.GetTraceResponse_Success: - return t.Success.Trace, nil - case *proto.GetTraceResponse_Error: - return nil, fmt.Errorf("plugin error: %s", t.Error.Message) - default: - panic("unreachable") + trace := model.Trace{} + for { + received, err := stream.Recv() + if err == io.EOF { + break + } + + if err != nil { + return nil, fmt.Errorf("stream error: %s", err) + } + + for _, span := range received.Spans { + trace.Spans = append(trace.Spans, &span) + } } + + return &trace, nil } func (c *GRPCClient) GetServices(ctx context.Context) ([]string, error) { - resp, err := c.client.GetServices(ctx, &proto.GetServicesRequest{}) + resp, err := c.readerClient.GetServices(ctx, &storage_v1.GetServicesRequest{}) if err != nil { - return nil, fmt.Errorf("grpc error: %s", err) + return nil, fmt.Errorf("plugin error: %s", err) } - switch t := resp.Response.(type) { - case *proto.GetServicesResponse_Success: - return t.Success.Services, nil - case *proto.GetServicesResponse_Error: - return nil, fmt.Errorf("plugin error: %s", t.Error.Message) - default: - panic("unreachable") - } + return resp.Services, nil } func (c *GRPCClient) GetOperations(ctx context.Context, service string) ([]string, error) { - resp, err := c.client.GetOperations(ctx, &proto.GetOperationsRequest{ + resp, err := c.readerClient.GetOperations(ctx, &storage_v1.GetOperationsRequest{ Service: service, }) if err != nil { return nil, fmt.Errorf("grpc error: %s", err) } - switch t := resp.Response.(type) { - case *proto.GetOperationsResponse_Success: - return t.Success.Operations, nil - case *proto.GetOperationsResponse_Error: - return nil, fmt.Errorf("plugin error: %s", t.Error.Message) - default: - panic("unreachable") - } + return resp.Operations, nil } func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { - resp, err := c.client.FindTraces(context.Background(), &proto.FindTracesRequest{ - Query: &proto.TraceQueryParameters{ + stream, err := c.readerClient.FindTraces(context.Background(), &storage_v1.FindTracesRequest{ + Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, OperationName: query.OperationName, Tags: query.Tags, @@ -94,22 +95,42 @@ func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery }, }) if err != nil { - return nil, fmt.Errorf("grpc error: %s", err) + return nil, fmt.Errorf("plugin error: %s", err) } - switch t := resp.Response.(type) { - case *proto.FindTracesResponse_Success: - return t.Success.Traces, nil - case *proto.FindTracesResponse_Error: - return nil, fmt.Errorf("plugin error: %s", t.Error.Message) - default: - panic("unreachable") + var traces []*model.Trace + var trace *model.Trace + var traceID model.TraceID + for { + received, err := stream.Recv() + if err == io.EOF { + break + } + + if err != nil { + return nil, fmt.Errorf("stream error: %s", err) + } + + for i, span := range received.Spans { + if span.TraceID != traceID { + if trace != nil { + traces = append(traces, trace) + } + trace = &model.Trace{} + traceID = span.TraceID + } + trace.Spans = append(trace.Spans, &received.Spans[i]) + } } + if trace != nil { + traces = append(traces, trace) + } + return traces, nil } func (c *GRPCClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { - resp, err := c.client.FindTraceIDs(context.Background(), &proto.FindTraceIDsRequest{ - Query: &proto.TraceQueryParameters{ + resp, err := c.readerClient.FindTraceIDs(context.Background(), &storage_v1.FindTraceIDsRequest{ + Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, OperationName: query.OperationName, Tags: query.Tags, @@ -121,161 +142,111 @@ func (c *GRPCClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQue }, }) if err != nil { - return nil, fmt.Errorf("grpc error: %s", err) + return nil, fmt.Errorf("plugin error: %s", err) } - switch t := resp.Response.(type) { - case *proto.FindTraceIDsResponse_Success: - return t.Success.TraceIDs, nil - case *proto.FindTraceIDsResponse_Error: - return nil, fmt.Errorf("plugin error: %s", t.Error.Message) - default: - panic("unreachable") - } + return resp.TraceIDs, nil } func (c *GRPCClient) WriteSpan(span *model.Span) error { - resp, err := c.client.WriteSpan(context.Background(), &proto.WriteSpanRequest{ + _, err := c.writerClient.WriteSpan(context.Background(), &storage_v1.WriteSpanRequest{ Span: span, }) if err != nil { - return fmt.Errorf("grpc error: %s", err) + return fmt.Errorf("plugin error: %s", err) } - switch t := resp.Response.(type) { - case *proto.WriteSpanResponse_Success: - return nil - case *proto.WriteSpanResponse_Error: - return fmt.Errorf("plugin error: %s", t.Error.Message) - default: - panic("unreachable") - } + return nil } func (c *GRPCClient) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { - resp, err := c.client.GetDependencies(context.Background(), &proto.GetDependenciesRequest{ - EndTimestamp: endTs, - Lookback: lookback, + resp, err := c.depsReaderClient.GetDependencies(context.Background(), &storage_v1.GetDependenciesRequest{ + EndTime: endTs, + StartTime: endTs.Add(-lookback), }) if err != nil { return nil, fmt.Errorf("grpc error: %s", err) } - switch t := resp.Response.(type) { - case *proto.GetDependenciesResponse_Success: - return t.Success.Dependencies, nil - case *proto.GetDependenciesResponse_Error: - return nil, fmt.Errorf("plugin error: %s", t.Error.Message) - default: - panic("unreachable") - } + return resp.Dependencies, nil } type GRPCServer struct { Impl StoragePlugin } - -func (s *GRPCServer) GetDependencies(ctx context.Context, r *proto.GetDependenciesRequest) (*proto.GetDependenciesResponse, error) { - deps, err := s.Impl.GetDependencies(r.EndTimestamp, r.Lookback) +func (s *GRPCServer) GetDependencies(ctx context.Context, r *storage_v1.GetDependenciesRequest) (*storage_v1.GetDependenciesResponse, error) { + deps, err := s.Impl.GetDependencies(r.EndTime, r.EndTime.Sub(r.StartTime)) if err != nil { - return &proto.GetDependenciesResponse{ - Response: &proto.GetDependenciesResponse_Error{ - Error: &proto.StoragePluginError{ - Message: err.Error(), - }, - }, - }, nil + return nil, err } - return &proto.GetDependenciesResponse{ - Response: &proto.GetDependenciesResponse_Success{ - Success: &proto.GetDependenciesSuccess{ - Dependencies: deps, - }, - }, + return &storage_v1.GetDependenciesResponse{ + Dependencies: deps, }, nil } -func (s *GRPCServer) WriteSpan(ctx context.Context, r *proto.WriteSpanRequest) (*proto.WriteSpanResponse, error) { +func (s *GRPCServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanRequest) (*storage_v1.WriteSpanResponse, error) { err := s.Impl.WriteSpan(r.Span) if err != nil { - return &proto.WriteSpanResponse{ - Response: &proto.WriteSpanResponse_Error{ - Error: &proto.StoragePluginError{ - Message: err.Error(), - }, - }, - }, nil + return nil, err } - return &proto.WriteSpanResponse{ - Response: &proto.WriteSpanResponse_Success{ - Success: &proto.EmptyResponse{}, - }, - }, nil + return &storage_v1.WriteSpanResponse{}, nil } -func (s *GRPCServer) GetTrace(ctx context.Context, r *proto.GetTraceRequest) (*proto.GetTraceResponse, error) { - trace, err := s.Impl.GetTrace(ctx, r.TraceID) +func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.SpanReaderPlugin_GetTraceServer) error { + trace, err := s.Impl.GetTrace(stream.Context(), r.TraceID) if err != nil { - return &proto.GetTraceResponse{ - Response: &proto.GetTraceResponse_Error{ - Error: &proto.StoragePluginError{ - Message: err.Error(), - }, - }, - }, nil + return err } - return &proto.GetTraceResponse{ - Response: &proto.GetTraceResponse_Success{ - Success: &proto.GetTraceSuccess{ - Trace: trace, - }, - }, - }, nil + + var allSpans [][]model.Span + currentSpans := make([]model.Span, 0, span_batch_size) + i := 0 + for _, span := range trace.Spans { + if i == span_batch_size { + i = 0 + allSpans = append(allSpans, currentSpans) + currentSpans = make([]model.Span, 0, span_batch_size) + } + currentSpans = append(currentSpans, *span) + i++ + } + if len(currentSpans) > 0 { + allSpans = append(allSpans, currentSpans) + } + + for _, spans := range allSpans { + err = stream.Send(&storage_v1.SpansResponseChunk{Spans: spans}) + if err != nil { + return err + } + } + + return nil } -func (s *GRPCServer) GetServices(ctx context.Context, r *proto.GetServicesRequest) (*proto.GetServicesResponse, error) { +func (s *GRPCServer) GetServices(ctx context.Context, r *storage_v1.GetServicesRequest) (*storage_v1.GetServicesResponse, error) { services, err := s.Impl.GetServices(ctx) if err != nil { - return &proto.GetServicesResponse{ - Response: &proto.GetServicesResponse_Error{ - Error: &proto.StoragePluginError{ - Message: err.Error(), - }, - }, - }, nil + return nil, err } - return &proto.GetServicesResponse{ - Response: &proto.GetServicesResponse_Success{ - Success: &proto.GetServicesSuccess{ - Services: services, - }, - }, + return &storage_v1.GetServicesResponse{ + Services: services, }, nil } -func (s *GRPCServer) GetOperations(ctx context.Context, r *proto.GetOperationsRequest) (*proto.GetOperationsResponse, error) { +func (s *GRPCServer) GetOperations(ctx context.Context, r *storage_v1.GetOperationsRequest) (*storage_v1.GetOperationsResponse, error) { operations, err := s.Impl.GetOperations(ctx, r.Service) if err != nil { - return &proto.GetOperationsResponse{ - Response: &proto.GetOperationsResponse_Error{ - Error: &proto.StoragePluginError{ - Message: err.Error(), - }, - }, - }, nil + return nil, err } - return &proto.GetOperationsResponse{ - Response: &proto.GetOperationsResponse_Success{ - Success: &proto.GetOperationsSuccess{ - Operations: operations, - }, - }, + return &storage_v1.GetOperationsResponse{ + Operations: operations, }, nil } -func (s *GRPCServer) FindTraces(ctx context.Context, r *proto.FindTracesRequest) (*proto.FindTracesResponse, error) { - traces, err := s.Impl.FindTraces(ctx, &spanstore.TraceQueryParameters{ +func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_v1.SpanReaderPlugin_FindTracesServer) error { + traces, err := s.Impl.FindTraces(stream.Context(), &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, OperationName: r.Query.OperationName, Tags: r.Query.Tags, @@ -286,24 +257,38 @@ func (s *GRPCServer) FindTraces(ctx context.Context, r *proto.FindTracesRequest) NumTraces: int(r.Query.NumTraces), }) if err != nil { - return &proto.FindTracesResponse{ - Response: &proto.FindTracesResponse_Error{ - Error: &proto.StoragePluginError{ - Message: err.Error(), - }, - }, - }, nil + return err } - return &proto.FindTracesResponse{ - Response: &proto.FindTracesResponse_Success{ - Success: &proto.FindTracesSuccess{ - Traces: traces, - }, - }, - }, nil + + var allSpans [][]model.Span + currentSpans := make([]model.Span, 0, span_batch_size) + i := 0 + for _, trace := range traces { + for _, span := range trace.Spans { + if i == span_batch_size { + i = 0 + allSpans = append(allSpans, currentSpans) + currentSpans = make([]model.Span, 0, span_batch_size) + } + currentSpans = append(currentSpans, *span) + i++ + } + } + if len(currentSpans) > 0 { + allSpans = append(allSpans, currentSpans) + } + + for _, spans := range allSpans { + err = stream.Send(&storage_v1.SpansResponseChunk{Spans: spans}) + if err != nil { + return err + } + } + + return nil } -func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *proto.FindTraceIDsRequest) (*proto.FindTraceIDsResponse, error) { +func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceIDsRequest) (*storage_v1.FindTraceIDsResponse, error) { traceIDs, err := s.Impl.FindTraceIDs(ctx, &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, OperationName: r.Query.OperationName, @@ -315,21 +300,9 @@ func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *proto.FindTraceIDsRequ NumTraces: int(r.Query.NumTraces), }) if err != nil { - return &proto.FindTraceIDsResponse{ - Response: &proto.FindTraceIDsResponse_Error{ - Error: &proto.StoragePluginError{ - Message: err.Error(), - }, - }, - }, nil + return nil, err } - return &proto.FindTraceIDsResponse{ - Response: &proto.FindTraceIDsResponse_Success{ - Success: &proto.FindTraceIDsSuccess{ - TraceIDs: traceIDs, - }, - }, + return &storage_v1.FindTraceIDsResponse{ + TraceIDs: traceIDs, }, nil } - - diff --git a/plugin/storage/grpc/shared/interface.go b/plugin/storage/grpc/shared/interface.go index 9b6ceeaff49..027596be7f6 100644 --- a/plugin/storage/grpc/shared/interface.go +++ b/plugin/storage/grpc/shared/interface.go @@ -16,12 +16,13 @@ package shared import ( "context" + "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/hashicorp/go-plugin" "google.golang.org/grpc" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/proto" + "github.com/jaegertracing/jaeger/proto-gen/storage_v1" "github.com/jaegertracing/jaeger/storage/spanstore" ) @@ -46,7 +47,7 @@ type StoragePlugin interface { dependencystore.Reader } -// This is the implementation of plugin.GRPCPlugin so we can serve/consume this. +// StorageGRPCPlugin is the implementation of plugin.GRPCPlugin so we can serve/consume this. type StorageGRPCPlugin struct { plugin.Plugin // Concrete implementation, written in Go. This is only used for plugins @@ -55,10 +56,17 @@ type StorageGRPCPlugin struct { } func (p *StorageGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { - proto.RegisterStoragePluginServer(s, &GRPCServer{Impl: p.Impl}) + server := &GRPCServer{Impl: p.Impl} + storage_v1.RegisterSpanReaderPluginServer(s, server) + storage_v1.RegisterSpanWriterPluginServer(s, server) + storage_v1.RegisterDependenciesReaderPluginServer(s, server) return nil } func (*StorageGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) { - return &GRPCClient{client: proto.NewStoragePluginClient(c)}, nil + return &GRPCClient{ + readerClient: storage_v1.NewSpanReaderPluginClient(c), + writerClient: storage_v1.NewSpanWriterPluginClient(c), + depsReaderClient: storage_v1.NewDependenciesReaderPluginClient(c), + }, nil } From 482edd64f4b2796390a1ea432a75aff0dcb78cd2 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Mon, 8 Apr 2019 12:18:54 +0100 Subject: [PATCH 04/30] Fix gosec by adding an exclude comment Signed-off-by: Charles Dixon --- pkg/grpc/config/config.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkg/grpc/config/config.go b/pkg/grpc/config/config.go index b265ea1e6b8..4e72ea585d0 100644 --- a/pkg/grpc/config/config.go +++ b/pkg/grpc/config/config.go @@ -16,26 +16,31 @@ package config import ( "fmt" + "os/exec" + "runtime" + "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-plugin" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" - "os/exec" - "runtime" ) // Configuration describes the options to customize the storage behavior type Configuration struct { - PluginBinary string `yaml:"binary"` + PluginBinary string `yaml:"binary"` PluginConfigurationFile string `yaml:"configuration-file"` } func (c *Configuration) Build() (shared.StoragePlugin, error) { + // #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: exec.Command(c.PluginBinary, "--config", c.PluginConfigurationFile), + Cmd: cmd, AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC}, Logger: hclog.New(&hclog.LoggerOptions{ Level: hclog.Warn, @@ -66,4 +71,4 @@ func (c *Configuration) Build() (shared.StoragePlugin, error) { type PluginBuilder interface { Build() (shared.StoragePlugin, error) -} \ No newline at end of file +} From be72ed7c27b70b65e3f133e35b53fb68569f9ac3 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Mon, 8 Apr 2019 12:20:58 +0100 Subject: [PATCH 05/30] Run make fmt Signed-off-by: Charles Dixon --- cmd/noop-grpc-plugin/load_test.go | 24 ++++++++++++++++++---- cmd/noop-grpc-plugin/main.go | 13 ++++++------ plugin/storage/grpc/factory.go | 10 ++++----- plugin/storage/grpc/factory_test.go | 27 +++++++++++++++++++------ plugin/storage/grpc/options.go | 1 + plugin/storage/grpc/options_test.go | 14 +++++++++++++ plugin/storage/grpc/plugin.go | 3 ++- plugin/storage/grpc/shared/interface.go | 3 +-- 8 files changed, 71 insertions(+), 24 deletions(-) diff --git a/cmd/noop-grpc-plugin/load_test.go b/cmd/noop-grpc-plugin/load_test.go index 35a872c50e3..60f90629504 100644 --- a/cmd/noop-grpc-plugin/load_test.go +++ b/cmd/noop-grpc-plugin/load_test.go @@ -1,13 +1,29 @@ +// 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 main import ( - "github.com/jaegertracing/jaeger/model" - "github.com/jaegertracing/jaeger/plugin/storage/grpc" + "testing" + "time" + "github.com/spf13/viper" "github.com/uber/jaeger-lib/metrics/prometheus" "go.uber.org/zap" - "testing" - "time" + + "github.com/jaegertracing/jaeger/model" + "github.com/jaegertracing/jaeger/plugin/storage/grpc" ) var logger = zap.NewNop() diff --git a/cmd/noop-grpc-plugin/main.go b/cmd/noop-grpc-plugin/main.go index ffa82e4b98b..3832044ee19 100644 --- a/cmd/noop-grpc-plugin/main.go +++ b/cmd/noop-grpc-plugin/main.go @@ -17,15 +17,17 @@ package main import ( "context" "flag" + "path" + "strings" + "time" + "github.com/hashicorp/go-plugin" + "github.com/spf13/viper" + "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" "github.com/jaegertracing/jaeger/plugin/storage/memory" "github.com/jaegertracing/jaeger/storage/spanstore" - "github.com/spf13/viper" - "path" - "strings" - "time" ) var configPath string @@ -60,7 +62,6 @@ func main() { } type noopStore struct { - } func (*noopStore) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { @@ -80,7 +81,7 @@ func (*noopStore) GetOperations(ctx context.Context, service string) ([]string, } func (*noopStore) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { - return nil,nil + return nil, nil } func (*noopStore) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { diff --git a/plugin/storage/grpc/factory.go b/plugin/storage/grpc/factory.go index 29a928f4e56..b6f36a70fe0 100644 --- a/plugin/storage/grpc/factory.go +++ b/plugin/storage/grpc/factory.go @@ -16,14 +16,14 @@ package grpc import ( "flag" - "github.com/jaegertracing/jaeger/pkg/grpc/config" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" - "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/spf13/viper" "github.com/uber/jaeger-lib/metrics" "go.uber.org/zap" + "github.com/jaegertracing/jaeger/pkg/grpc/config" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" + "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/storage/spanstore" ) @@ -32,9 +32,9 @@ type Factory struct { metricsFactory metrics.Factory logger *zap.Logger - builder config.PluginBuilder + builder config.PluginBuilder - store shared.StoragePlugin + store shared.StoragePlugin } // NewFactory creates a new Factory. diff --git a/plugin/storage/grpc/factory_test.go b/plugin/storage/grpc/factory_test.go index 613fab54b01..72a2023ba7f 100644 --- a/plugin/storage/grpc/factory_test.go +++ b/plugin/storage/grpc/factory_test.go @@ -1,20 +1,35 @@ +// 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 ( "context" "errors" - "github.com/jaegertracing/jaeger/model" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" - "github.com/jaegertracing/jaeger/storage/spanstore" + "testing" + "time" + "github.com/spf13/viper" "github.com/uber/jaeger-lib/metrics" "go.uber.org/zap" - "testing" - "time" + "github.com/stretchr/testify/assert" + "github.com/jaegertracing/jaeger/model" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" + "github.com/jaegertracing/jaeger/storage/spanstore" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/storage" - "github.com/stretchr/testify/assert" ) var _ storage.Factory = new(Factory) diff --git a/plugin/storage/grpc/options.go b/plugin/storage/grpc/options.go index 94917671c45..0adf26404ee 100644 --- a/plugin/storage/grpc/options.go +++ b/plugin/storage/grpc/options.go @@ -16,6 +16,7 @@ package grpc import ( "flag" + "github.com/spf13/viper" "github.com/jaegertracing/jaeger/pkg/grpc/config" diff --git a/plugin/storage/grpc/options_test.go b/plugin/storage/grpc/options_test.go index 225849d6891..510a1033e93 100644 --- a/plugin/storage/grpc/options_test.go +++ b/plugin/storage/grpc/options_test.go @@ -1,3 +1,17 @@ +// 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 ( diff --git a/plugin/storage/grpc/plugin.go b/plugin/storage/grpc/plugin.go index 34da046953b..f540c030dc9 100644 --- a/plugin/storage/grpc/plugin.go +++ b/plugin/storage/grpc/plugin.go @@ -16,11 +16,12 @@ package grpc import ( "context" + "time" + "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/pkg/grpc/config" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" "github.com/jaegertracing/jaeger/storage/spanstore" - "time" ) type Store struct { diff --git a/plugin/storage/grpc/shared/interface.go b/plugin/storage/grpc/shared/interface.go index 027596be7f6..d9a1c1f3a05 100644 --- a/plugin/storage/grpc/shared/interface.go +++ b/plugin/storage/grpc/shared/interface.go @@ -17,12 +17,11 @@ package shared import ( "context" - "github.com/jaegertracing/jaeger/storage/dependencystore" - "github.com/hashicorp/go-plugin" "google.golang.org/grpc" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/storage/spanstore" ) From 9925b381d0a936f73d7ae22a0a6136ac8e88c14e Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 9 Apr 2019 16:43:53 +0100 Subject: [PATCH 06/30] Remove unused plugin file Signed-off-by: Charles Dixon --- plugin/storage/grpc/plugin.go | 59 ----------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 plugin/storage/grpc/plugin.go diff --git a/plugin/storage/grpc/plugin.go b/plugin/storage/grpc/plugin.go deleted file mode 100644 index f540c030dc9..00000000000 --- a/plugin/storage/grpc/plugin.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2018 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 ( - "context" - "time" - - "github.com/jaegertracing/jaeger/model" - "github.com/jaegertracing/jaeger/pkg/grpc/config" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" - "github.com/jaegertracing/jaeger/storage/spanstore" -) - -type Store struct { - config config.Configuration - - plugin shared.StoragePlugin -} - -func (s *Store) WriteSpan(span *model.Span) error { - return s.plugin.WriteSpan(span) -} - -func (s *Store) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - return s.plugin.GetTrace(ctx, traceID) -} - -func (s *Store) GetServices(ctx context.Context) ([]string, error) { - return s.plugin.GetServices(ctx) -} - -func (s *Store) GetOperations(ctx context.Context, service string) ([]string, error) { - return s.plugin.GetOperations(ctx, service) -} - -func (s *Store) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { - return s.plugin.FindTraces(ctx, query) -} - -func (s *Store) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { - return s.plugin.FindTraceIDs(ctx, query) -} - -func (s *Store) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { - return s.plugin.GetDependencies(endTs, lookback) -} From 74aaf5e46b0ba70cc5b7eef2fe7a1f0c57b7d79b Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 9 Apr 2019 16:32:48 +0100 Subject: [PATCH 07/30] Add comments to uncommented functions Signed-off-by: Charles Dixon --- pkg/grpc/config/config.go | 2 ++ plugin/storage/grpc/factory.go | 1 + plugin/storage/grpc/options.go | 4 ++++ plugin/storage/grpc/shared/grpc.go | 31 ++++++++++++++++++------- plugin/storage/grpc/shared/interface.go | 2 ++ 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/pkg/grpc/config/config.go b/pkg/grpc/config/config.go index 4e72ea585d0..0e206e9b132 100644 --- a/pkg/grpc/config/config.go +++ b/pkg/grpc/config/config.go @@ -31,6 +31,7 @@ type Configuration struct { PluginConfigurationFile string `yaml:"configuration-file"` } +// Build instantiates a StoragePlugin func (c *Configuration) Build() (shared.StoragePlugin, error) { // #nosec G204 cmd := exec.Command(c.PluginBinary, "--config", c.PluginConfigurationFile) @@ -69,6 +70,7 @@ func (c *Configuration) Build() (shared.StoragePlugin, error) { return storagePlugin, nil } +// PluginBuilder is used to create storage plugins type PluginBuilder interface { Build() (shared.StoragePlugin, error) } diff --git a/plugin/storage/grpc/factory.go b/plugin/storage/grpc/factory.go index b6f36a70fe0..f1284c7d716 100644 --- a/plugin/storage/grpc/factory.go +++ b/plugin/storage/grpc/factory.go @@ -27,6 +27,7 @@ import ( "github.com/jaegertracing/jaeger/storage/spanstore" ) +// Factory implements storage.Factory and creates storage components backed by a storage plugin. type Factory struct { options Options metricsFactory metrics.Factory diff --git a/plugin/storage/grpc/options.go b/plugin/storage/grpc/options.go index 0adf26404ee..1961c205eb6 100644 --- a/plugin/storage/grpc/options.go +++ b/plugin/storage/grpc/options.go @@ -25,15 +25,19 @@ import ( const pluginBinary = "grpc-storage-plugin.binary" const pluginConfigurationFile = "grpc-storage-plugin.configuration-file" +// Options contains GRPC plugins configs and provides the ability +// to bind them to command line flags type Options struct { Configuration config.Configuration } +// AddFlags adds flags for Options func (opt *Options) AddFlags(flagSet *flag.FlagSet) { flagSet.String(pluginBinary, "", "The location of the plugin binary") flagSet.String(pluginConfigurationFile, "", "A path pointing to the plugin's configuration file, made available to the plugin with the --config arg") } +// InitFromViper initializes Options with properties from viper func (opt *Options) InitFromViper(v *viper.Viper) { opt.Configuration.PluginBinary = v.GetString(pluginBinary) opt.Configuration.PluginConfigurationFile = v.GetString(pluginConfigurationFile) diff --git a/plugin/storage/grpc/shared/grpc.go b/plugin/storage/grpc/shared/grpc.go index 7d162b7552e..3acc1f1f4e1 100644 --- a/plugin/storage/grpc/shared/grpc.go +++ b/plugin/storage/grpc/shared/grpc.go @@ -25,15 +25,16 @@ import ( "github.com/jaegertracing/jaeger/storage/spanstore" ) -// temporary -const span_batch_size = 1000 +const spanBatchSize = 1000 +// GRPCClient implements shared.StoragePlugin and reads/writes spans and dependencies type GRPCClient struct { readerClient storage_v1.SpanReaderPluginClient writerClient storage_v1.SpanWriterPluginClient depsReaderClient storage_v1.DependenciesReaderPluginClient } +// GetTrace takes a traceID and returns a Trace associated with that traceID func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { stream, err := c.readerClient.GetTrace(ctx, &storage_v1.GetTraceRequest{ TraceID: traceID, @@ -61,6 +62,7 @@ func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode return &trace, nil } +// GetServices returns a list of all known services func (c *GRPCClient) GetServices(ctx context.Context) ([]string, error) { resp, err := c.readerClient.GetServices(ctx, &storage_v1.GetServicesRequest{}) if err != nil { @@ -70,6 +72,7 @@ func (c *GRPCClient) GetServices(ctx context.Context) ([]string, error) { return resp.Services, nil } +// GetOperations returns the operations of a given service func (c *GRPCClient) GetOperations(ctx context.Context, service string) ([]string, error) { resp, err := c.readerClient.GetOperations(ctx, &storage_v1.GetOperationsRequest{ Service: service, @@ -81,6 +84,7 @@ func (c *GRPCClient) GetOperations(ctx context.Context, service string) ([]strin return resp.Operations, nil } +// FindTraces retrieves traces that match the traceQuery func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { stream, err := c.readerClient.FindTraces(context.Background(), &storage_v1.FindTracesRequest{ Query: &storage_v1.TraceQueryParameters{ @@ -128,6 +132,7 @@ func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery return traces, nil } +// FindTraceIDs retrieves traceIDs that match the traceQuery func (c *GRPCClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { resp, err := c.readerClient.FindTraceIDs(context.Background(), &storage_v1.FindTraceIDsRequest{ Query: &storage_v1.TraceQueryParameters{ @@ -148,6 +153,7 @@ func (c *GRPCClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQue return resp.TraceIDs, nil } +// WriteSpan saves the span func (c *GRPCClient) WriteSpan(span *model.Span) error { _, err := c.writerClient.WriteSpan(context.Background(), &storage_v1.WriteSpanRequest{ Span: span, @@ -159,6 +165,7 @@ func (c *GRPCClient) WriteSpan(span *model.Span) error { return nil } +// GetDependencies returns all interservice dependencies func (c *GRPCClient) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { resp, err := c.depsReaderClient.GetDependencies(context.Background(), &storage_v1.GetDependenciesRequest{ EndTime: endTs, @@ -171,10 +178,12 @@ func (c *GRPCClient) GetDependencies(endTs time.Time, lookback time.Duration) ([ return resp.Dependencies, nil } +// GRPCServer implements shared.StoragePlugin and reads/writes spans and dependencies type GRPCServer struct { Impl StoragePlugin } +// GetDependencies returns all interservice dependencies func (s *GRPCServer) GetDependencies(ctx context.Context, r *storage_v1.GetDependenciesRequest) (*storage_v1.GetDependenciesResponse, error) { deps, err := s.Impl.GetDependencies(r.EndTime, r.EndTime.Sub(r.StartTime)) if err != nil { @@ -185,6 +194,7 @@ func (s *GRPCServer) GetDependencies(ctx context.Context, r *storage_v1.GetDepen }, nil } +// WriteSpan saves the span func (s *GRPCServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanRequest) (*storage_v1.WriteSpanResponse, error) { err := s.Impl.WriteSpan(r.Span) if err != nil { @@ -193,6 +203,7 @@ func (s *GRPCServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanReque return &storage_v1.WriteSpanResponse{}, nil } +// GetTrace takes a traceID and streams a Trace associated with that traceID func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.SpanReaderPlugin_GetTraceServer) error { trace, err := s.Impl.GetTrace(stream.Context(), r.TraceID) if err != nil { @@ -200,13 +211,13 @@ func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.S } var allSpans [][]model.Span - currentSpans := make([]model.Span, 0, span_batch_size) + currentSpans := make([]model.Span, 0, spanBatchSize) i := 0 for _, span := range trace.Spans { - if i == span_batch_size { + if i == spanBatchSize { i = 0 allSpans = append(allSpans, currentSpans) - currentSpans = make([]model.Span, 0, span_batch_size) + currentSpans = make([]model.Span, 0, spanBatchSize) } currentSpans = append(currentSpans, *span) i++ @@ -225,6 +236,7 @@ func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.S return nil } +// GetServices returns a list of all known services func (s *GRPCServer) GetServices(ctx context.Context, r *storage_v1.GetServicesRequest) (*storage_v1.GetServicesResponse, error) { services, err := s.Impl.GetServices(ctx) if err != nil { @@ -235,6 +247,7 @@ func (s *GRPCServer) GetServices(ctx context.Context, r *storage_v1.GetServicesR }, nil } +// GetOperations returns the operations of a given service func (s *GRPCServer) GetOperations(ctx context.Context, r *storage_v1.GetOperationsRequest) (*storage_v1.GetOperationsResponse, error) { operations, err := s.Impl.GetOperations(ctx, r.Service) if err != nil { @@ -245,6 +258,7 @@ func (s *GRPCServer) GetOperations(ctx context.Context, r *storage_v1.GetOperati }, nil } +// FindTraces streams traces that match the traceQuery func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_v1.SpanReaderPlugin_FindTracesServer) error { traces, err := s.Impl.FindTraces(stream.Context(), &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, @@ -261,14 +275,14 @@ func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_ } var allSpans [][]model.Span - currentSpans := make([]model.Span, 0, span_batch_size) + currentSpans := make([]model.Span, 0, spanBatchSize) i := 0 for _, trace := range traces { for _, span := range trace.Spans { - if i == span_batch_size { + if i == spanBatchSize { i = 0 allSpans = append(allSpans, currentSpans) - currentSpans = make([]model.Span, 0, span_batch_size) + currentSpans = make([]model.Span, 0, spanBatchSize) } currentSpans = append(currentSpans, *span) i++ @@ -288,6 +302,7 @@ func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_ return nil } +// FindTraceIDs retrieves traceIDs that match the traceQuery func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceIDsRequest) (*storage_v1.FindTraceIDsResponse, error) { traceIDs, err := s.Impl.FindTraceIDs(ctx, &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, diff --git a/plugin/storage/grpc/shared/interface.go b/plugin/storage/grpc/shared/interface.go index d9a1c1f3a05..f82ce351621 100644 --- a/plugin/storage/grpc/shared/interface.go +++ b/plugin/storage/grpc/shared/interface.go @@ -54,6 +54,7 @@ type StorageGRPCPlugin struct { Impl StoragePlugin } +// GRPCServer is used by go-plugin to create a grpc plugin server func (p *StorageGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { server := &GRPCServer{Impl: p.Impl} storage_v1.RegisterSpanReaderPluginServer(s, server) @@ -62,6 +63,7 @@ func (p *StorageGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server return nil } +// GRPCClient is used by go-plugin to create a grpc plugin client func (*StorageGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) { return &GRPCClient{ readerClient: storage_v1.NewSpanReaderPluginClient(c), From a8a01149efe717667601b162225535f699a09940 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 9 Apr 2019 16:36:26 +0100 Subject: [PATCH 08/30] Split grpc server and client into separate files Signed-off-by: Charles Dixon --- .../grpc/shared/{grpc.go => grpc_client.go} | 144 ---------------- plugin/storage/grpc/shared/grpc_server.go | 155 ++++++++++++++++++ 2 files changed, 155 insertions(+), 144 deletions(-) rename plugin/storage/grpc/shared/{grpc.go => grpc_client.go} (54%) create mode 100644 plugin/storage/grpc/shared/grpc_server.go diff --git a/plugin/storage/grpc/shared/grpc.go b/plugin/storage/grpc/shared/grpc_client.go similarity index 54% rename from plugin/storage/grpc/shared/grpc.go rename to plugin/storage/grpc/shared/grpc_client.go index 3acc1f1f4e1..f9cfc7fb022 100644 --- a/plugin/storage/grpc/shared/grpc.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -177,147 +177,3 @@ func (c *GRPCClient) GetDependencies(endTs time.Time, lookback time.Duration) ([ return resp.Dependencies, nil } - -// GRPCServer implements shared.StoragePlugin and reads/writes spans and dependencies -type GRPCServer struct { - Impl StoragePlugin -} - -// GetDependencies returns all interservice dependencies -func (s *GRPCServer) GetDependencies(ctx context.Context, r *storage_v1.GetDependenciesRequest) (*storage_v1.GetDependenciesResponse, error) { - deps, err := s.Impl.GetDependencies(r.EndTime, r.EndTime.Sub(r.StartTime)) - if err != nil { - return nil, err - } - return &storage_v1.GetDependenciesResponse{ - Dependencies: deps, - }, nil -} - -// WriteSpan saves the span -func (s *GRPCServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanRequest) (*storage_v1.WriteSpanResponse, error) { - err := s.Impl.WriteSpan(r.Span) - if err != nil { - return nil, err - } - return &storage_v1.WriteSpanResponse{}, nil -} - -// GetTrace takes a traceID and streams a Trace associated with that traceID -func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.SpanReaderPlugin_GetTraceServer) error { - trace, err := s.Impl.GetTrace(stream.Context(), r.TraceID) - if err != nil { - return err - } - - var allSpans [][]model.Span - currentSpans := make([]model.Span, 0, spanBatchSize) - i := 0 - for _, span := range trace.Spans { - if i == spanBatchSize { - i = 0 - allSpans = append(allSpans, currentSpans) - currentSpans = make([]model.Span, 0, spanBatchSize) - } - currentSpans = append(currentSpans, *span) - i++ - } - if len(currentSpans) > 0 { - allSpans = append(allSpans, currentSpans) - } - - for _, spans := range allSpans { - err = stream.Send(&storage_v1.SpansResponseChunk{Spans: spans}) - if err != nil { - return err - } - } - - return nil -} - -// GetServices returns a list of all known services -func (s *GRPCServer) GetServices(ctx context.Context, r *storage_v1.GetServicesRequest) (*storage_v1.GetServicesResponse, error) { - services, err := s.Impl.GetServices(ctx) - if err != nil { - return nil, err - } - return &storage_v1.GetServicesResponse{ - Services: services, - }, nil -} - -// GetOperations returns the operations of a given service -func (s *GRPCServer) GetOperations(ctx context.Context, r *storage_v1.GetOperationsRequest) (*storage_v1.GetOperationsResponse, error) { - operations, err := s.Impl.GetOperations(ctx, r.Service) - if err != nil { - return nil, err - } - return &storage_v1.GetOperationsResponse{ - Operations: operations, - }, nil -} - -// FindTraces streams traces that match the traceQuery -func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_v1.SpanReaderPlugin_FindTracesServer) error { - traces, err := s.Impl.FindTraces(stream.Context(), &spanstore.TraceQueryParameters{ - ServiceName: r.Query.ServiceName, - OperationName: r.Query.OperationName, - Tags: r.Query.Tags, - StartTimeMin: r.Query.StartTimeMin, - StartTimeMax: r.Query.StartTimeMax, - DurationMin: r.Query.DurationMin, - DurationMax: r.Query.DurationMax, - NumTraces: int(r.Query.NumTraces), - }) - if err != nil { - return err - } - - var allSpans [][]model.Span - currentSpans := make([]model.Span, 0, spanBatchSize) - i := 0 - for _, trace := range traces { - for _, span := range trace.Spans { - if i == spanBatchSize { - i = 0 - allSpans = append(allSpans, currentSpans) - currentSpans = make([]model.Span, 0, spanBatchSize) - } - currentSpans = append(currentSpans, *span) - i++ - } - } - if len(currentSpans) > 0 { - allSpans = append(allSpans, currentSpans) - } - - for _, spans := range allSpans { - err = stream.Send(&storage_v1.SpansResponseChunk{Spans: spans}) - if err != nil { - return err - } - } - - return nil -} - -// FindTraceIDs retrieves traceIDs that match the traceQuery -func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceIDsRequest) (*storage_v1.FindTraceIDsResponse, error) { - traceIDs, err := s.Impl.FindTraceIDs(ctx, &spanstore.TraceQueryParameters{ - ServiceName: r.Query.ServiceName, - OperationName: r.Query.OperationName, - Tags: r.Query.Tags, - StartTimeMin: r.Query.StartTimeMin, - StartTimeMax: r.Query.StartTimeMax, - DurationMin: r.Query.DurationMin, - DurationMax: r.Query.DurationMax, - NumTraces: int(r.Query.NumTraces), - }) - if err != nil { - return nil, err - } - return &storage_v1.FindTraceIDsResponse{ - TraceIDs: traceIDs, - }, nil -} diff --git a/plugin/storage/grpc/shared/grpc_server.go b/plugin/storage/grpc/shared/grpc_server.go new file mode 100644 index 00000000000..ce44ec20ff1 --- /dev/null +++ b/plugin/storage/grpc/shared/grpc_server.go @@ -0,0 +1,155 @@ +package shared + +import ( + "context" + + "github.com/jaegertracing/jaeger/model" + "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + "github.com/jaegertracing/jaeger/storage/spanstore" +) + +const spanBatchSize = 1000 + +// GRPCServer implements shared.StoragePlugin and reads/writes spans and dependencies +type GRPCServer struct { + Impl StoragePlugin +} + +// GetDependencies returns all interservice dependencies +func (s *GRPCServer) GetDependencies(ctx context.Context, r *storage_v1.GetDependenciesRequest) (*storage_v1.GetDependenciesResponse, error) { + deps, err := s.Impl.GetDependencies(r.EndTime, r.EndTime.Sub(r.StartTime)) + if err != nil { + return nil, err + } + return &storage_v1.GetDependenciesResponse{ + Dependencies: deps, + }, nil +} + +// WriteSpan saves the span +func (s *GRPCServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanRequest) (*storage_v1.WriteSpanResponse, error) { + err := s.Impl.WriteSpan(r.Span) + if err != nil { + return nil, err + } + return &storage_v1.WriteSpanResponse{}, nil +} + +// GetTrace takes a traceID and streams a Trace associated with that traceID +func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.SpanReaderPlugin_GetTraceServer) error { + trace, err := s.Impl.GetTrace(stream.Context(), r.TraceID) + if err != nil { + return err + } + + var allSpans [][]model.Span + currentSpans := make([]model.Span, 0, spanBatchSize) + i := 0 + for _, span := range trace.Spans { + if i == spanBatchSize { + i = 0 + allSpans = append(allSpans, currentSpans) + currentSpans = make([]model.Span, 0, spanBatchSize) + } + currentSpans = append(currentSpans, *span) + i++ + } + if len(currentSpans) > 0 { + allSpans = append(allSpans, currentSpans) + } + + for _, spans := range allSpans { + err = stream.Send(&storage_v1.SpansResponseChunk{Spans: spans}) + if err != nil { + return err + } + } + + return nil +} + +// GetServices returns a list of all known services +func (s *GRPCServer) GetServices(ctx context.Context, r *storage_v1.GetServicesRequest) (*storage_v1.GetServicesResponse, error) { + services, err := s.Impl.GetServices(ctx) + if err != nil { + return nil, err + } + return &storage_v1.GetServicesResponse{ + Services: services, + }, nil +} + +// GetOperations returns the operations of a given service +func (s *GRPCServer) GetOperations(ctx context.Context, r *storage_v1.GetOperationsRequest) (*storage_v1.GetOperationsResponse, error) { + operations, err := s.Impl.GetOperations(ctx, r.Service) + if err != nil { + return nil, err + } + return &storage_v1.GetOperationsResponse{ + Operations: operations, + }, nil +} + +// FindTraces streams traces that match the traceQuery +func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_v1.SpanReaderPlugin_FindTracesServer) error { + traces, err := s.Impl.FindTraces(stream.Context(), &spanstore.TraceQueryParameters{ + ServiceName: r.Query.ServiceName, + OperationName: r.Query.OperationName, + Tags: r.Query.Tags, + StartTimeMin: r.Query.StartTimeMin, + StartTimeMax: r.Query.StartTimeMax, + DurationMin: r.Query.DurationMin, + DurationMax: r.Query.DurationMax, + NumTraces: int(r.Query.NumTraces), + }) + if err != nil { + return err + } + + var allSpans [][]model.Span + currentSpans := make([]model.Span, 0, spanBatchSize) + i := 0 + for _, trace := range traces { + for _, span := range trace.Spans { + if i == spanBatchSize { + i = 0 + allSpans = append(allSpans, currentSpans) + currentSpans = make([]model.Span, 0, spanBatchSize) + } + currentSpans = append(currentSpans, *span) + i++ + } + } + if len(currentSpans) > 0 { + allSpans = append(allSpans, currentSpans) + } + + for _, spans := range allSpans { + err = stream.Send(&storage_v1.SpansResponseChunk{Spans: spans}) + if err != nil { + return err + } + } + + return nil +} + +// FindTraceIDs retrieves traceIDs that match the traceQuery +func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceIDsRequest) (*storage_v1.FindTraceIDsResponse, error) { + traceIDs, err := s.Impl.FindTraceIDs(ctx, &spanstore.TraceQueryParameters{ + ServiceName: r.Query.ServiceName, + OperationName: r.Query.OperationName, + Tags: r.Query.Tags, + StartTimeMin: r.Query.StartTimeMin, + StartTimeMax: r.Query.StartTimeMax, + DurationMin: r.Query.DurationMin, + DurationMax: r.Query.DurationMax, + NumTraces: int(r.Query.NumTraces), + }) + if err != nil { + return nil, err + } + return &storage_v1.FindTraceIDsResponse{ + TraceIDs: traceIDs, + }, nil +} From ef0078f14dde9aa7921ff059252cdc1f9d0632df Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 9 Apr 2019 16:39:46 +0100 Subject: [PATCH 09/30] Use errors.wrap rather than fmt for errors Signed-off-by: Charles Dixon --- plugin/storage/grpc/shared/grpc_client.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index f9cfc7fb022..07e7b24bc0c 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -20,13 +20,13 @@ import ( "io" "time" + "github.com/pkg/errors" + "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" "github.com/jaegertracing/jaeger/storage/spanstore" ) -const spanBatchSize = 1000 - // GRPCClient implements shared.StoragePlugin and reads/writes spans and dependencies type GRPCClient struct { readerClient storage_v1.SpanReaderPluginClient @@ -40,7 +40,7 @@ func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode TraceID: traceID, }) if err != nil { - return nil, fmt.Errorf("plugin error: %s", err) + return nil, errors.Wrap(err, "plugin error") } trace := model.Trace{} @@ -66,7 +66,7 @@ func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode func (c *GRPCClient) GetServices(ctx context.Context) ([]string, error) { resp, err := c.readerClient.GetServices(ctx, &storage_v1.GetServicesRequest{}) if err != nil { - return nil, fmt.Errorf("plugin error: %s", err) + return nil, errors.Wrap(err, "plugin error") } return resp.Services, nil @@ -78,7 +78,7 @@ func (c *GRPCClient) GetOperations(ctx context.Context, service string) ([]strin Service: service, }) if err != nil { - return nil, fmt.Errorf("grpc error: %s", err) + return nil, errors.Wrap(err, "plugin error") } return resp.Operations, nil @@ -99,7 +99,7 @@ func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery }, }) if err != nil { - return nil, fmt.Errorf("plugin error: %s", err) + return nil, errors.Wrap(err, "plugin error") } var traces []*model.Trace @@ -112,7 +112,7 @@ func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery } if err != nil { - return nil, fmt.Errorf("stream error: %s", err) + return nil, errors.Wrap(err, "stream error") } for i, span := range received.Spans { @@ -147,7 +147,7 @@ func (c *GRPCClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQue }, }) if err != nil { - return nil, fmt.Errorf("plugin error: %s", err) + return nil, errors.Wrap(err, "plugin error") } return resp.TraceIDs, nil @@ -159,7 +159,7 @@ func (c *GRPCClient) WriteSpan(span *model.Span) error { Span: span, }) if err != nil { - return fmt.Errorf("plugin error: %s", err) + return errors.Wrap(err, "plugin error") } return nil @@ -172,7 +172,7 @@ func (c *GRPCClient) GetDependencies(endTs time.Time, lookback time.Duration) ([ StartTime: endTs.Add(-lookback), }) if err != nil { - return nil, fmt.Errorf("grpc error: %s", err) + return nil, errors.Wrap(err, "plugin error") } return resp.Dependencies, nil From 931dfa4239f057ba2eb193e38e02bb286ff4305d Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Thu, 11 Apr 2019 09:35:10 +0100 Subject: [PATCH 10/30] Add copyright header to grpc server file Signed-off-by: Charles Dixon --- plugin/storage/grpc/shared/grpc_server.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugin/storage/grpc/shared/grpc_server.go b/plugin/storage/grpc/shared/grpc_server.go index ce44ec20ff1..2624d88e972 100644 --- a/plugin/storage/grpc/shared/grpc_server.go +++ b/plugin/storage/grpc/shared/grpc_server.go @@ -1,3 +1,17 @@ +// 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 shared import ( From d5fe102a2ae2d25359128790575ed7b577d5a0cf Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Thu, 11 Apr 2019 09:38:11 +0100 Subject: [PATCH 11/30] Update headers to updated license on uncommitted files Signed-off-by: Charles Dixon --- pkg/grpc/config/config.go | 2 +- plugin/storage/grpc/factory.go | 2 +- plugin/storage/grpc/factory_test.go | 9 ++++----- plugin/storage/grpc/options.go | 2 +- plugin/storage/grpc/shared/grpc_client.go | 2 +- plugin/storage/grpc/shared/interface.go | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pkg/grpc/config/config.go b/pkg/grpc/config/config.go index 0e206e9b132..e8890d360a5 100644 --- a/pkg/grpc/config/config.go +++ b/pkg/grpc/config/config.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018 The Jaeger Authors. +// 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. diff --git a/plugin/storage/grpc/factory.go b/plugin/storage/grpc/factory.go index f1284c7d716..a1963b7cb94 100644 --- a/plugin/storage/grpc/factory.go +++ b/plugin/storage/grpc/factory.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018 The Jaeger Authors. +// 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. diff --git a/plugin/storage/grpc/factory_test.go b/plugin/storage/grpc/factory_test.go index 72a2023ba7f..fe450b2f65e 100644 --- a/plugin/storage/grpc/factory_test.go +++ b/plugin/storage/grpc/factory_test.go @@ -21,22 +21,22 @@ import ( "time" "github.com/spf13/viper" + "github.com/stretchr/testify/assert" "github.com/uber/jaeger-lib/metrics" "go.uber.org/zap" - "github.com/stretchr/testify/assert" "github.com/jaegertracing/jaeger/model" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" - "github.com/jaegertracing/jaeger/storage/spanstore" "github.com/jaegertracing/jaeger/pkg/config" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" "github.com/jaegertracing/jaeger/storage" + "github.com/jaegertracing/jaeger/storage/spanstore" ) var _ storage.Factory = new(Factory) type mockPluginBuilder struct { plugin *mockPlugin - err error + err error } func (b *mockPluginBuilder) Build() (shared.StoragePlugin, error) { @@ -47,7 +47,6 @@ func (b *mockPluginBuilder) Build() (shared.StoragePlugin, error) { } type mockPlugin struct { - } func (*mockPlugin) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { diff --git a/plugin/storage/grpc/options.go b/plugin/storage/grpc/options.go index 1961c205eb6..9c6790bba51 100644 --- a/plugin/storage/grpc/options.go +++ b/plugin/storage/grpc/options.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018 The Jaeger Authors. +// 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. diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index 07e7b24bc0c..7fd19a5e911 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018 The Jaeger Authors. +// 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. diff --git a/plugin/storage/grpc/shared/interface.go b/plugin/storage/grpc/shared/interface.go index f82ce351621..9a922c98db3 100644 --- a/plugin/storage/grpc/shared/interface.go +++ b/plugin/storage/grpc/shared/interface.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018 The Jaeger Authors. +// 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. From f180890ee380cf26bd4d91e9ac52869d4096e032 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Wed, 24 Apr 2019 09:35:14 +0100 Subject: [PATCH 12/30] Move grpc config to plugin/storage Signed-off-by: Charles Dixon --- {pkg => plugin/storage}/grpc/config/config.go | 0 plugin/storage/grpc/factory.go | 2 +- plugin/storage/grpc/options.go | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename {pkg => plugin/storage}/grpc/config/config.go (100%) diff --git a/pkg/grpc/config/config.go b/plugin/storage/grpc/config/config.go similarity index 100% rename from pkg/grpc/config/config.go rename to plugin/storage/grpc/config/config.go diff --git a/plugin/storage/grpc/factory.go b/plugin/storage/grpc/factory.go index a1963b7cb94..0e2d8004c48 100644 --- a/plugin/storage/grpc/factory.go +++ b/plugin/storage/grpc/factory.go @@ -21,7 +21,7 @@ import ( "github.com/uber/jaeger-lib/metrics" "go.uber.org/zap" - "github.com/jaegertracing/jaeger/pkg/grpc/config" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/config" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/storage/spanstore" diff --git a/plugin/storage/grpc/options.go b/plugin/storage/grpc/options.go index 9c6790bba51..82cac8d9311 100644 --- a/plugin/storage/grpc/options.go +++ b/plugin/storage/grpc/options.go @@ -19,7 +19,7 @@ import ( "github.com/spf13/viper" - "github.com/jaegertracing/jaeger/pkg/grpc/config" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/config" ) const pluginBinary = "grpc-storage-plugin.binary" From 419f4cefea5bf3077f312944797b47c7cf5c4863 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Tue, 23 Apr 2019 18:48:30 -0400 Subject: [PATCH 13/30] Add empty test files to fix build Signed-off-by: Yuri Shkuro --- pkg/grpc/config/empty_test.go | 15 +++++++++++++++ plugin/storage/grpc/shared/empty_test.go | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 pkg/grpc/config/empty_test.go create mode 100644 plugin/storage/grpc/shared/empty_test.go diff --git a/pkg/grpc/config/empty_test.go b/pkg/grpc/config/empty_test.go new file mode 100644 index 00000000000..6e632bd9e87 --- /dev/null +++ b/pkg/grpc/config/empty_test.go @@ -0,0 +1,15 @@ +// Copyright (c) 2018 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 diff --git a/plugin/storage/grpc/shared/empty_test.go b/plugin/storage/grpc/shared/empty_test.go new file mode 100644 index 00000000000..5f6014db2d3 --- /dev/null +++ b/plugin/storage/grpc/shared/empty_test.go @@ -0,0 +1,15 @@ +// Copyright (c) 2018 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 shared From 3919ac68b9b4d852432204712b55cc3d7a0446ac Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Fri, 26 Apr 2019 08:41:59 +0100 Subject: [PATCH 14/30] Move grpc config empty_test file Signed-off-by: Charles Dixon --- {pkg => plugin/storage}/grpc/config/empty_test.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {pkg => plugin/storage}/grpc/config/empty_test.go (100%) diff --git a/pkg/grpc/config/empty_test.go b/plugin/storage/grpc/config/empty_test.go similarity index 100% rename from pkg/grpc/config/empty_test.go rename to plugin/storage/grpc/config/empty_test.go From 7ffb8b6091cd6189d8ebe93f01973c31e6b1af71 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 30 Apr 2019 11:16:32 +0100 Subject: [PATCH 15/30] Change fmt for error to errors.Wrap Signed-off-by: Charles Dixon --- plugin/storage/grpc/shared/grpc_client.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index 7fd19a5e911..08e2c6fc92b 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -16,7 +16,6 @@ package shared import ( "context" - "fmt" "io" "time" @@ -51,7 +50,7 @@ func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode } if err != nil { - return nil, fmt.Errorf("stream error: %s", err) + return nil, errors.Wrap(err, "grpc stream error") } for _, span := range received.Spans { From c136b378874c8bb61301c839777498296ff19cf7 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 30 Apr 2019 11:34:17 +0100 Subject: [PATCH 16/30] Use single-line for comprehensions where possible Signed-off-by: Charles Dixon --- plugin/storage/grpc/shared/grpc_client.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index 08e2c6fc92b..4705fbf76fa 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -43,12 +43,7 @@ func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode } trace := model.Trace{} - for { - received, err := stream.Recv() - if err == io.EOF { - break - } - + for received, err := stream.Recv(); err != io.EOF; received, err = stream.Recv() { if err != nil { return nil, errors.Wrap(err, "grpc stream error") } @@ -104,12 +99,7 @@ func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery var traces []*model.Trace var trace *model.Trace var traceID model.TraceID - for { - received, err := stream.Recv() - if err == io.EOF { - break - } - + for received, err := stream.Recv(); err != io.EOF; received, err = stream.Recv() { if err != nil { return nil, errors.Wrap(err, "stream error") } From 978eb0786d10b76028219c23c44780903c87fd57 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 30 Apr 2019 13:08:08 +0100 Subject: [PATCH 17/30] Don't accumulate spans before sending Signed-off-by: Charles Dixon --- plugin/storage/grpc/shared/grpc_server.go | 61 ++++++++--------------- 1 file changed, 21 insertions(+), 40 deletions(-) diff --git a/plugin/storage/grpc/shared/grpc_server.go b/plugin/storage/grpc/shared/grpc_server.go index 2624d88e972..43c65fb6281 100644 --- a/plugin/storage/grpc/shared/grpc_server.go +++ b/plugin/storage/grpc/shared/grpc_server.go @@ -17,6 +17,8 @@ package shared import ( "context" + "github.com/pkg/errors" + "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" "github.com/jaegertracing/jaeger/storage/spanstore" @@ -56,27 +58,9 @@ func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.S return err } - var allSpans [][]model.Span - currentSpans := make([]model.Span, 0, spanBatchSize) - i := 0 - for _, span := range trace.Spans { - if i == spanBatchSize { - i = 0 - allSpans = append(allSpans, currentSpans) - currentSpans = make([]model.Span, 0, spanBatchSize) - } - currentSpans = append(currentSpans, *span) - i++ - } - if len(currentSpans) > 0 { - allSpans = append(allSpans, currentSpans) - } - - for _, spans := range allSpans { - err = stream.Send(&storage_v1.SpansResponseChunk{Spans: spans}) - if err != nil { - return err - } + err = s.sendSpans(trace.Spans, stream.Send) + if err != nil { + return err } return nil @@ -120,26 +104,8 @@ func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_ return err } - var allSpans [][]model.Span - currentSpans := make([]model.Span, 0, spanBatchSize) - i := 0 for _, trace := range traces { - for _, span := range trace.Spans { - if i == spanBatchSize { - i = 0 - allSpans = append(allSpans, currentSpans) - currentSpans = make([]model.Span, 0, spanBatchSize) - } - currentSpans = append(currentSpans, *span) - i++ - } - } - if len(currentSpans) > 0 { - allSpans = append(allSpans, currentSpans) - } - - for _, spans := range allSpans { - err = stream.Send(&storage_v1.SpansResponseChunk{Spans: spans}) + err = s.sendSpans(trace.Spans, stream.Send) if err != nil { return err } @@ -167,3 +133,18 @@ func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceID TraceIDs: traceIDs, }, nil } + +func (s *GRPCServer) sendSpans(spans []*model.Span, sendFn func(*storage_v1.SpansResponseChunk) error) error { + chunk := make([]model.Span, 0, len(spans)) + for i := 0; i < len(spans); i += spanBatchSize { + chunk = chunk[:0] + for j := i; j < len(spans) && j < i+spanBatchSize; j++ { + chunk = append(chunk, *spans[j]) + } + if err := sendFn(&storage_v1.SpansResponseChunk{Spans: chunk}); err != nil { + return errors.Wrap(err, "grpc plugin failed to send response") + } + } + + return nil +} From 0abb7261a412b4fc9448ed6c5cfff24c3aff9e2e Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 30 Apr 2019 13:41:11 +0100 Subject: [PATCH 18/30] Add function to serve the plugin Signed-off-by: Charles Dixon --- plugin/storage/grpc/grpc.go | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 plugin/storage/grpc/grpc.go diff --git a/plugin/storage/grpc/grpc.go b/plugin/storage/grpc/grpc.go new file mode 100644 index 00000000000..27671f57f6d --- /dev/null +++ b/plugin/storage/grpc/grpc.go @@ -0,0 +1,49 @@ +// 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" + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" + "google.golang.org/grpc" +) + +func Serve(implementation shared.StoragePlugin) { + plugin.Serve(&plugin.ServeConfig{ + HandshakeConfig: shared.Handshake, + VersionedPlugins: map[int]plugin.PluginSet{ + 1: map[string]plugin.Plugin{ + shared.StoragePluginIdentifier: &shared.StorageGRPCPlugin{ + Impl: implementation, + }, + }, + }, + GRPCServer: plugin.DefaultGRPCServer, + }) +} + +func ServeWithGRPCServer(implementation shared.StoragePlugin, 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: implementation, + }, + }, + }, + GRPCServer: grpcServer, + }) +} From 79e084975ef2324541a88a82135acf8e37db457e Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 30 Apr 2019 15:16:53 +0100 Subject: [PATCH 19/30] Small grpc client refactor Signed-off-by: Charles Dixon --- plugin/storage/grpc/shared/grpc_client.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index 4705fbf76fa..afaa6d615c4 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -106,18 +106,13 @@ func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery for i, span := range received.Spans { if span.TraceID != traceID { - if trace != nil { - traces = append(traces, trace) - } trace = &model.Trace{} traceID = span.TraceID + traces = append(traces, trace) } trace.Spans = append(trace.Spans, &received.Spans[i]) } } - if trace != nil { - traces = append(traces, trace) - } return traces, nil } From b747fb94194b7cbede900b20d933662b5d80c8c2 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 30 Apr 2019 17:29:40 +0100 Subject: [PATCH 20/30] Update grpc interface and move noop plugin to examples Signed-off-by: Charles Dixon --- cmd/noop-grpc-plugin/load_test.go | 91 ---------------------- cmd/noop-grpc-plugin/main.go | 93 ----------------------- examples/memory-store/empty_test.go | 15 ++++ examples/memory-store/main.go | 65 ++++++++++++++++ plugin/storage/grpc/factory.go | 6 +- plugin/storage/grpc/grpc.go | 3 +- plugin/storage/grpc/shared/grpc_client.go | 16 ++++ plugin/storage/grpc/shared/grpc_server.go | 14 ++-- plugin/storage/grpc/shared/interface.go | 6 +- 9 files changed, 111 insertions(+), 198 deletions(-) delete mode 100644 cmd/noop-grpc-plugin/load_test.go delete mode 100644 cmd/noop-grpc-plugin/main.go create mode 100644 examples/memory-store/empty_test.go create mode 100644 examples/memory-store/main.go diff --git a/cmd/noop-grpc-plugin/load_test.go b/cmd/noop-grpc-plugin/load_test.go deleted file mode 100644 index 60f90629504..00000000000 --- a/cmd/noop-grpc-plugin/load_test.go +++ /dev/null @@ -1,91 +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 main - -import ( - "testing" - "time" - - "github.com/spf13/viper" - "github.com/uber/jaeger-lib/metrics/prometheus" - "go.uber.org/zap" - - "github.com/jaegertracing/jaeger/model" - "github.com/jaegertracing/jaeger/plugin/storage/grpc" -) - -var logger = zap.NewNop() - -func BenchmarkNoopSpanWriter(b *testing.B) { - s := &noopStore{} - - for n := 0; n < b.N; n++ { - s.WriteSpan(&model.Span{ - TraceID:model.NewTraceID(1, 2), - SpanID:model.NewSpanID(1), - OperationName: "test", - StartTime: time.Now(), - Duration: 1 * time.Second, - Process: model.NewProcess("process", []model.KeyValue{ - - }), - ProcessID: "process_id", - Tags: []model.KeyValue{ - { - Key:"test", - VStr: "", - }, - }, - }) - } -} - -func BenchmarkGRPCNoopSpanWriter(b *testing.B) { - v := viper.New() - - v.Set("grpc-storage-plugin.binary", "noop-grpc-plugin") - - f := grpc.NewFactory() - f.InitFromViper(v) - - metricsFactory := prometheus.New() - - f.Initialize( metricsFactory, logger) - - sw, err := f.CreateSpanWriter() - if err != nil { - b.Fatal(err) - } - - for n := 0; n < b.N; n++ { - sw.WriteSpan(&model.Span{ - TraceID:model.NewTraceID(1, 2), - SpanID:model.NewSpanID(1), - OperationName: "test", - StartTime: time.Now(), - Duration: 1 * time.Second, - Process: model.NewProcess("process", []model.KeyValue{ - - }), - ProcessID: "process_id", - Tags: []model.KeyValue{ - { - Key:"test", - VStr: "", - }, - }, - }) - } -} diff --git a/cmd/noop-grpc-plugin/main.go b/cmd/noop-grpc-plugin/main.go deleted file mode 100644 index 3832044ee19..00000000000 --- a/cmd/noop-grpc-plugin/main.go +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2018 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 main - -import ( - "context" - "flag" - "path" - "strings" - "time" - - "github.com/hashicorp/go-plugin" - "github.com/spf13/viper" - - "github.com/jaegertracing/jaeger/model" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" - "github.com/jaegertracing/jaeger/plugin/storage/memory" - "github.com/jaegertracing/jaeger/storage/spanstore" -) - -var configPath string - -func main() { - flag.StringVar(&configPath, "config", "", "A path to the plugin's configuration file") - flag.Parse() - - if configPath != "" { - viper.SetConfigFile(path.Base(configPath)) - viper.AddConfigPath(path.Dir(configPath)) - } - - v := viper.New() - v.AutomaticEnv() - v.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_")) - - opts := memory.Options{} - opts.InitFromViper(v) - - plugin.Serve(&plugin.ServeConfig{ - HandshakeConfig: shared.Handshake, - VersionedPlugins: map[int]plugin.PluginSet{ - 1: map[string]plugin.Plugin{ - shared.StoragePluginIdentifier: &shared.StorageGRPCPlugin{ - Impl: &noopStore{}, - }, - }, - }, - GRPCServer: plugin.DefaultGRPCServer, - }) -} - -type noopStore struct { -} - -func (*noopStore) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { - return nil, nil -} - -func (*noopStore) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - return nil, nil -} - -func (*noopStore) GetServices(ctx context.Context) ([]string, error) { - return nil, nil -} - -func (*noopStore) GetOperations(ctx context.Context, service string) ([]string, error) { - return nil, nil -} - -func (*noopStore) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { - return nil, nil -} - -func (*noopStore) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { - return nil, nil -} - -func (*noopStore) WriteSpan(span *model.Span) error { - return nil -} diff --git a/examples/memory-store/empty_test.go b/examples/memory-store/empty_test.go new file mode 100644 index 00000000000..38aae80afae --- /dev/null +++ b/examples/memory-store/empty_test.go @@ -0,0 +1,15 @@ +// Copyright (c) 2018 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 main diff --git a/examples/memory-store/main.go b/examples/memory-store/main.go new file mode 100644 index 00000000000..6dbd2a045d3 --- /dev/null +++ b/examples/memory-store/main.go @@ -0,0 +1,65 @@ +// Copyright (c) 2018 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 main + +import ( + "flag" + "path" + "strings" + + "github.com/spf13/viper" + + "github.com/jaegertracing/jaeger/plugin/storage/grpc" + "github.com/jaegertracing/jaeger/storage/dependencystore" + "github.com/jaegertracing/jaeger/plugin/storage/memory" + "github.com/jaegertracing/jaeger/storage/spanstore" +) + +var configPath string + +func main() { + flag.StringVar(&configPath, "config", "", "A path to the plugin's configuration file") + flag.Parse() + + if configPath != "" { + viper.SetConfigFile(path.Base(configPath)) + viper.AddConfigPath(path.Dir(configPath)) + } + + v := viper.New() + v.AutomaticEnv() + v.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_")) + + opts := memory.Options{} + opts.InitFromViper(v) + + grpc.Serve(&memoryStore{store: memory.NewStore()}) +} + +type memoryStore struct { + store *memory.Store +} + +func (ns *memoryStore) DependencyReader() dependencystore.Reader { + return ns.store +} + +func (ns *memoryStore) SpanReader() spanstore.Reader { + return ns.store +} + +func (ns *memoryStore) SpanWriter() spanstore.Writer { + return ns.store +} diff --git a/plugin/storage/grpc/factory.go b/plugin/storage/grpc/factory.go index 0e2d8004c48..0acbe56f7b7 100644 --- a/plugin/storage/grpc/factory.go +++ b/plugin/storage/grpc/factory.go @@ -70,15 +70,15 @@ func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger) // CreateSpanReader implements storage.Factory func (f *Factory) CreateSpanReader() (spanstore.Reader, error) { - return f.store, nil + return f.store.SpanReader(), nil } // CreateSpanWriter implements storage.Factory func (f *Factory) CreateSpanWriter() (spanstore.Writer, error) { - return f.store, nil + return f.store.SpanWriter(), nil } // CreateDependencyReader implements storage.Factory func (f *Factory) CreateDependencyReader() (dependencystore.Reader, error) { - return f.store, nil + return f.store.DependencyReader(), nil } diff --git a/plugin/storage/grpc/grpc.go b/plugin/storage/grpc/grpc.go index 27671f57f6d..1462cb62677 100644 --- a/plugin/storage/grpc/grpc.go +++ b/plugin/storage/grpc/grpc.go @@ -16,8 +16,9 @@ package grpc import ( "github.com/hashicorp/go-plugin" - "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" "google.golang.org/grpc" + + "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" ) func Serve(implementation shared.StoragePlugin) { diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index afaa6d615c4..72a8fa348e1 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -23,6 +23,7 @@ import ( "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/storage/spanstore" ) @@ -33,6 +34,21 @@ type GRPCClient struct { depsReaderClient storage_v1.DependenciesReaderPluginClient } +// DependencyReader implements shared.StoragePlugin. +func (c *GRPCClient) DependencyReader() dependencystore.Reader { + return c +} + +// SpanReader implements shared.StoragePlugin. +func (c *GRPCClient) SpanReader() spanstore.Reader { + return c +} + +// SpanWriter implements shared.StoragePlugin. +func (c *GRPCClient) SpanWriter() spanstore.Writer { + return c +} + // GetTrace takes a traceID and returns a Trace associated with that traceID func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { stream, err := c.readerClient.GetTrace(ctx, &storage_v1.GetTraceRequest{ diff --git a/plugin/storage/grpc/shared/grpc_server.go b/plugin/storage/grpc/shared/grpc_server.go index 43c65fb6281..ea937863326 100644 --- a/plugin/storage/grpc/shared/grpc_server.go +++ b/plugin/storage/grpc/shared/grpc_server.go @@ -33,7 +33,7 @@ type GRPCServer struct { // GetDependencies returns all interservice dependencies func (s *GRPCServer) GetDependencies(ctx context.Context, r *storage_v1.GetDependenciesRequest) (*storage_v1.GetDependenciesResponse, error) { - deps, err := s.Impl.GetDependencies(r.EndTime, r.EndTime.Sub(r.StartTime)) + deps, err := s.Impl.DependencyReader().GetDependencies(r.EndTime, r.EndTime.Sub(r.StartTime)) if err != nil { return nil, err } @@ -44,7 +44,7 @@ func (s *GRPCServer) GetDependencies(ctx context.Context, r *storage_v1.GetDepen // WriteSpan saves the span func (s *GRPCServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanRequest) (*storage_v1.WriteSpanResponse, error) { - err := s.Impl.WriteSpan(r.Span) + err := s.Impl.SpanWriter().WriteSpan(r.Span) if err != nil { return nil, err } @@ -53,7 +53,7 @@ func (s *GRPCServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanReque // GetTrace takes a traceID and streams a Trace associated with that traceID func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.SpanReaderPlugin_GetTraceServer) error { - trace, err := s.Impl.GetTrace(stream.Context(), r.TraceID) + trace, err := s.Impl.SpanReader().GetTrace(stream.Context(), r.TraceID) if err != nil { return err } @@ -68,7 +68,7 @@ func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.S // GetServices returns a list of all known services func (s *GRPCServer) GetServices(ctx context.Context, r *storage_v1.GetServicesRequest) (*storage_v1.GetServicesResponse, error) { - services, err := s.Impl.GetServices(ctx) + services, err := s.Impl.SpanReader().GetServices(ctx) if err != nil { return nil, err } @@ -79,7 +79,7 @@ func (s *GRPCServer) GetServices(ctx context.Context, r *storage_v1.GetServicesR // GetOperations returns the operations of a given service func (s *GRPCServer) GetOperations(ctx context.Context, r *storage_v1.GetOperationsRequest) (*storage_v1.GetOperationsResponse, error) { - operations, err := s.Impl.GetOperations(ctx, r.Service) + operations, err := s.Impl.SpanReader().GetOperations(ctx, r.Service) if err != nil { return nil, err } @@ -90,7 +90,7 @@ func (s *GRPCServer) GetOperations(ctx context.Context, r *storage_v1.GetOperati // FindTraces streams traces that match the traceQuery func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_v1.SpanReaderPlugin_FindTracesServer) error { - traces, err := s.Impl.FindTraces(stream.Context(), &spanstore.TraceQueryParameters{ + traces, err := s.Impl.SpanReader().FindTraces(stream.Context(), &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, OperationName: r.Query.OperationName, Tags: r.Query.Tags, @@ -116,7 +116,7 @@ func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_ // FindTraceIDs retrieves traceIDs that match the traceQuery func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceIDsRequest) (*storage_v1.FindTraceIDsResponse, error) { - traceIDs, err := s.Impl.FindTraceIDs(ctx, &spanstore.TraceQueryParameters{ + traceIDs, err := s.Impl.SpanReader().FindTraceIDs(ctx, &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, OperationName: r.Query.OperationName, Tags: r.Query.Tags, diff --git a/plugin/storage/grpc/shared/interface.go b/plugin/storage/grpc/shared/interface.go index 9a922c98db3..cf8a5b17185 100644 --- a/plugin/storage/grpc/shared/interface.go +++ b/plugin/storage/grpc/shared/interface.go @@ -41,9 +41,9 @@ var PluginMap = map[string]plugin.Plugin{ // StoragePlugin is the interface we're exposing as a plugin. type StoragePlugin interface { - spanstore.Reader - spanstore.Writer - dependencystore.Reader + SpanReader() spanstore.Reader + SpanWriter() spanstore.Writer + DependencyReader() dependencystore.Reader } // StorageGRPCPlugin is the implementation of plugin.GRPCPlugin so we can serve/consume this. From 03db22bfb8e5166b404d0d2f701dec35e7edef34 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Tue, 30 Apr 2019 17:38:25 +0100 Subject: [PATCH 21/30] Add missed fix for factory Signed-off-by: Charles Dixon --- plugin/storage/grpc/factory_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugin/storage/grpc/factory_test.go b/plugin/storage/grpc/factory_test.go index fe450b2f65e..d78b36ea8ea 100644 --- a/plugin/storage/grpc/factory_test.go +++ b/plugin/storage/grpc/factory_test.go @@ -25,6 +25,7 @@ import ( "github.com/uber/jaeger-lib/metrics" "go.uber.org/zap" + "github.com/jaegertracing/jaeger/storage/dependencystore" "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" @@ -49,6 +50,18 @@ func (b *mockPluginBuilder) Build() (shared.StoragePlugin, error) { type mockPlugin struct { } +func (mp *mockPlugin) SpanReader() spanstore.Reader { + return mp +} + +func (mp *mockPlugin) SpanWriter() spanstore.Writer { + return mp +} + +func (mp *mockPlugin) DependencyReader() dependencystore.Reader { + return mp +} + func (*mockPlugin) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { panic("implement me") } From ba8b35f76dae754b9371a143a835b7fdc9fb3e6b Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Wed, 1 May 2019 09:24:27 +0100 Subject: [PATCH 22/30] Rename memory-store example to memstore-plugin Signed-off-by: Charles Dixon --- examples/{memory-store => memstore-plugin}/empty_test.go | 0 examples/{memory-store => memstore-plugin}/main.go | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename examples/{memory-store => memstore-plugin}/empty_test.go (100%) rename examples/{memory-store => memstore-plugin}/main.go (100%) diff --git a/examples/memory-store/empty_test.go b/examples/memstore-plugin/empty_test.go similarity index 100% rename from examples/memory-store/empty_test.go rename to examples/memstore-plugin/empty_test.go diff --git a/examples/memory-store/main.go b/examples/memstore-plugin/main.go similarity index 100% rename from examples/memory-store/main.go rename to examples/memstore-plugin/main.go From 616f1b92094fe41ace11b9491f799d15f0833e8a Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Wed, 1 May 2019 09:27:51 +0100 Subject: [PATCH 23/30] Refactor Serve to call ServeWithGRPCServer Signed-off-by: Charles Dixon --- plugin/storage/grpc/grpc.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/plugin/storage/grpc/grpc.go b/plugin/storage/grpc/grpc.go index 1462cb62677..9e231edbe7b 100644 --- a/plugin/storage/grpc/grpc.go +++ b/plugin/storage/grpc/grpc.go @@ -21,20 +21,13 @@ import ( "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" ) +// Serve creates a plugin configuration using the implementation of StoragePlugin and then serves it. func Serve(implementation shared.StoragePlugin) { - plugin.Serve(&plugin.ServeConfig{ - HandshakeConfig: shared.Handshake, - VersionedPlugins: map[int]plugin.PluginSet{ - 1: map[string]plugin.Plugin{ - shared.StoragePluginIdentifier: &shared.StorageGRPCPlugin{ - Impl: implementation, - }, - }, - }, - GRPCServer: plugin.DefaultGRPCServer, - }) + ServeWithGRPCServer(implementation, plugin.DefaultGRPCServer) } +// ServeWithGRPCServer creates a plugin configuration using the implementation of StoragePlugin and +// function to create GRPCServer, and then serves it. func ServeWithGRPCServer(implementation shared.StoragePlugin, grpcServer func([]grpc.ServerOption) *grpc.Server) { plugin.Serve(&plugin.ServeConfig{ HandshakeConfig: shared.Handshake, From bf0e1403d2682ae19c2cb2ff7e619c0a60db7e8a Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Wed, 1 May 2019 09:53:48 +0100 Subject: [PATCH 24/30] Refactor to make some structs private Signed-off-by: Charles Dixon --- plugin/storage/grpc/grpc.go | 2 +- plugin/storage/grpc/shared/grpc_client.go | 24 +++++++++++------------ plugin/storage/grpc/shared/grpc_server.go | 20 +++++++++---------- plugin/storage/grpc/shared/interface.go | 4 ++-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/plugin/storage/grpc/grpc.go b/plugin/storage/grpc/grpc.go index 9e231edbe7b..b693e62d459 100644 --- a/plugin/storage/grpc/grpc.go +++ b/plugin/storage/grpc/grpc.go @@ -27,7 +27,7 @@ func Serve(implementation shared.StoragePlugin) { } // ServeWithGRPCServer creates a plugin configuration using the implementation of StoragePlugin and -// function to create GRPCServer, and then serves it. +// function to create grpcServer, and then serves it. func ServeWithGRPCServer(implementation shared.StoragePlugin, grpcServer func([]grpc.ServerOption) *grpc.Server) { plugin.Serve(&plugin.ServeConfig{ HandshakeConfig: shared.Handshake, diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index 72a8fa348e1..cede367d99a 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -27,30 +27,30 @@ import ( "github.com/jaegertracing/jaeger/storage/spanstore" ) -// GRPCClient implements shared.StoragePlugin and reads/writes spans and dependencies -type GRPCClient struct { +// grpcClient implements shared.StoragePlugin and reads/writes spans and dependencies +type grpcClient struct { readerClient storage_v1.SpanReaderPluginClient writerClient storage_v1.SpanWriterPluginClient depsReaderClient storage_v1.DependenciesReaderPluginClient } // DependencyReader implements shared.StoragePlugin. -func (c *GRPCClient) DependencyReader() dependencystore.Reader { +func (c *grpcClient) DependencyReader() dependencystore.Reader { return c } // SpanReader implements shared.StoragePlugin. -func (c *GRPCClient) SpanReader() spanstore.Reader { +func (c *grpcClient) SpanReader() spanstore.Reader { return c } // SpanWriter implements shared.StoragePlugin. -func (c *GRPCClient) SpanWriter() spanstore.Writer { +func (c *grpcClient) SpanWriter() spanstore.Writer { return c } // GetTrace takes a traceID and returns a Trace associated with that traceID -func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { +func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { stream, err := c.readerClient.GetTrace(ctx, &storage_v1.GetTraceRequest{ TraceID: traceID, }) @@ -73,7 +73,7 @@ func (c *GRPCClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode } // GetServices returns a list of all known services -func (c *GRPCClient) GetServices(ctx context.Context) ([]string, error) { +func (c *grpcClient) GetServices(ctx context.Context) ([]string, error) { resp, err := c.readerClient.GetServices(ctx, &storage_v1.GetServicesRequest{}) if err != nil { return nil, errors.Wrap(err, "plugin error") @@ -83,7 +83,7 @@ func (c *GRPCClient) GetServices(ctx context.Context) ([]string, error) { } // GetOperations returns the operations of a given service -func (c *GRPCClient) GetOperations(ctx context.Context, service string) ([]string, error) { +func (c *grpcClient) GetOperations(ctx context.Context, service string) ([]string, error) { resp, err := c.readerClient.GetOperations(ctx, &storage_v1.GetOperationsRequest{ Service: service, }) @@ -95,7 +95,7 @@ func (c *GRPCClient) GetOperations(ctx context.Context, service string) ([]strin } // FindTraces retrieves traces that match the traceQuery -func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { +func (c *grpcClient) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { stream, err := c.readerClient.FindTraces(context.Background(), &storage_v1.FindTracesRequest{ Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, @@ -133,7 +133,7 @@ func (c *GRPCClient) FindTraces(ctx context.Context, query *spanstore.TraceQuery } // FindTraceIDs retrieves traceIDs that match the traceQuery -func (c *GRPCClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { +func (c *grpcClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { resp, err := c.readerClient.FindTraceIDs(context.Background(), &storage_v1.FindTraceIDsRequest{ Query: &storage_v1.TraceQueryParameters{ ServiceName: query.ServiceName, @@ -154,7 +154,7 @@ func (c *GRPCClient) FindTraceIDs(ctx context.Context, query *spanstore.TraceQue } // WriteSpan saves the span -func (c *GRPCClient) WriteSpan(span *model.Span) error { +func (c *grpcClient) WriteSpan(span *model.Span) error { _, err := c.writerClient.WriteSpan(context.Background(), &storage_v1.WriteSpanRequest{ Span: span, }) @@ -166,7 +166,7 @@ func (c *GRPCClient) WriteSpan(span *model.Span) error { } // GetDependencies returns all interservice dependencies -func (c *GRPCClient) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { +func (c *grpcClient) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { resp, err := c.depsReaderClient.GetDependencies(context.Background(), &storage_v1.GetDependenciesRequest{ EndTime: endTs, StartTime: endTs.Add(-lookback), diff --git a/plugin/storage/grpc/shared/grpc_server.go b/plugin/storage/grpc/shared/grpc_server.go index ea937863326..1db0ee1aa28 100644 --- a/plugin/storage/grpc/shared/grpc_server.go +++ b/plugin/storage/grpc/shared/grpc_server.go @@ -26,13 +26,13 @@ import ( const spanBatchSize = 1000 -// GRPCServer implements shared.StoragePlugin and reads/writes spans and dependencies -type GRPCServer struct { +// grpcServer implements shared.StoragePlugin and reads/writes spans and dependencies +type grpcServer struct { Impl StoragePlugin } // GetDependencies returns all interservice dependencies -func (s *GRPCServer) GetDependencies(ctx context.Context, r *storage_v1.GetDependenciesRequest) (*storage_v1.GetDependenciesResponse, error) { +func (s *grpcServer) GetDependencies(ctx context.Context, r *storage_v1.GetDependenciesRequest) (*storage_v1.GetDependenciesResponse, error) { deps, err := s.Impl.DependencyReader().GetDependencies(r.EndTime, r.EndTime.Sub(r.StartTime)) if err != nil { return nil, err @@ -43,7 +43,7 @@ func (s *GRPCServer) GetDependencies(ctx context.Context, r *storage_v1.GetDepen } // WriteSpan saves the span -func (s *GRPCServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanRequest) (*storage_v1.WriteSpanResponse, error) { +func (s *grpcServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanRequest) (*storage_v1.WriteSpanResponse, error) { err := s.Impl.SpanWriter().WriteSpan(r.Span) if err != nil { return nil, err @@ -52,7 +52,7 @@ func (s *GRPCServer) WriteSpan(ctx context.Context, r *storage_v1.WriteSpanReque } // GetTrace takes a traceID and streams a Trace associated with that traceID -func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.SpanReaderPlugin_GetTraceServer) error { +func (s *grpcServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.SpanReaderPlugin_GetTraceServer) error { trace, err := s.Impl.SpanReader().GetTrace(stream.Context(), r.TraceID) if err != nil { return err @@ -67,7 +67,7 @@ func (s *GRPCServer) GetTrace(r *storage_v1.GetTraceRequest, stream storage_v1.S } // GetServices returns a list of all known services -func (s *GRPCServer) GetServices(ctx context.Context, r *storage_v1.GetServicesRequest) (*storage_v1.GetServicesResponse, error) { +func (s *grpcServer) GetServices(ctx context.Context, r *storage_v1.GetServicesRequest) (*storage_v1.GetServicesResponse, error) { services, err := s.Impl.SpanReader().GetServices(ctx) if err != nil { return nil, err @@ -78,7 +78,7 @@ func (s *GRPCServer) GetServices(ctx context.Context, r *storage_v1.GetServicesR } // GetOperations returns the operations of a given service -func (s *GRPCServer) GetOperations(ctx context.Context, r *storage_v1.GetOperationsRequest) (*storage_v1.GetOperationsResponse, error) { +func (s *grpcServer) GetOperations(ctx context.Context, r *storage_v1.GetOperationsRequest) (*storage_v1.GetOperationsResponse, error) { operations, err := s.Impl.SpanReader().GetOperations(ctx, r.Service) if err != nil { return nil, err @@ -89,7 +89,7 @@ func (s *GRPCServer) GetOperations(ctx context.Context, r *storage_v1.GetOperati } // FindTraces streams traces that match the traceQuery -func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_v1.SpanReaderPlugin_FindTracesServer) error { +func (s *grpcServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_v1.SpanReaderPlugin_FindTracesServer) error { traces, err := s.Impl.SpanReader().FindTraces(stream.Context(), &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, OperationName: r.Query.OperationName, @@ -115,7 +115,7 @@ func (s *GRPCServer) FindTraces(r *storage_v1.FindTracesRequest, stream storage_ } // FindTraceIDs retrieves traceIDs that match the traceQuery -func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceIDsRequest) (*storage_v1.FindTraceIDsResponse, error) { +func (s *grpcServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceIDsRequest) (*storage_v1.FindTraceIDsResponse, error) { traceIDs, err := s.Impl.SpanReader().FindTraceIDs(ctx, &spanstore.TraceQueryParameters{ ServiceName: r.Query.ServiceName, OperationName: r.Query.OperationName, @@ -134,7 +134,7 @@ func (s *GRPCServer) FindTraceIDs(ctx context.Context, r *storage_v1.FindTraceID }, nil } -func (s *GRPCServer) sendSpans(spans []*model.Span, sendFn func(*storage_v1.SpansResponseChunk) error) error { +func (s *grpcServer) sendSpans(spans []*model.Span, sendFn func(*storage_v1.SpansResponseChunk) error) error { chunk := make([]model.Span, 0, len(spans)) for i := 0; i < len(spans); i += spanBatchSize { chunk = chunk[:0] diff --git a/plugin/storage/grpc/shared/interface.go b/plugin/storage/grpc/shared/interface.go index cf8a5b17185..24d62854151 100644 --- a/plugin/storage/grpc/shared/interface.go +++ b/plugin/storage/grpc/shared/interface.go @@ -56,7 +56,7 @@ type StorageGRPCPlugin struct { // GRPCServer is used by go-plugin to create a grpc plugin server func (p *StorageGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { - server := &GRPCServer{Impl: p.Impl} + server := &grpcServer{Impl: p.Impl} storage_v1.RegisterSpanReaderPluginServer(s, server) storage_v1.RegisterSpanWriterPluginServer(s, server) storage_v1.RegisterDependenciesReaderPluginServer(s, server) @@ -65,7 +65,7 @@ func (p *StorageGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server // GRPCClient is used by go-plugin to create a grpc plugin client func (*StorageGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) { - return &GRPCClient{ + return &grpcClient{ readerClient: storage_v1.NewSpanReaderPluginClient(c), writerClient: storage_v1.NewSpanWriterPluginClient(c), depsReaderClient: storage_v1.NewDependenciesReaderPluginClient(c), From deba5684bc7886d3a896aa219bb633b2d7c52e71 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Wed, 1 May 2019 09:54:06 +0100 Subject: [PATCH 25/30] Change factory_test to use mocks Signed-off-by: Charles Dixon --- plugin/storage/grpc/factory_test.go | 56 +++++++++-------------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/plugin/storage/grpc/factory_test.go b/plugin/storage/grpc/factory_test.go index d78b36ea8ea..67a2607290f 100644 --- a/plugin/storage/grpc/factory_test.go +++ b/plugin/storage/grpc/factory_test.go @@ -15,22 +15,21 @@ package grpc import ( - "context" "errors" "testing" - "time" "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/uber/jaeger-lib/metrics" "go.uber.org/zap" - "github.com/jaegertracing/jaeger/storage/dependencystore" - "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" "github.com/jaegertracing/jaeger/storage" + "github.com/jaegertracing/jaeger/storage/dependencystore" + dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" + spanStoreMocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" ) var _ storage.Factory = new(Factory) @@ -48,46 +47,21 @@ func (b *mockPluginBuilder) Build() (shared.StoragePlugin, error) { } type mockPlugin struct { + spanReader spanstore.Reader + spanWriter spanstore.Writer + dependencyReader dependencystore.Reader } func (mp *mockPlugin) SpanReader() spanstore.Reader { - return mp + return mp.spanReader } func (mp *mockPlugin) SpanWriter() spanstore.Writer { - return mp + return mp.spanWriter } func (mp *mockPlugin) DependencyReader() dependencystore.Reader { - return mp -} - -func (*mockPlugin) GetDependencies(endTs time.Time, lookback time.Duration) ([]model.DependencyLink, error) { - panic("implement me") -} - -func (*mockPlugin) GetTrace(ctx context.Context, traceID model.TraceID) (*model.Trace, error) { - panic("implement me") -} - -func (*mockPlugin) GetServices(ctx context.Context) ([]string, error) { - panic("implement me") -} - -func (*mockPlugin) GetOperations(ctx context.Context, service string) ([]string, error) { - panic("implement me") -} - -func (*mockPlugin) FindTraces(ctx context.Context, query *spanstore.TraceQueryParameters) ([]*model.Trace, error) { - panic("implement me") -} - -func (*mockPlugin) FindTraceIDs(ctx context.Context, query *spanstore.TraceQueryParameters) ([]model.TraceID, error) { - panic("implement me") -} - -func (*mockPlugin) WriteSpan(span *model.Span) error { - panic("implement me") + return mp.dependencyReader } func TestGRPCStorageFactory(t *testing.T) { @@ -103,20 +77,24 @@ func TestGRPCStorageFactory(t *testing.T) { assert.EqualError(t, f.Initialize(metrics.NullFactory, zap.NewNop()), "made-up error") f.builder = &mockPluginBuilder{ - plugin: &mockPlugin{}, + plugin: &mockPlugin{ + spanWriter: new(spanStoreMocks.Writer), + spanReader: new(spanStoreMocks.Reader), + dependencyReader: new(dependencyStoreMocks.Reader), + }, } assert.NoError(t, f.Initialize(metrics.NullFactory, zap.NewNop())) assert.NotNil(t, f.store) reader, err := f.CreateSpanReader() assert.NoError(t, err) - assert.Equal(t, f.store, reader) + assert.Equal(t, f.store.SpanReader(), reader) writer, err := f.CreateSpanWriter() assert.NoError(t, err) - assert.Equal(t, f.store, writer) + assert.Equal(t, f.store.SpanWriter(), writer) depReader, err := f.CreateDependencyReader() assert.NoError(t, err) - assert.Equal(t, f.store, depReader) + assert.Equal(t, f.store.DependencyReader(), depReader) } func TestWithConfiguration(t *testing.T) { From 763ec4ca7d6ebe7cb97419d2db31de18c1cedb5f Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Wed, 1 May 2019 10:13:29 +0100 Subject: [PATCH 26/30] Add storage grpc integration test Signed-off-by: Charles Dixon --- plugin/storage/integration/grpc_test.go | 84 +++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 plugin/storage/integration/grpc_test.go diff --git a/plugin/storage/integration/grpc_test.go b/plugin/storage/integration/grpc_test.go new file mode 100644 index 00000000000..e54c679345d --- /dev/null +++ b/plugin/storage/integration/grpc_test.go @@ -0,0 +1,84 @@ +// Copyright (c) 2018 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 integration + +import ( + "os" + "testing" + + "github.com/jaegertracing/jaeger/pkg/config" + "github.com/uber/jaeger-lib/metrics" + + "github.com/stretchr/testify/require" + "go.uber.org/zap" + + "github.com/jaegertracing/jaeger/pkg/testutils" + "github.com/jaegertracing/jaeger/plugin/storage/grpc" +) + +type GRPCStorageIntegrationTestSuite struct { + StorageIntegration + logger *zap.Logger +} + +func (s *GRPCStorageIntegrationTestSuite) initialize() error { + s.logger, _ = testutils.NewLogger() + gopath := os.Getenv("GOPATH") + path := gopath + "/src/github.com/jaegertracing/jaeger/examples/memstore-plugin/memstore-plugin" + + f := grpc.NewFactory() + v, command := config.Viperize(f.AddFlags) + err := command.ParseFlags([]string{ + "--grpc-storage-plugin.binary", + path, + }) + if err != nil { + return err + } + f.InitFromViper(v) + if err := f.Initialize(metrics.NullFactory, s.logger); err != nil { + return err + } + + if s.SpanWriter, err = f.CreateSpanWriter(); err != nil { + return err + } + if s.SpanReader, err = f.CreateSpanReader(); err != nil { + return err + } + + // TODO DependencyWriter is not implemented in grpc store + + s.Refresh = s.refresh + s.CleanUp = s.cleanUp + return nil +} + +func (s *GRPCStorageIntegrationTestSuite) refresh() error { + return nil +} + +func (s *GRPCStorageIntegrationTestSuite) cleanUp() error { + return s.initialize() +} + +func TestGRPCStorage(t *testing.T) { + if os.Getenv("STORAGE") != "grpc-plugin" { + t.Skip("Integration test against grpc skipped; set STORAGE env var to grpc-plugin to run this") + } + s := &GRPCStorageIntegrationTestSuite{} + require.NoError(t, s.initialize()) + s.IntegrationTestAll(t) +} From 3b5e9ea262f27552c3429f650da6da4c9b04c206 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Fri, 3 May 2019 16:15:33 +0100 Subject: [PATCH 27/30] Create mocks for storage_v1 and add grpc client tests Signed-off-by: Charles Dixon --- .../storage/grpc/shared/grpc_client_test.go | 258 ++++++++++++++++++ plugin/storage/integration/grpc_test.go | 3 +- .../mocks/DependenciesReaderPluginClient.go | 43 +++ .../mocks/DependenciesReaderPluginServer.go | 35 +++ .../mocks/SpanReaderPluginClient.go | 163 +++++++++++ .../mocks/SpanReaderPluginServer.go | 109 ++++++++ .../SpanReaderPlugin_FindTracesClient.go | 133 +++++++++ .../SpanReaderPlugin_FindTracesServer.go | 104 +++++++ .../mocks/SpanReaderPlugin_GetTraceClient.go | 133 +++++++++ .../mocks/SpanReaderPlugin_GetTraceServer.go | 104 +++++++ .../mocks/SpanWriterPluginClient.go | 43 +++ .../mocks/SpanWriterPluginServer.go | 35 +++ 12 files changed, 1161 insertions(+), 2 deletions(-) create mode 100644 plugin/storage/grpc/shared/grpc_client_test.go create mode 100644 proto-gen/storage_v1/mocks/DependenciesReaderPluginClient.go create mode 100644 proto-gen/storage_v1/mocks/DependenciesReaderPluginServer.go create mode 100644 proto-gen/storage_v1/mocks/SpanReaderPluginClient.go create mode 100644 proto-gen/storage_v1/mocks/SpanReaderPluginServer.go create mode 100644 proto-gen/storage_v1/mocks/SpanReaderPlugin_FindTracesClient.go create mode 100644 proto-gen/storage_v1/mocks/SpanReaderPlugin_FindTracesServer.go create mode 100644 proto-gen/storage_v1/mocks/SpanReaderPlugin_GetTraceClient.go create mode 100644 proto-gen/storage_v1/mocks/SpanReaderPlugin_GetTraceServer.go create mode 100644 proto-gen/storage_v1/mocks/SpanWriterPluginClient.go create mode 100644 proto-gen/storage_v1/mocks/SpanWriterPluginServer.go diff --git a/plugin/storage/grpc/shared/grpc_client_test.go b/plugin/storage/grpc/shared/grpc_client_test.go new file mode 100644 index 00000000000..a8618eec419 --- /dev/null +++ b/plugin/storage/grpc/shared/grpc_client_test.go @@ -0,0 +1,258 @@ +package shared + +import ( + "context" + "errors" + "io" + "testing" + "time" + + "github.com/jaegertracing/jaeger/model" + "github.com/jaegertracing/jaeger/storage/spanstore" + + "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + + "github.com/stretchr/testify/mock" + + grpcMocks "github.com/jaegertracing/jaeger/proto-gen/storage_v1/mocks" + + "github.com/stretchr/testify/assert" +) + +var ( + mockTraceID = model.NewTraceID(0, 123456) + mockTraceID2 = model.NewTraceID(0, 123457) + + mockTraceSpans = []model.Span{ + { + TraceID: mockTraceID, + SpanID: model.NewSpanID(1), + Process: &model.Process{}, + }, + { + TraceID: mockTraceID, + SpanID: model.NewSpanID(2), + Process: &model.Process{}, + }, + } + + mockTracesSpans = []model.Span{ + { + TraceID: mockTraceID, + SpanID: model.NewSpanID(1), + Process: &model.Process{}, + }, + { + TraceID: mockTraceID, + SpanID: model.NewSpanID(2), + Process: &model.Process{}, + }, + { + TraceID: mockTraceID2, + SpanID: model.NewSpanID(1), + Process: &model.Process{}, + }, + } +) + +type grpcClientTest struct { + client *grpcClient + spanReader *grpcMocks.SpanReaderPluginClient + spanWriter *grpcMocks.SpanWriterPluginClient + depsReader *grpcMocks.DependenciesReaderPluginClient +} + +func withGRPCClient(fn func(r *grpcClientTest)) { + spanReader := new(grpcMocks.SpanReaderPluginClient) + spanWriter := new(grpcMocks.SpanWriterPluginClient) + depReader := new(grpcMocks.DependenciesReaderPluginClient) + + r := &grpcClientTest{ + client: &grpcClient{ + readerClient: spanReader, + writerClient: spanWriter, + depsReaderClient: depReader, + }, + spanReader: spanReader, + spanWriter: spanWriter, + depsReader: depReader, + } + fn(r) +} + +func TestGRPCClientGetServices(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + r.spanReader.On("GetServices", mock.Anything, &storage_v1.GetServicesRequest{}). + Return(&storage_v1.GetServicesResponse{Services: []string{"service-a"}}, nil) + + s, err := r.client.GetServices(context.Background()) + assert.NoError(t, err) + assert.Equal(t, []string{"service-a"}, s) + }) +} + +func TestGRPCClientGetOperations(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + r.spanReader.On("GetOperations", mock.Anything, &storage_v1.GetOperationsRequest{ + Service: "service-a", + }).Return(&storage_v1.GetOperationsResponse{ + Operations: []string{"operation-a"}, + }, nil) + + s, err := r.client.GetOperations(context.Background(), "service-a") + assert.NoError(t, err) + assert.Equal(t, []string{"operation-a"}, s) + }) +} + +func TestGRPCClientGetTrace(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + traceClient := new(grpcMocks.SpanReaderPlugin_GetTraceClient) + traceClient.On("Recv").Return(&storage_v1.SpansResponseChunk{ + Spans: mockTraceSpans, + }, nil).Once() + traceClient.On("Recv").Return(nil, io.EOF) + r.spanReader.On("GetTrace", mock.Anything, &storage_v1.GetTraceRequest{ + TraceID: mockTraceID, + }).Return(traceClient, nil) + + var expectedSpans []*model.Span + for _, span := range mockTraceSpans { + expectedSpans = append(expectedSpans, &span) + } + + s, err := r.client.GetTrace(context.Background(), mockTraceID) + assert.NoError(t, err) + assert.Equal(t, &model.Trace{ + Spans: expectedSpans, + }, s) + }) +} + +func TestGRPCClientGetTrace_StreamError(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + traceClient := new(grpcMocks.SpanReaderPlugin_GetTraceClient) + traceClient.On("Recv").Return(nil, errors.New("an error")) + r.spanReader.On("GetTrace", mock.Anything, &storage_v1.GetTraceRequest{ + TraceID: mockTraceID, + }).Return(traceClient, nil) + + s, err := r.client.GetTrace(context.Background(), mockTraceID) + assert.Error(t, err) + assert.Nil(t, s) + }) +} + +func TestGRPCClientGetTrace_NoTrace(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + r.spanReader.On("GetTrace", mock.Anything, &storage_v1.GetTraceRequest{ + TraceID: mockTraceID, + }).Return(nil, spanstore.ErrTraceNotFound) + + s, err := r.client.GetTrace(context.Background(), mockTraceID) + assert.Error(t, err) + assert.Nil(t, s) + }) +} + +func TestGRPCClientFindTraces(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + traceClient := new(grpcMocks.SpanReaderPlugin_FindTracesClient) + traceClient.On("Recv").Return(&storage_v1.SpansResponseChunk{ + Spans: mockTracesSpans, + }, nil).Once() + traceClient.On("Recv").Return(nil, io.EOF) + r.spanReader.On("FindTraces", mock.Anything, &storage_v1.FindTracesRequest{ + Query: &storage_v1.TraceQueryParameters{}, + }).Return(traceClient, nil) + + var expectedTraces []*model.Trace + var traceID model.TraceID + var trace *model.Trace + for _, span := range mockTracesSpans { + if span.TraceID != traceID { + trace = &model.Trace{} + traceID = span.TraceID + expectedTraces = append(expectedTraces, trace) + } + trace.Spans = append(trace.Spans, &span) + } + + s, err := r.client.FindTraces(context.Background(), &spanstore.TraceQueryParameters{}) + assert.NoError(t, err) + assert.NotNil(t, s) + assert.Equal(t, 2, len(s)) + }) +} + +func TestGRPCClientFindTraces_Error(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + r.spanReader.On("FindTraces", mock.Anything, &storage_v1.FindTracesRequest{ + Query: &storage_v1.TraceQueryParameters{}, + }).Return(nil, errors.New("an error")) + + s, err := r.client.FindTraces(context.Background(), &spanstore.TraceQueryParameters{}) + assert.Error(t, err) + assert.Nil(t, s) + }) +} + +func TestGRPCClientFindTraces_RecvError(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + traceClient := new(grpcMocks.SpanReaderPlugin_FindTracesClient) + traceClient.On("Recv").Return(nil, errors.New("an error")) + r.spanReader.On("FindTraces", mock.Anything, &storage_v1.FindTracesRequest{ + Query: &storage_v1.TraceQueryParameters{}, + }).Return(traceClient, nil) + + s, err := r.client.FindTraces(context.Background(), &spanstore.TraceQueryParameters{}) + assert.Error(t, err) + assert.Nil(t, s) + }) +} + +func TestGRPCClientFindTraceIDs(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + r.spanReader.On("FindTraceIDs", mock.Anything, &storage_v1.FindTraceIDsRequest{ + Query: &storage_v1.TraceQueryParameters{}, + }).Return(&storage_v1.FindTraceIDsResponse{ + TraceIDs: []model.TraceID{mockTraceID, mockTraceID2}, + }, nil) + + s, err := r.client.FindTraceIDs(context.Background(), &spanstore.TraceQueryParameters{}) + assert.NoError(t, err) + assert.Equal(t, []model.TraceID{mockTraceID, mockTraceID2}, s) + }) +} + +func TestGRPCClientWriteSpan(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + r.spanWriter.On("WriteSpan", mock.Anything, &storage_v1.WriteSpanRequest{ + Span: &mockTraceSpans[0], + }).Return(&storage_v1.WriteSpanResponse{}, nil) + + err := r.client.WriteSpan(&mockTraceSpans[0]) + assert.NoError(t, err) + }) +} + +func TestGRPCClientGetDependencies(t *testing.T) { + withGRPCClient(func(r *grpcClientTest) { + lookback := time.Duration(1 * time.Second) + end := time.Now() + deps := []model.DependencyLink{ + { + Source: "source", + Child: "child", + }, + } + r.depsReader.On("GetDependencies", mock.Anything, &storage_v1.GetDependenciesRequest{ + StartTime: end.Add(-lookback), + EndTime: end, + }).Return(&storage_v1.GetDependenciesResponse{Dependencies: deps}, nil) + + s, err := r.client.GetDependencies(end, lookback) + assert.NoError(t, err) + assert.Equal(t, deps, s) + }) +} diff --git a/plugin/storage/integration/grpc_test.go b/plugin/storage/integration/grpc_test.go index e54c679345d..ea0f2f7999a 100644 --- a/plugin/storage/integration/grpc_test.go +++ b/plugin/storage/integration/grpc_test.go @@ -18,12 +18,11 @@ import ( "os" "testing" - "github.com/jaegertracing/jaeger/pkg/config" "github.com/uber/jaeger-lib/metrics" - "github.com/stretchr/testify/require" "go.uber.org/zap" + "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/testutils" "github.com/jaegertracing/jaeger/plugin/storage/grpc" ) diff --git a/proto-gen/storage_v1/mocks/DependenciesReaderPluginClient.go b/proto-gen/storage_v1/mocks/DependenciesReaderPluginClient.go new file mode 100644 index 00000000000..ba05531c915 --- /dev/null +++ b/proto-gen/storage_v1/mocks/DependenciesReaderPluginClient.go @@ -0,0 +1,43 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import context "context" +import grpc "google.golang.org/grpc" +import mock "github.com/stretchr/testify/mock" +import storage_v1 "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + +// DependenciesReaderPluginClient is an autogenerated mock type for the DependenciesReaderPluginClient type +type DependenciesReaderPluginClient struct { + mock.Mock +} + +// GetDependencies provides a mock function with given fields: ctx, in, opts +func (_m *DependenciesReaderPluginClient) GetDependencies(ctx context.Context, in *storage_v1.GetDependenciesRequest, opts ...grpc.CallOption) (*storage_v1.GetDependenciesResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *storage_v1.GetDependenciesResponse + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.GetDependenciesRequest, ...grpc.CallOption) *storage_v1.GetDependenciesResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.GetDependenciesResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.GetDependenciesRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/proto-gen/storage_v1/mocks/DependenciesReaderPluginServer.go b/proto-gen/storage_v1/mocks/DependenciesReaderPluginServer.go new file mode 100644 index 00000000000..7d126aeeada --- /dev/null +++ b/proto-gen/storage_v1/mocks/DependenciesReaderPluginServer.go @@ -0,0 +1,35 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import context "context" +import mock "github.com/stretchr/testify/mock" +import storage_v1 "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + +// DependenciesReaderPluginServer is an autogenerated mock type for the DependenciesReaderPluginServer type +type DependenciesReaderPluginServer struct { + mock.Mock +} + +// GetDependencies provides a mock function with given fields: _a0, _a1 +func (_m *DependenciesReaderPluginServer) GetDependencies(_a0 context.Context, _a1 *storage_v1.GetDependenciesRequest) (*storage_v1.GetDependenciesResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *storage_v1.GetDependenciesResponse + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.GetDependenciesRequest) *storage_v1.GetDependenciesResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.GetDependenciesResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.GetDependenciesRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/proto-gen/storage_v1/mocks/SpanReaderPluginClient.go b/proto-gen/storage_v1/mocks/SpanReaderPluginClient.go new file mode 100644 index 00000000000..2e096d1ea1d --- /dev/null +++ b/proto-gen/storage_v1/mocks/SpanReaderPluginClient.go @@ -0,0 +1,163 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import context "context" +import grpc "google.golang.org/grpc" +import mock "github.com/stretchr/testify/mock" +import storage_v1 "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + +// SpanReaderPluginClient is an autogenerated mock type for the SpanReaderPluginClient type +type SpanReaderPluginClient struct { + mock.Mock +} + +// FindTraceIDs provides a mock function with given fields: ctx, in, opts +func (_m *SpanReaderPluginClient) FindTraceIDs(ctx context.Context, in *storage_v1.FindTraceIDsRequest, opts ...grpc.CallOption) (*storage_v1.FindTraceIDsResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *storage_v1.FindTraceIDsResponse + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.FindTraceIDsRequest, ...grpc.CallOption) *storage_v1.FindTraceIDsResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.FindTraceIDsResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.FindTraceIDsRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// FindTraces provides a mock function with given fields: ctx, in, opts +func (_m *SpanReaderPluginClient) FindTraces(ctx context.Context, in *storage_v1.FindTracesRequest, opts ...grpc.CallOption) (storage_v1.SpanReaderPlugin_FindTracesClient, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 storage_v1.SpanReaderPlugin_FindTracesClient + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.FindTracesRequest, ...grpc.CallOption) storage_v1.SpanReaderPlugin_FindTracesClient); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(storage_v1.SpanReaderPlugin_FindTracesClient) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.FindTracesRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetOperations provides a mock function with given fields: ctx, in, opts +func (_m *SpanReaderPluginClient) GetOperations(ctx context.Context, in *storage_v1.GetOperationsRequest, opts ...grpc.CallOption) (*storage_v1.GetOperationsResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *storage_v1.GetOperationsResponse + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.GetOperationsRequest, ...grpc.CallOption) *storage_v1.GetOperationsResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.GetOperationsResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.GetOperationsRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetServices provides a mock function with given fields: ctx, in, opts +func (_m *SpanReaderPluginClient) GetServices(ctx context.Context, in *storage_v1.GetServicesRequest, opts ...grpc.CallOption) (*storage_v1.GetServicesResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *storage_v1.GetServicesResponse + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.GetServicesRequest, ...grpc.CallOption) *storage_v1.GetServicesResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.GetServicesResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.GetServicesRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetTrace provides a mock function with given fields: ctx, in, opts +func (_m *SpanReaderPluginClient) GetTrace(ctx context.Context, in *storage_v1.GetTraceRequest, opts ...grpc.CallOption) (storage_v1.SpanReaderPlugin_GetTraceClient, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 storage_v1.SpanReaderPlugin_GetTraceClient + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.GetTraceRequest, ...grpc.CallOption) storage_v1.SpanReaderPlugin_GetTraceClient); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(storage_v1.SpanReaderPlugin_GetTraceClient) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.GetTraceRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/proto-gen/storage_v1/mocks/SpanReaderPluginServer.go b/proto-gen/storage_v1/mocks/SpanReaderPluginServer.go new file mode 100644 index 00000000000..622b64c0657 --- /dev/null +++ b/proto-gen/storage_v1/mocks/SpanReaderPluginServer.go @@ -0,0 +1,109 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import context "context" +import mock "github.com/stretchr/testify/mock" +import storage_v1 "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + +// SpanReaderPluginServer is an autogenerated mock type for the SpanReaderPluginServer type +type SpanReaderPluginServer struct { + mock.Mock +} + +// FindTraceIDs provides a mock function with given fields: _a0, _a1 +func (_m *SpanReaderPluginServer) FindTraceIDs(_a0 context.Context, _a1 *storage_v1.FindTraceIDsRequest) (*storage_v1.FindTraceIDsResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *storage_v1.FindTraceIDsResponse + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.FindTraceIDsRequest) *storage_v1.FindTraceIDsResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.FindTraceIDsResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.FindTraceIDsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// FindTraces provides a mock function with given fields: _a0, _a1 +func (_m *SpanReaderPluginServer) FindTraces(_a0 *storage_v1.FindTracesRequest, _a1 storage_v1.SpanReaderPlugin_FindTracesServer) error { + ret := _m.Called(_a0, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(*storage_v1.FindTracesRequest, storage_v1.SpanReaderPlugin_FindTracesServer) error); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// GetOperations provides a mock function with given fields: _a0, _a1 +func (_m *SpanReaderPluginServer) GetOperations(_a0 context.Context, _a1 *storage_v1.GetOperationsRequest) (*storage_v1.GetOperationsResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *storage_v1.GetOperationsResponse + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.GetOperationsRequest) *storage_v1.GetOperationsResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.GetOperationsResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.GetOperationsRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetServices provides a mock function with given fields: _a0, _a1 +func (_m *SpanReaderPluginServer) GetServices(_a0 context.Context, _a1 *storage_v1.GetServicesRequest) (*storage_v1.GetServicesResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *storage_v1.GetServicesResponse + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.GetServicesRequest) *storage_v1.GetServicesResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.GetServicesResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.GetServicesRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// GetTrace provides a mock function with given fields: _a0, _a1 +func (_m *SpanReaderPluginServer) GetTrace(_a0 *storage_v1.GetTraceRequest, _a1 storage_v1.SpanReaderPlugin_GetTraceServer) error { + ret := _m.Called(_a0, _a1) + + var r0 error + if rf, ok := ret.Get(0).(func(*storage_v1.GetTraceRequest, storage_v1.SpanReaderPlugin_GetTraceServer) error); ok { + r0 = rf(_a0, _a1) + } else { + r0 = ret.Error(0) + } + + return r0 +} diff --git a/proto-gen/storage_v1/mocks/SpanReaderPlugin_FindTracesClient.go b/proto-gen/storage_v1/mocks/SpanReaderPlugin_FindTracesClient.go new file mode 100644 index 00000000000..b0a6007f75f --- /dev/null +++ b/proto-gen/storage_v1/mocks/SpanReaderPlugin_FindTracesClient.go @@ -0,0 +1,133 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import context "context" +import metadata "google.golang.org/grpc/metadata" +import mock "github.com/stretchr/testify/mock" +import storage_v1 "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + +// SpanReaderPlugin_FindTracesClient is an autogenerated mock type for the SpanReaderPlugin_FindTracesClient type +type SpanReaderPlugin_FindTracesClient struct { + mock.Mock +} + +// CloseSend provides a mock function with given fields: +func (_m *SpanReaderPlugin_FindTracesClient) CloseSend() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Context provides a mock function with given fields: +func (_m *SpanReaderPlugin_FindTracesClient) Context() context.Context { + ret := _m.Called() + + var r0 context.Context + if rf, ok := ret.Get(0).(func() context.Context); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(context.Context) + } + } + + return r0 +} + +// Header provides a mock function with given fields: +func (_m *SpanReaderPlugin_FindTracesClient) Header() (metadata.MD, error) { + ret := _m.Called() + + var r0 metadata.MD + if rf, ok := ret.Get(0).(func() metadata.MD); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(metadata.MD) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Recv provides a mock function with given fields: +func (_m *SpanReaderPlugin_FindTracesClient) Recv() (*storage_v1.SpansResponseChunk, error) { + ret := _m.Called() + + var r0 *storage_v1.SpansResponseChunk + if rf, ok := ret.Get(0).(func() *storage_v1.SpansResponseChunk); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.SpansResponseChunk) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// RecvMsg provides a mock function with given fields: m +func (_m *SpanReaderPlugin_FindTracesClient) RecvMsg(m interface{}) error { + ret := _m.Called(m) + + var r0 error + if rf, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = rf(m) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendMsg provides a mock function with given fields: m +func (_m *SpanReaderPlugin_FindTracesClient) SendMsg(m interface{}) error { + ret := _m.Called(m) + + var r0 error + if rf, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = rf(m) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Trailer provides a mock function with given fields: +func (_m *SpanReaderPlugin_FindTracesClient) Trailer() metadata.MD { + ret := _m.Called() + + var r0 metadata.MD + if rf, ok := ret.Get(0).(func() metadata.MD); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(metadata.MD) + } + } + + return r0 +} diff --git a/proto-gen/storage_v1/mocks/SpanReaderPlugin_FindTracesServer.go b/proto-gen/storage_v1/mocks/SpanReaderPlugin_FindTracesServer.go new file mode 100644 index 00000000000..a8a053ebbb9 --- /dev/null +++ b/proto-gen/storage_v1/mocks/SpanReaderPlugin_FindTracesServer.go @@ -0,0 +1,104 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import context "context" +import metadata "google.golang.org/grpc/metadata" +import mock "github.com/stretchr/testify/mock" +import storage_v1 "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + +// SpanReaderPlugin_FindTracesServer is an autogenerated mock type for the SpanReaderPlugin_FindTracesServer type +type SpanReaderPlugin_FindTracesServer struct { + mock.Mock +} + +// Context provides a mock function with given fields: +func (_m *SpanReaderPlugin_FindTracesServer) Context() context.Context { + ret := _m.Called() + + var r0 context.Context + if rf, ok := ret.Get(0).(func() context.Context); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(context.Context) + } + } + + return r0 +} + +// RecvMsg provides a mock function with given fields: m +func (_m *SpanReaderPlugin_FindTracesServer) RecvMsg(m interface{}) error { + ret := _m.Called(m) + + var r0 error + if rf, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = rf(m) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Send provides a mock function with given fields: _a0 +func (_m *SpanReaderPlugin_FindTracesServer) Send(_a0 *storage_v1.SpansResponseChunk) error { + ret := _m.Called(_a0) + + var r0 error + if rf, ok := ret.Get(0).(func(*storage_v1.SpansResponseChunk) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendHeader provides a mock function with given fields: _a0 +func (_m *SpanReaderPlugin_FindTracesServer) SendHeader(_a0 metadata.MD) error { + ret := _m.Called(_a0) + + var r0 error + if rf, ok := ret.Get(0).(func(metadata.MD) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendMsg provides a mock function with given fields: m +func (_m *SpanReaderPlugin_FindTracesServer) SendMsg(m interface{}) error { + ret := _m.Called(m) + + var r0 error + if rf, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = rf(m) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SetHeader provides a mock function with given fields: _a0 +func (_m *SpanReaderPlugin_FindTracesServer) SetHeader(_a0 metadata.MD) error { + ret := _m.Called(_a0) + + var r0 error + if rf, ok := ret.Get(0).(func(metadata.MD) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SetTrailer provides a mock function with given fields: _a0 +func (_m *SpanReaderPlugin_FindTracesServer) SetTrailer(_a0 metadata.MD) { + _m.Called(_a0) +} diff --git a/proto-gen/storage_v1/mocks/SpanReaderPlugin_GetTraceClient.go b/proto-gen/storage_v1/mocks/SpanReaderPlugin_GetTraceClient.go new file mode 100644 index 00000000000..fca0337a316 --- /dev/null +++ b/proto-gen/storage_v1/mocks/SpanReaderPlugin_GetTraceClient.go @@ -0,0 +1,133 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import context "context" +import metadata "google.golang.org/grpc/metadata" +import mock "github.com/stretchr/testify/mock" +import storage_v1 "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + +// SpanReaderPlugin_GetTraceClient is an autogenerated mock type for the SpanReaderPlugin_GetTraceClient type +type SpanReaderPlugin_GetTraceClient struct { + mock.Mock +} + +// CloseSend provides a mock function with given fields: +func (_m *SpanReaderPlugin_GetTraceClient) CloseSend() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Context provides a mock function with given fields: +func (_m *SpanReaderPlugin_GetTraceClient) Context() context.Context { + ret := _m.Called() + + var r0 context.Context + if rf, ok := ret.Get(0).(func() context.Context); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(context.Context) + } + } + + return r0 +} + +// Header provides a mock function with given fields: +func (_m *SpanReaderPlugin_GetTraceClient) Header() (metadata.MD, error) { + ret := _m.Called() + + var r0 metadata.MD + if rf, ok := ret.Get(0).(func() metadata.MD); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(metadata.MD) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Recv provides a mock function with given fields: +func (_m *SpanReaderPlugin_GetTraceClient) Recv() (*storage_v1.SpansResponseChunk, error) { + ret := _m.Called() + + var r0 *storage_v1.SpansResponseChunk + if rf, ok := ret.Get(0).(func() *storage_v1.SpansResponseChunk); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.SpansResponseChunk) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// RecvMsg provides a mock function with given fields: m +func (_m *SpanReaderPlugin_GetTraceClient) RecvMsg(m interface{}) error { + ret := _m.Called(m) + + var r0 error + if rf, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = rf(m) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendMsg provides a mock function with given fields: m +func (_m *SpanReaderPlugin_GetTraceClient) SendMsg(m interface{}) error { + ret := _m.Called(m) + + var r0 error + if rf, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = rf(m) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Trailer provides a mock function with given fields: +func (_m *SpanReaderPlugin_GetTraceClient) Trailer() metadata.MD { + ret := _m.Called() + + var r0 metadata.MD + if rf, ok := ret.Get(0).(func() metadata.MD); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(metadata.MD) + } + } + + return r0 +} diff --git a/proto-gen/storage_v1/mocks/SpanReaderPlugin_GetTraceServer.go b/proto-gen/storage_v1/mocks/SpanReaderPlugin_GetTraceServer.go new file mode 100644 index 00000000000..a28a1b073e7 --- /dev/null +++ b/proto-gen/storage_v1/mocks/SpanReaderPlugin_GetTraceServer.go @@ -0,0 +1,104 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import context "context" +import metadata "google.golang.org/grpc/metadata" +import mock "github.com/stretchr/testify/mock" +import storage_v1 "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + +// SpanReaderPlugin_GetTraceServer is an autogenerated mock type for the SpanReaderPlugin_GetTraceServer type +type SpanReaderPlugin_GetTraceServer struct { + mock.Mock +} + +// Context provides a mock function with given fields: +func (_m *SpanReaderPlugin_GetTraceServer) Context() context.Context { + ret := _m.Called() + + var r0 context.Context + if rf, ok := ret.Get(0).(func() context.Context); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(context.Context) + } + } + + return r0 +} + +// RecvMsg provides a mock function with given fields: m +func (_m *SpanReaderPlugin_GetTraceServer) RecvMsg(m interface{}) error { + ret := _m.Called(m) + + var r0 error + if rf, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = rf(m) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Send provides a mock function with given fields: _a0 +func (_m *SpanReaderPlugin_GetTraceServer) Send(_a0 *storage_v1.SpansResponseChunk) error { + ret := _m.Called(_a0) + + var r0 error + if rf, ok := ret.Get(0).(func(*storage_v1.SpansResponseChunk) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendHeader provides a mock function with given fields: _a0 +func (_m *SpanReaderPlugin_GetTraceServer) SendHeader(_a0 metadata.MD) error { + ret := _m.Called(_a0) + + var r0 error + if rf, ok := ret.Get(0).(func(metadata.MD) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SendMsg provides a mock function with given fields: m +func (_m *SpanReaderPlugin_GetTraceServer) SendMsg(m interface{}) error { + ret := _m.Called(m) + + var r0 error + if rf, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = rf(m) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SetHeader provides a mock function with given fields: _a0 +func (_m *SpanReaderPlugin_GetTraceServer) SetHeader(_a0 metadata.MD) error { + ret := _m.Called(_a0) + + var r0 error + if rf, ok := ret.Get(0).(func(metadata.MD) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SetTrailer provides a mock function with given fields: _a0 +func (_m *SpanReaderPlugin_GetTraceServer) SetTrailer(_a0 metadata.MD) { + _m.Called(_a0) +} diff --git a/proto-gen/storage_v1/mocks/SpanWriterPluginClient.go b/proto-gen/storage_v1/mocks/SpanWriterPluginClient.go new file mode 100644 index 00000000000..fdc4e3c5fe2 --- /dev/null +++ b/proto-gen/storage_v1/mocks/SpanWriterPluginClient.go @@ -0,0 +1,43 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import context "context" +import grpc "google.golang.org/grpc" +import mock "github.com/stretchr/testify/mock" +import storage_v1 "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + +// SpanWriterPluginClient is an autogenerated mock type for the SpanWriterPluginClient type +type SpanWriterPluginClient struct { + mock.Mock +} + +// WriteSpan provides a mock function with given fields: ctx, in, opts +func (_m *SpanWriterPluginClient) WriteSpan(ctx context.Context, in *storage_v1.WriteSpanRequest, opts ...grpc.CallOption) (*storage_v1.WriteSpanResponse, error) { + _va := make([]interface{}, len(opts)) + for _i := range opts { + _va[_i] = opts[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, in) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *storage_v1.WriteSpanResponse + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.WriteSpanRequest, ...grpc.CallOption) *storage_v1.WriteSpanResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.WriteSpanResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.WriteSpanRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} diff --git a/proto-gen/storage_v1/mocks/SpanWriterPluginServer.go b/proto-gen/storage_v1/mocks/SpanWriterPluginServer.go new file mode 100644 index 00000000000..f9c98750de5 --- /dev/null +++ b/proto-gen/storage_v1/mocks/SpanWriterPluginServer.go @@ -0,0 +1,35 @@ +// Code generated by mockery v1.0.0. DO NOT EDIT. + +package mocks + +import context "context" +import mock "github.com/stretchr/testify/mock" +import storage_v1 "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + +// SpanWriterPluginServer is an autogenerated mock type for the SpanWriterPluginServer type +type SpanWriterPluginServer struct { + mock.Mock +} + +// WriteSpan provides a mock function with given fields: _a0, _a1 +func (_m *SpanWriterPluginServer) WriteSpan(_a0 context.Context, _a1 *storage_v1.WriteSpanRequest) (*storage_v1.WriteSpanResponse, error) { + ret := _m.Called(_a0, _a1) + + var r0 *storage_v1.WriteSpanResponse + if rf, ok := ret.Get(0).(func(context.Context, *storage_v1.WriteSpanRequest) *storage_v1.WriteSpanResponse); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*storage_v1.WriteSpanResponse) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func(context.Context, *storage_v1.WriteSpanRequest) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} From 6041195a070623ad33d4bd51fc6758876a342578 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Fri, 3 May 2019 17:24:05 +0100 Subject: [PATCH 28/30] Add grpc server tests Signed-off-by: Charles Dixon --- plugin/storage/grpc/shared/empty_test.go | 15 -- plugin/storage/grpc/shared/grpc_client.go | 4 +- .../storage/grpc/shared/grpc_client_test.go | 8 +- .../storage/grpc/shared/grpc_server_test.go | 185 ++++++++++++++++++ 4 files changed, 191 insertions(+), 21 deletions(-) delete mode 100644 plugin/storage/grpc/shared/empty_test.go create mode 100644 plugin/storage/grpc/shared/grpc_server_test.go diff --git a/plugin/storage/grpc/shared/empty_test.go b/plugin/storage/grpc/shared/empty_test.go deleted file mode 100644 index 5f6014db2d3..00000000000 --- a/plugin/storage/grpc/shared/empty_test.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2018 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 shared diff --git a/plugin/storage/grpc/shared/grpc_client.go b/plugin/storage/grpc/shared/grpc_client.go index cede367d99a..8cf0f6edfa2 100644 --- a/plugin/storage/grpc/shared/grpc_client.go +++ b/plugin/storage/grpc/shared/grpc_client.go @@ -64,8 +64,8 @@ func (c *grpcClient) GetTrace(ctx context.Context, traceID model.TraceID) (*mode return nil, errors.Wrap(err, "grpc stream error") } - for _, span := range received.Spans { - trace.Spans = append(trace.Spans, &span) + for i := range received.Spans { + trace.Spans = append(trace.Spans, &received.Spans[i]) } } diff --git a/plugin/storage/grpc/shared/grpc_client_test.go b/plugin/storage/grpc/shared/grpc_client_test.go index a8618eec419..3ffe0c9bd63 100644 --- a/plugin/storage/grpc/shared/grpc_client_test.go +++ b/plugin/storage/grpc/shared/grpc_client_test.go @@ -117,8 +117,8 @@ func TestGRPCClientGetTrace(t *testing.T) { }).Return(traceClient, nil) var expectedSpans []*model.Span - for _, span := range mockTraceSpans { - expectedSpans = append(expectedSpans, &span) + for i := range mockTraceSpans { + expectedSpans = append(expectedSpans, &mockTraceSpans[i]) } s, err := r.client.GetTrace(context.Background(), mockTraceID) @@ -169,13 +169,13 @@ func TestGRPCClientFindTraces(t *testing.T) { var expectedTraces []*model.Trace var traceID model.TraceID var trace *model.Trace - for _, span := range mockTracesSpans { + for i, span := range mockTracesSpans { if span.TraceID != traceID { trace = &model.Trace{} traceID = span.TraceID expectedTraces = append(expectedTraces, trace) } - trace.Spans = append(trace.Spans, &span) + trace.Spans = append(trace.Spans, &mockTracesSpans[i]) } s, err := r.client.FindTraces(context.Background(), &spanstore.TraceQueryParameters{}) diff --git a/plugin/storage/grpc/shared/grpc_server_test.go b/plugin/storage/grpc/shared/grpc_server_test.go new file mode 100644 index 00000000000..ab9c3765a90 --- /dev/null +++ b/plugin/storage/grpc/shared/grpc_server_test.go @@ -0,0 +1,185 @@ +package shared + +import ( + "context" + "testing" + "time" + + "github.com/jaegertracing/jaeger/model" + + "github.com/jaegertracing/jaeger/proto-gen/storage_v1" + grpcMocks "github.com/jaegertracing/jaeger/proto-gen/storage_v1/mocks" + "github.com/jaegertracing/jaeger/storage/dependencystore" + dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" + "github.com/jaegertracing/jaeger/storage/spanstore" + spanStoreMocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" +) + +type mockStoragePlugin struct { + spanReader *spanStoreMocks.Reader + spanWriter *spanStoreMocks.Writer + depsReader *dependencyStoreMocks.Reader +} + +func (plugin *mockStoragePlugin) SpanReader() spanstore.Reader { + return plugin.spanReader +} + +func (plugin *mockStoragePlugin) SpanWriter() spanstore.Writer { + return plugin.spanWriter +} + +func (plugin *mockStoragePlugin) DependencyReader() dependencystore.Reader { + return plugin.depsReader +} + +type grpcServerTest struct { + server *grpcServer + impl *mockStoragePlugin +} + +func withGRPCServer(fn func(r *grpcServerTest)) { + spanReader := new(spanStoreMocks.Reader) + spanWriter := new(spanStoreMocks.Writer) + depReader := new(dependencyStoreMocks.Reader) + + impl := &mockStoragePlugin{ + spanWriter: spanWriter, + spanReader: spanReader, + depsReader: depReader, + } + + r := &grpcServerTest{ + server: &grpcServer{ + Impl: impl, + }, + impl: impl, + } + fn(r) +} + +func TestGRPCServerGetServices(t *testing.T) { + withGRPCServer(func(r *grpcServerTest) { + r.impl.spanReader.On("GetServices", mock.Anything). + Return([]string{"service-a"}, nil) + + s, err := r.server.GetServices(context.Background(), &storage_v1.GetServicesRequest{}) + assert.NoError(t, err) + assert.Equal(t, &storage_v1.GetServicesResponse{Services: []string{"service-a"}}, s) + }) +} + +func TestGRPCServerGetOperations(t *testing.T) { + withGRPCServer(func(r *grpcServerTest) { + r.impl.spanReader.On("GetOperations", mock.Anything, "service-a"). + Return([]string{"operation-a"}, nil) + + s, err := r.server.GetOperations(context.Background(), &storage_v1.GetOperationsRequest{ + Service: "service-a", + }) + assert.NoError(t, err) + assert.Equal(t, &storage_v1.GetOperationsResponse{Operations: []string{"operation-a"}}, s) + }) +} + +func TestGRPCServerGetTrace(t *testing.T) { + withGRPCServer(func(r *grpcServerTest) { + traceSteam := new(grpcMocks.SpanReaderPlugin_GetTraceServer) + traceSteam.On("Context").Return(context.Background()) + traceSteam.On("Send", &storage_v1.SpansResponseChunk{Spans: mockTraceSpans}). + Return(nil) + + var traceSpans []*model.Span + for i := range mockTraceSpans { + traceSpans = append(traceSpans, &mockTraceSpans[i]) + } + r.impl.spanReader.On("GetTrace", mock.Anything, mockTraceID). + Return(&model.Trace{Spans: traceSpans}, nil) + + err := r.server.GetTrace(&storage_v1.GetTraceRequest{ + TraceID: mockTraceID, + }, traceSteam) + assert.NoError(t, err) + }) +} + +func TestGRPCServerFindTraces(t *testing.T) { + withGRPCServer(func(r *grpcServerTest) { + traceSteam := new(grpcMocks.SpanReaderPlugin_FindTracesServer) + traceSteam.On("Context").Return(context.Background()) + traceSteam.On("Send", &storage_v1.SpansResponseChunk{Spans: mockTracesSpans[:2]}). + Return(nil).Once() + traceSteam.On("Send", &storage_v1.SpansResponseChunk{Spans: mockTracesSpans[2:]}). + Return(nil).Once() + + var traces []*model.Trace + var traceID model.TraceID + var trace *model.Trace + for i, span := range mockTracesSpans { + if span.TraceID != traceID { + trace = &model.Trace{} + traceID = span.TraceID + traces = append(traces, trace) + } + trace.Spans = append(trace.Spans, &mockTracesSpans[i]) + } + + r.impl.spanReader.On("FindTraces", mock.Anything, &spanstore.TraceQueryParameters{}). + Return(traces, nil) + + err := r.server.FindTraces(&storage_v1.FindTracesRequest{ + Query: &storage_v1.TraceQueryParameters{}, + }, traceSteam) + assert.NoError(t, err) + }) +} + +func TestGRPCServerFindTraceIDs(t *testing.T) { + withGRPCServer(func(r *grpcServerTest) { + r.impl.spanReader.On("FindTraceIDs", mock.Anything, &spanstore.TraceQueryParameters{}). + Return([]model.TraceID{mockTraceID, mockTraceID2}, nil) + + s, err := r.server.FindTraceIDs(context.Background(), &storage_v1.FindTraceIDsRequest{ + Query: &storage_v1.TraceQueryParameters{}, + }) + assert.NoError(t, err) + assert.Equal(t, &storage_v1.FindTraceIDsResponse{TraceIDs: []model.TraceID{mockTraceID, mockTraceID2}}, s) + }) +} + +func TestGRPCServerWriteSpan(t *testing.T) { + withGRPCServer(func(r *grpcServerTest) { + r.impl.spanWriter.On("WriteSpan", &mockTraceSpans[0]). + Return(nil) + + s, err := r.server.WriteSpan(context.Background(), &storage_v1.WriteSpanRequest{ + Span: &mockTraceSpans[0], + }) + assert.NoError(t, err) + assert.Equal(t, &storage_v1.WriteSpanResponse{}, s) + }) +} + +func TestGRPCServerGetDependencies(t *testing.T) { + withGRPCServer(func(r *grpcServerTest) { + lookback := time.Duration(1 * time.Second) + end := time.Now() + deps := []model.DependencyLink{ + { + Source: "source", + Child: "child", + }, + } + r.impl.depsReader.On("GetDependencies", end, lookback). + Return(deps, nil) + + s, err := r.server.GetDependencies(context.Background(), &storage_v1.GetDependenciesRequest{ + StartTime: end.Add(-lookback), + EndTime: end, + }) + assert.NoError(t, err) + assert.Equal(t, &storage_v1.GetDependenciesResponse{Dependencies: deps}, s) + }) +} From 86d8a1fb614bf4d6e54509ee8bbab0e280ff5501 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Fri, 3 May 2019 17:24:28 +0100 Subject: [PATCH 29/30] Run make fmt Signed-off-by: Charles Dixon --- .../storage/grpc/shared/grpc_client_test.go | 23 ++++++++++++++----- .../storage/grpc/shared/grpc_server_test.go | 20 +++++++++++++--- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/plugin/storage/grpc/shared/grpc_client_test.go b/plugin/storage/grpc/shared/grpc_client_test.go index 3ffe0c9bd63..57c8acd0097 100644 --- a/plugin/storage/grpc/shared/grpc_client_test.go +++ b/plugin/storage/grpc/shared/grpc_client_test.go @@ -1,3 +1,17 @@ +// 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 shared import ( @@ -7,16 +21,13 @@ import ( "testing" "time" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/assert" + "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/storage/spanstore" - "github.com/jaegertracing/jaeger/proto-gen/storage_v1" - - "github.com/stretchr/testify/mock" - grpcMocks "github.com/jaegertracing/jaeger/proto-gen/storage_v1/mocks" - - "github.com/stretchr/testify/assert" ) var ( diff --git a/plugin/storage/grpc/shared/grpc_server_test.go b/plugin/storage/grpc/shared/grpc_server_test.go index ab9c3765a90..01f4f2d23e2 100644 --- a/plugin/storage/grpc/shared/grpc_server_test.go +++ b/plugin/storage/grpc/shared/grpc_server_test.go @@ -1,3 +1,17 @@ +// 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 shared import ( @@ -5,16 +19,16 @@ import ( "testing" "time" - "github.com/jaegertracing/jaeger/model" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" grpcMocks "github.com/jaegertracing/jaeger/proto-gen/storage_v1/mocks" "github.com/jaegertracing/jaeger/storage/dependencystore" dependencyStoreMocks "github.com/jaegertracing/jaeger/storage/dependencystore/mocks" "github.com/jaegertracing/jaeger/storage/spanstore" spanStoreMocks "github.com/jaegertracing/jaeger/storage/spanstore/mocks" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" ) type mockStoragePlugin struct { From 4a4304743519bee9bd5e92c05434b124946cc2f7 Mon Sep 17 00:00:00 2001 From: Charles Dixon Date: Fri, 3 May 2019 17:54:32 +0100 Subject: [PATCH 30/30] Strip unnecessary code from test Signed-off-by: Charles Dixon --- plugin/storage/grpc/shared/grpc_client_test.go | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/plugin/storage/grpc/shared/grpc_client_test.go b/plugin/storage/grpc/shared/grpc_client_test.go index 57c8acd0097..3ea04aa0b9e 100644 --- a/plugin/storage/grpc/shared/grpc_client_test.go +++ b/plugin/storage/grpc/shared/grpc_client_test.go @@ -21,13 +21,13 @@ import ( "testing" "time" - "github.com/stretchr/testify/mock" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" "github.com/jaegertracing/jaeger/model" - "github.com/jaegertracing/jaeger/storage/spanstore" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" grpcMocks "github.com/jaegertracing/jaeger/proto-gen/storage_v1/mocks" + "github.com/jaegertracing/jaeger/storage/spanstore" ) var ( @@ -177,18 +177,6 @@ func TestGRPCClientFindTraces(t *testing.T) { Query: &storage_v1.TraceQueryParameters{}, }).Return(traceClient, nil) - var expectedTraces []*model.Trace - var traceID model.TraceID - var trace *model.Trace - for i, span := range mockTracesSpans { - if span.TraceID != traceID { - trace = &model.Trace{} - traceID = span.TraceID - expectedTraces = append(expectedTraces, trace) - } - trace.Spans = append(trace.Spans, &mockTracesSpans[i]) - } - s, err := r.client.FindTraces(context.Background(), &spanstore.TraceQueryParameters{}) assert.NoError(t, err) assert.NotNil(t, s)