diff --git a/.gitignore b/.gitignore index ed9e9790558..e8719d8386d 100644 --- a/.gitignore +++ b/.gitignore @@ -42,7 +42,6 @@ cmd/tracegen/tracegen-* crossdock/crossdock-* run-crossdock.log -proto-gen/.patched-otel-proto/ __pycache__ .asset-manifest.json deploy/ diff --git a/.golangci.yml b/.golangci.yml index 7c4e9314df8..5427041391e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -105,6 +105,9 @@ linters: # Checks usage of github.com/stretchr/testify. - testifylint + # Detects the possibility to use variables/constants from the Go standard library. + - usestdlibvars + # TODO consider adding more linters, cf. https://olegk.dev/go-linters-configuration-the-right-version linters-settings: diff --git a/.mockery.yaml b/.mockery.yaml index ecfd99003ac..14ab5688ba3 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -5,6 +5,12 @@ dir: "{{.InterfaceDir}}/mocks/" mockname: "{{.InterfaceName}}" filename: "{{.InterfaceName}}.go" boilerplate-file: .mockery.header.txt + +# Flags for future v3 compatibility. +# See https://github.com/vektra/mockery/issues/848 +issue-845-fix: true +resolve-type-alias: false + packages: github.com/jaegertracing/jaeger/cmd/collector/app/sanitizer/cache: interfaces: diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c19c04b417..d4788ad3e6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -263,7 +263,7 @@ Dependencies upgrades only. #### 🚧 Experimental Features -* Implement telemetery struct for v1 components initialization ([@Wise-Wizard](https://github.com/Wise-Wizard) in [#5695](https://github.com/jaegertracing/jaeger/pull/5695)) +* Implement telemetry struct for v1 components initialization ([@Wise-Wizard](https://github.com/Wise-Wizard) in [#5695](https://github.com/jaegertracing/jaeger/pull/5695)) * Support default configs for storage backends ([@yurishkuro](https://github.com/yurishkuro) in [#5691](https://github.com/jaegertracing/jaeger/pull/5691)) * Simplify configs organization ([@yurishkuro](https://github.com/yurishkuro) in [#5690](https://github.com/jaegertracing/jaeger/pull/5690)) * Create metrics.factory adapter for otel metrics ([@Wise-Wizard](https://github.com/Wise-Wizard) in [#5661](https://github.com/jaegertracing/jaeger/pull/5661)) diff --git a/Makefile.Protobuf.mk b/Makefile.Protobuf.mk index 875ab90b0da..bb10b7d8ad0 100644 --- a/Makefile.Protobuf.mk +++ b/Makefile.Protobuf.mk @@ -14,15 +14,15 @@ # instead of the go_package's declared by the imported protof files. # +DOCKER=docker DOCKER_PROTOBUF_VERSION=0.5.0 DOCKER_PROTOBUF=jaegertracing/protobuf:$(DOCKER_PROTOBUF_VERSION) -PROTOC := docker run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD} ${DOCKER_PROTOBUF} --proto_path=${PWD} +PROTOC := ${DOCKER} run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD} ${DOCKER_PROTOBUF} --proto_path=${PWD} PATCHED_OTEL_PROTO_DIR = proto-gen/.patched-otel-proto PROTO_INCLUDES := \ -Iidl/proto/api_v2 \ - -Iidl/proto/api_v3 \ -Imodel/proto/metrics \ -I/usr/include/github.com/gogo/protobuf @@ -127,9 +127,18 @@ proto-zipkin: # Note that the .pb.go types must be generated into the same internal package $(API_V3_PATH) # where a manually defined traces.go file is located. API_V3_PATH=cmd/query/app/internal/api_v3 +API_V3_PATCHED_DIR=proto-gen/.patched/api_v3 +API_V3_PATCHED=$(API_V3_PATCHED_DIR)/query_service.proto +.PHONY: patch-api-v3 +patch-api-v3: + mkdir -p $(API_V3_PATCHED_DIR) + cat idl/proto/api_v3/query_service.proto | \ + $(SED) -f ./proto-gen/patch-api-v3.sed \ + > $(API_V3_PATCHED) + .PHONY: proto-api-v3 -proto-api-v3: - $(call proto_compile, $(API_V3_PATH), idl/proto/api_v3/query_service.proto, -Iidl/opentelemetry-proto) +proto-api-v3: patch-api-v3 + $(call proto_compile, $(API_V3_PATH), $(API_V3_PATCHED), -I$(API_V3_PATCHED_DIR) -Iidl/opentelemetry-proto) @echo "🏗️ replace TracesData with internal custom type" $(SED) -i 's/v1.TracesData/TracesData/g' $(API_V3_PATH)/query_service.pb.go @echo "🏗️ remove OTEL import because we're not using any other OTLP types" diff --git a/cmd/all-in-one/main.go b/cmd/all-in-one/main.go index d2b97337c7f..e13d50ee961 100644 --- a/cmd/all-in-one/main.go +++ b/cmd/all-in-one/main.go @@ -14,9 +14,7 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" + noopmetric "go.opentelemetry.io/otel/metric/noop" _ "go.uber.org/automaxprocs" "go.uber.org/zap" @@ -33,7 +31,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/jtracer" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/pkg/version" metricsPlugin "github.com/jaegertracing/jaeger/plugin/metrics" @@ -41,9 +39,11 @@ import ( "github.com/jaegertracing/jaeger/plugin/storage" "github.com/jaegertracing/jaeger/ports" "github.com/jaegertracing/jaeger/storage/dependencystore" - metricsstoreMetrics "github.com/jaegertracing/jaeger/storage/metricsstore/metrics" "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" "github.com/jaegertracing/jaeger/storage_v2/spanstore" + "github.com/jaegertracing/jaeger/storage/metricsstore/metricstoremetrics" + "github.com/jaegertracing/jaeger/storage/spanstore" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) // all-in-one/main is a standalone full-stack jaeger backend, backed by a memory store @@ -96,8 +96,16 @@ by default uses only in-memory database.`, logger.Fatal("Failed to initialize tracer", zap.Error(err)) } + baseTelset := telemetry.Settings{ + Logger: svc.Logger, + TracerProvider: tracer.OTEL, + Metrics: baseFactory, + MeterProvider: noopmetric.NewMeterProvider(), + ReportStatus: telemetry.HCAdapter(svc.HC()), + } + storageFactory.InitFromViper(v, logger) - if err := storageFactory.Initialize(baseFactory, logger); err != nil { + if err := storageFactory.Initialize(baseTelset.Metrics, baseTelset.Logger); err != nil { logger.Fatal("Failed to init storage factory", zap.Error(err)) } @@ -160,20 +168,13 @@ by default uses only in-memory database.`, log.Fatal(err) } - telset := telemetery.Setting{ - Logger: svc.Logger, - TracerProvider: tracer.OTEL, - Metrics: queryMetricsFactory, - ReportStatus: telemetery.HCAdapter(svc.HC()), - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() - }, - } // query + queryTelset := baseTelset // copy + queryTelset.Metrics = queryMetricsFactory querySrv := startQuery( svc, qOpts, qOpts.BuildQueryServiceOptions(storageFactory, logger), traceReader, dependencyReader, metricsQueryService, - tm, telset, + tm, queryTelset, ) svc.RunAndThen(func() { @@ -223,10 +224,10 @@ func startQuery( depReader dependencystore.Reader, metricsQueryService querysvc.MetricsQueryService, tm *tenancy.Manager, - telset telemetery.Setting, + telset telemetry.Settings, ) *queryApp.Server { - // TODO: decorate trace reader with metrics - qs := querysvc.NewQueryService(traceReader, depReader, *queryOpts) + spanReader = spanstoremetrics.NewReaderDecorator(spanReader, telset.Metrics) + qs := querysvc.NewQueryService(spanReader, depReader, *queryOpts) server, err := queryApp.NewServer(context.Background(), qs, metricsQueryService, qOpts, tm, telset) if err != nil { @@ -257,5 +258,5 @@ func createMetricsQueryService( } // Decorate the metrics reader with metrics instrumentation. - return metricsstoreMetrics.NewReadMetricsDecorator(reader, metricsReaderMetricsFactory), nil + return metricstoremetrics.NewReaderDecorator(reader, metricsReaderMetricsFactory), nil } diff --git a/cmd/anonymizer/app/anonymizer/anonymizer_test.go b/cmd/anonymizer/app/anonymizer/anonymizer_test.go index 431cc0162a6..6d2f219c062 100644 --- a/cmd/anonymizer/app/anonymizer/anonymizer_test.go +++ b/cmd/anonymizer/app/anonymizer/anonymizer_test.go @@ -4,6 +4,7 @@ package anonymizer import ( + "net/http" "os" "path/filepath" "testing" @@ -18,7 +19,7 @@ import ( var tags = []model.KeyValue{ model.Bool("error", true), - model.String("http.method", "POST"), + model.String("http.method", http.MethodPost), model.Bool("foobar", true), } @@ -127,7 +128,7 @@ func TestAnonymizer_SaveMapping(t *testing.T) { func TestAnonymizer_FilterStandardTags(t *testing.T) { expected := []model.KeyValue{ model.Bool("error", true), - model.String("http.method", "POST"), + model.String("http.method", http.MethodPost), } actual := filterStandardTags(tags) assert.Equal(t, expected, actual) diff --git a/cmd/anonymizer/app/writer/writer_test.go b/cmd/anonymizer/app/writer/writer_test.go index c6e11434ccc..dc746f16b63 100644 --- a/cmd/anonymizer/app/writer/writer_test.go +++ b/cmd/anonymizer/app/writer/writer_test.go @@ -4,6 +4,7 @@ package writer import ( + "net/http" "testing" "time" @@ -15,7 +16,7 @@ import ( var tags = []model.KeyValue{ model.Bool("error", true), - model.String("http.method", "POST"), + model.String("http.method", http.MethodPost), model.Bool("foobar", true), } diff --git a/cmd/collector/main.go b/cmd/collector/main.go index db658c209b4..86f26d1cb84 100644 --- a/cmd/collector/main.go +++ b/cmd/collector/main.go @@ -24,6 +24,7 @@ import ( "github.com/jaegertracing/jaeger/cmd/internal/status" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/metrics" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/pkg/version" ss "github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider" @@ -63,8 +64,12 @@ func main() { metricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "collector"}) version.NewInfoMetrics(metricsFactory) + baseTelset := telemetry.NoopSettings() + baseTelset.Logger = svc.Logger + baseTelset.Metrics = baseFactory + storageFactory.InitFromViper(v, logger) - if err := storageFactory.Initialize(baseFactory, logger); err != nil { + if err := storageFactory.Initialize(baseTelset.Metrics, baseTelset.Logger); err != nil { logger.Fatal("Failed to init storage factory", zap.Error(err)) } spanWriter, err := storageFactory.CreateSpanWriter() diff --git a/cmd/es-index-cleaner/app/flags.go b/cmd/es-index-cleaner/app/flags.go index 671e1aabc9b..7c1d8ee7974 100644 --- a/cmd/es-index-cleaner/app/flags.go +++ b/cmd/es-index-cleaner/app/flags.go @@ -7,6 +7,9 @@ import ( "flag" "github.com/spf13/viper" + "go.opentelemetry.io/collector/config/configtls" + + "github.com/jaegertracing/jaeger/pkg/config/tlscfg" ) const ( @@ -19,6 +22,8 @@ const ( password = "es.password" ) +var tlsFlagsCfg = tlscfg.ClientFlagsConfig{Prefix: "es"} + // Config holds configuration for index cleaner binary. type Config struct { IndexPrefix string @@ -29,6 +34,7 @@ type Config struct { Username string Password string TLSEnabled bool + TLSConfig configtls.ClientConfig } // AddFlags adds flags for TLS to the FlagSet. @@ -40,6 +46,7 @@ func (*Config) AddFlags(flags *flag.FlagSet) { flags.String(indexDateSeparator, "-", "Index date separator") flags.String(username, "", "The username required by storage") flags.String(password, "", "The password required by storage") + tlsFlagsCfg.AddFlags(flags) } // InitFromViper initializes config from viper.Viper. @@ -55,4 +62,9 @@ func (c *Config) InitFromViper(v *viper.Viper) { c.IndexDateSeparator = v.GetString(indexDateSeparator) c.Username = v.GetString(username) c.Password = v.GetString(password) + opts, err := tlsFlagsCfg.InitFromViper(v) + if err != nil { + panic(err) + } + c.TLSConfig = opts.ToOtelClientConfig() } diff --git a/cmd/es-index-cleaner/main.go b/cmd/es-index-cleaner/main.go index a0ea71775c2..50d7bbcdcae 100644 --- a/cmd/es-index-cleaner/main.go +++ b/cmd/es-index-cleaner/main.go @@ -4,6 +4,7 @@ package main import ( + "context" "encoding/base64" "errors" "fmt" @@ -18,7 +19,6 @@ import ( "github.com/jaegertracing/jaeger/cmd/es-index-cleaner/app" "github.com/jaegertracing/jaeger/pkg/config" - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" "github.com/jaegertracing/jaeger/pkg/es/client" ) @@ -26,7 +26,6 @@ func main() { logger, _ := zap.NewProduction() v := viper.New() cfg := &app.Config{} - tlsFlags := tlscfg.ClientFlagsConfig{Prefix: "es"} command := &cobra.Command{ Use: "jaeger-es-index-cleaner NUM_OF_DAYS http://HOSTNAME:PORT", @@ -42,21 +41,18 @@ func main() { } cfg.InitFromViper(v) - tlsOpts, err := tlsFlags.InitFromViper(v) - if err != nil { - return err - } - tlsCfg, err := tlsOpts.Config(logger) + + ctx := context.Background() + tlscfg, err := cfg.TLSConfig.LoadTLSConfig(ctx) if err != nil { - return err + return fmt.Errorf("error loading tls config : %w", err) } - defer tlsOpts.Close() c := &http.Client{ Timeout: time.Duration(cfg.MasterNodeTimeoutSeconds) * time.Second, Transport: &http.Transport{ Proxy: http.ProxyFromEnvironment, - TLSClientConfig: tlsCfg, + TLSClientConfig: tlscfg, }, } i := client.IndicesClient{ @@ -101,7 +97,6 @@ func main() { v, command, cfg.AddFlags, - tlsFlags.AddFlags, ) if err := command.Execute(); err != nil { diff --git a/cmd/es-rollover/app/actions.go b/cmd/es-rollover/app/actions.go index 8dbeff30e95..3b3cf6149cf 100644 --- a/cmd/es-rollover/app/actions.go +++ b/cmd/es-rollover/app/actions.go @@ -4,14 +4,15 @@ package app import ( + "context" "crypto/tls" + "fmt" "net/http" "time" "github.com/spf13/viper" "go.uber.org/zap" - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" "github.com/jaegertracing/jaeger/pkg/es/client" ) @@ -37,10 +38,9 @@ type Action interface { // ActionExecuteOptions are the options passed to the execute action function type ActionExecuteOptions struct { - Args []string - Viper *viper.Viper - Logger *zap.Logger - TLSFlags tlscfg.ClientFlagsConfig + Args []string + Viper *viper.Viper + Logger *zap.Logger } // ActionCreatorFunction type is the function type in charge of create the action to be executed @@ -50,15 +50,12 @@ type ActionCreatorFunction func(client.Client, Config) Action func ExecuteAction(opts ActionExecuteOptions, createAction ActionCreatorFunction) error { cfg := Config{} cfg.InitFromViper(opts.Viper) - tlsOpts, err := opts.TLSFlags.InitFromViper(opts.Viper) - if err != nil { - return err - } - tlsCfg, err := tlsOpts.Config(opts.Logger) + + ctx := context.Background() + tlsCfg, err := cfg.TLSConfig.LoadTLSConfig(ctx) if err != nil { - return err + return fmt.Errorf("TLS configuration failed: %w", err) } - defer tlsOpts.Close() esClient := newESClient(opts.Args[0], &cfg, tlsCfg) action := createAction(esClient, cfg) diff --git a/cmd/es-rollover/app/actions_test.go b/cmd/es-rollover/app/actions_test.go index e4b7a33c34f..bc78ef11827 100644 --- a/cmd/es-rollover/app/actions_test.go +++ b/cmd/es-rollover/app/actions_test.go @@ -5,17 +5,14 @@ package app import ( "errors" - "flag" "net/http" "testing" - "github.com/spf13/cobra" - "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap" - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" + "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/es/client" ) @@ -73,22 +70,14 @@ func TestExecuteAction(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - v := viper.New() - tlsFlags := tlscfg.ClientFlagsConfig{Prefix: "es"} - command := cobra.Command{} - flags := &flag.FlagSet{} - tlsFlags.AddFlags(flags) - command.PersistentFlags().AddGoFlagSet(flags) - v.BindPFlags(command.PersistentFlags()) + v, command := config.Viperize(AddFlags) cmdLine := append([]string{"--es.tls.enabled=true"}, test.flags...) - err := command.ParseFlags(cmdLine) - require.NoError(t, err) + require.NoError(t, command.ParseFlags(cmdLine)) executedAction := false - err = ExecuteAction(ActionExecuteOptions{ - Args: args, - Viper: v, - Logger: logger, - TLSFlags: tlsFlags, + err := ExecuteAction(ActionExecuteOptions{ + Args: args, + Viper: v, + Logger: logger, }, func(c client.Client, _ Config) Action { assert.Equal(t, "https://localhost:9300", c.Endpoint) transport, ok := c.Client.Transport.(*http.Transport) @@ -101,7 +90,6 @@ func TestExecuteAction(t *testing.T) { }, } }) - assert.Equal(t, test.expectedExecuteAction, executedAction) if test.configError { require.Error(t, err) diff --git a/cmd/es-rollover/app/flags.go b/cmd/es-rollover/app/flags.go index bf7bfcac1f0..a1456546546 100644 --- a/cmd/es-rollover/app/flags.go +++ b/cmd/es-rollover/app/flags.go @@ -7,8 +7,13 @@ import ( "flag" "github.com/spf13/viper" + "go.opentelemetry.io/collector/config/configtls" + + "github.com/jaegertracing/jaeger/pkg/config/tlscfg" ) +var tlsFlagsCfg = tlscfg.ClientFlagsConfig{Prefix: "es"} + const ( indexPrefix = "index-prefix" archive = "archive" @@ -33,6 +38,7 @@ type Config struct { Timeout int SkipDependencies bool AdaptiveSampling bool + TLSConfig configtls.ClientConfig } // AddFlags adds flags @@ -46,6 +52,7 @@ func AddFlags(flags *flag.FlagSet) { flags.Int(timeout, 120, "Number of seconds to wait for master node response") flags.Bool(skipDependencies, false, "Disable rollover for dependencies index") flags.Bool(adaptiveSampling, false, "Enable rollover for adaptive sampling index") + tlsFlagsCfg.AddFlags(flags) } // InitFromViper initializes config from viper.Viper. @@ -62,4 +69,9 @@ func (c *Config) InitFromViper(v *viper.Viper) { c.Timeout = v.GetInt(timeout) c.SkipDependencies = v.GetBool(skipDependencies) c.AdaptiveSampling = v.GetBool(adaptiveSampling) + opts, err := tlsFlagsCfg.InitFromViper(v) + if err != nil { + panic(err) + } + c.TLSConfig = opts.ToOtelClientConfig() } diff --git a/cmd/es-rollover/main.go b/cmd/es-rollover/main.go index 5fe026d6e68..411d4596d2f 100644 --- a/cmd/es-rollover/main.go +++ b/cmd/es-rollover/main.go @@ -16,7 +16,6 @@ import ( "github.com/jaegertracing/jaeger/cmd/es-rollover/app/lookback" "github.com/jaegertracing/jaeger/cmd/es-rollover/app/rollover" "github.com/jaegertracing/jaeger/pkg/config" - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" "github.com/jaegertracing/jaeger/pkg/es/client" ) @@ -30,8 +29,6 @@ func main() { Long: "Jaeger es-rollover manages Jaeger indices", } - tlsFlags := tlscfg.ClientFlagsConfig{Prefix: "es"} - // Init command initCfg := &initialize.Config{} initCommand := &cobra.Command{ @@ -42,10 +39,9 @@ func main() { SilenceUsage: true, RunE: func(_ *cobra.Command, args []string) error { return app.ExecuteAction(app.ActionExecuteOptions{ - Args: args, - Viper: v, - Logger: logger, - TLSFlags: tlsFlags, + Args: args, + Viper: v, + Logger: logger, }, func(c client.Client, cfg app.Config) app.Action { initCfg.Config = cfg initCfg.InitFromViper(v) @@ -80,10 +76,9 @@ func main() { RunE: func(_ *cobra.Command, args []string) error { rolloverCfg.InitFromViper(v) return app.ExecuteAction(app.ActionExecuteOptions{ - Args: args, - Viper: v, - Logger: logger, - TLSFlags: tlsFlags, + Args: args, + Viper: v, + Logger: logger, }, func(c client.Client, cfg app.Config) app.Action { rolloverCfg.Config = cfg rolloverCfg.InitFromViper(v) @@ -109,10 +104,9 @@ func main() { RunE: func(_ *cobra.Command, args []string) error { lookbackCfg.InitFromViper(v) return app.ExecuteAction(app.ActionExecuteOptions{ - Args: args, - Viper: v, - Logger: logger, - TLSFlags: tlsFlags, + Args: args, + Viper: v, + Logger: logger, }, func(c client.Client, cfg app.Config) app.Action { lookbackCfg.Config = cfg lookbackCfg.InitFromViper(v) @@ -129,7 +123,7 @@ func main() { }, } - addPersistentFlags(v, rootCmd, tlsFlags.AddFlags, app.AddFlags) + addPersistentFlags(v, rootCmd, app.AddFlags) addSubCommand(v, rootCmd, initCommand, initCfg.AddFlags) addSubCommand(v, rootCmd, rolloverCommand, rolloverCfg.AddFlags) addSubCommand(v, rootCmd, lookbackCommand, lookbackCfg.AddFlags) diff --git a/cmd/ingester/app/flags_test.go b/cmd/ingester/app/flags_test.go index 9296c99b71d..d390b57481f 100644 --- a/cmd/ingester/app/flags_test.go +++ b/cmd/ingester/app/flags_test.go @@ -12,7 +12,6 @@ import ( "github.com/stretchr/testify/require" "github.com/jaegertracing/jaeger/pkg/config" - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" "github.com/jaegertracing/jaeger/pkg/kafka/auth" "github.com/jaegertracing/jaeger/pkg/testutils" "github.com/jaegertracing/jaeger/plugin/storage/kafka" @@ -64,15 +63,15 @@ func TestTLSFlags(t *testing.T) { }, { flags: []string{"--kafka.consumer.authentication=kerberos", "--kafka.consumer.tls.enabled=true"}, - expected: auth.AuthenticationConfig{Authentication: "kerberos", Kerberos: kerb, TLS: tlscfg.Options{Enabled: true}, PlainText: plain}, + expected: auth.AuthenticationConfig{Authentication: "kerberos", Kerberos: kerb, PlainText: plain}, }, { flags: []string{"--kafka.consumer.authentication=tls"}, - expected: auth.AuthenticationConfig{Authentication: "tls", Kerberos: kerb, TLS: tlscfg.Options{Enabled: true}, PlainText: plain}, + expected: auth.AuthenticationConfig{Authentication: "tls", Kerberos: kerb, PlainText: plain}, }, { flags: []string{"--kafka.consumer.authentication=tls", "--kafka.consumer.tls.enabled=false"}, - expected: auth.AuthenticationConfig{Authentication: "tls", Kerberos: kerb, TLS: tlscfg.Options{Enabled: true}, PlainText: plain}, + expected: auth.AuthenticationConfig{Authentication: "tls", Kerberos: kerb, PlainText: plain}, }, } diff --git a/cmd/ingester/main.go b/cmd/ingester/main.go index 00d9f28e58d..efc08cea61f 100644 --- a/cmd/ingester/main.go +++ b/cmd/ingester/main.go @@ -23,6 +23,7 @@ import ( "github.com/jaegertracing/jaeger/cmd/internal/status" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/metrics" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/version" "github.com/jaegertracing/jaeger/plugin/storage" "github.com/jaegertracing/jaeger/ports" @@ -50,8 +51,12 @@ func main() { metricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "ingester"}) version.NewInfoMetrics(metricsFactory) + baseTelset := telemetry.NoopSettings() + baseTelset.Logger = svc.Logger + baseTelset.Metrics = baseFactory + storageFactory.InitFromViper(v, logger) - if err := storageFactory.Initialize(baseFactory, logger); err != nil { + if err := storageFactory.Initialize(baseTelset.Metrics, baseTelset.Logger); err != nil { logger.Fatal("Failed to init storage factory", zap.Error(err)) } spanWriter, err := storageFactory.CreateSpanWriter() @@ -68,9 +73,6 @@ func main() { consumer.Start() svc.RunAndThen(func() { - if err := options.TLS.Close(); err != nil { - logger.Error("Failed to close TLS certificates watcher", zap.Error(err)) - } if err = consumer.Close(); err != nil { logger.Error("Failed to close consumer", zap.Error(err)) } diff --git a/cmd/internal/status/command.go b/cmd/internal/status/command.go index 02f2e48683a..355719ae4a0 100644 --- a/cmd/internal/status/command.go +++ b/cmd/internal/status/command.go @@ -30,7 +30,7 @@ func Command(v *viper.Viper, adminPort int) *cobra.Command { url := convert(v.GetString(statusHTTPHostPort)) ctx, cx := context.WithTimeout(context.Background(), time.Second) defer cx() - req, _ := http.NewRequestWithContext(ctx, "GET", url, nil) + req, _ := http.NewRequestWithContext(ctx, http.MethodGet, url, nil) resp, err := http.DefaultClient.Do(req) if err != nil { return err diff --git a/cmd/jaeger/Dockerfile b/cmd/jaeger/Dockerfile index 464d81413b1..8c840b7d5e3 100644 --- a/cmd/jaeger/Dockerfile +++ b/cmd/jaeger/Dockerfile @@ -10,6 +10,8 @@ FROM $base_image AS release ARG TARGETARCH ARG USER_UID=10001 +ENV JAEGER_LISTEN_HOST=0.0.0.0 + # Sampling config HTTP EXPOSE 5778 @@ -53,6 +55,8 @@ FROM $debug_image AS debug ARG TARGETARCH=amd64 ARG USER_UID=10001 +ENV JAEGER_LISTEN_HOST=0.0.0.0 + # Sampling config HTTP EXPOSE 5778 diff --git a/cmd/jaeger/config-badger.yaml b/cmd/jaeger/config-badger.yaml index 158e241cb53..b2dae4891a9 100644 --- a/cmd/jaeger/config-badger.yaml +++ b/cmd/jaeger/config-badger.yaml @@ -13,7 +13,7 @@ service: address: 0.0.0.0:8888 logs: level: info - # TODO Initialize telemetery tracer once OTEL released new feature. + # TODO Initialize telemetry tracer once OTEL released new feature. # https://github.com/open-telemetry/opentelemetry-collector/issues/10663 extensions: diff --git a/cmd/jaeger/config-cassandra.yaml b/cmd/jaeger/config-cassandra.yaml index 3ead38258c2..0b7550535da 100644 --- a/cmd/jaeger/config-cassandra.yaml +++ b/cmd/jaeger/config-cassandra.yaml @@ -13,7 +13,7 @@ service: address: 0.0.0.0:8888 logs: level: debug - # TODO Initialize telemetery tracer once OTEL released new feature. + # TODO Initialize telemetry tracer once OTEL released new feature. # https://github.com/open-telemetry/opentelemetry-collector/issues/10663 extensions: diff --git a/cmd/jaeger/config-elasticsearch.yaml b/cmd/jaeger/config-elasticsearch.yaml index 0883dc3b395..6fa4d247e20 100644 --- a/cmd/jaeger/config-elasticsearch.yaml +++ b/cmd/jaeger/config-elasticsearch.yaml @@ -13,7 +13,7 @@ service: address: 0.0.0.0:8888 logs: level: debug - # TODO Initialize telemetery tracer once OTEL released new feature. + # TODO Initialize telemetry tracer once OTEL released new feature. # https://github.com/open-telemetry/opentelemetry-collector/issues/10663 extensions: diff --git a/cmd/jaeger/config-opensearch.yaml b/cmd/jaeger/config-opensearch.yaml index 1fe57d42c39..d6a431dafcf 100644 --- a/cmd/jaeger/config-opensearch.yaml +++ b/cmd/jaeger/config-opensearch.yaml @@ -13,7 +13,7 @@ service: address: 0.0.0.0:8888 logs: level: debug - # TODO Initialize telemetery tracer once OTEL released new feature. + # TODO Initialize telemetry tracer once OTEL released new feature. # https://github.com/open-telemetry/opentelemetry-collector/issues/10663 extensions: diff --git a/cmd/jaeger/config-remote-storage.yaml b/cmd/jaeger/config-remote-storage.yaml index 8402281c17b..655703b2034 100644 --- a/cmd/jaeger/config-remote-storage.yaml +++ b/cmd/jaeger/config-remote-storage.yaml @@ -13,7 +13,7 @@ service: address: 0.0.0.0:8888 logs: level: debug - # TODO Initialize telemetery tracer once OTEL released new feature. + # TODO Initialize telemetry tracer once OTEL released new feature. # https://github.com/open-telemetry/opentelemetry-collector/issues/10663 extensions: diff --git a/docker-compose/monitor/jaeger-v2-config.yml b/cmd/jaeger/config-spm.yaml similarity index 90% rename from docker-compose/monitor/jaeger-v2-config.yml rename to cmd/jaeger/config-spm.yaml index de1a4ac0616..86d6a64576a 100644 --- a/docker-compose/monitor/jaeger-v2-config.yml +++ b/cmd/jaeger/config-spm.yaml @@ -9,6 +9,11 @@ service: receivers: [spanmetrics] exporters: [prometheus] telemetry: + resource: + service.name: jaeger + metrics: + level: detailed + address: 0.0.0.0:8888 logs: level: DEBUG diff --git a/cmd/jaeger/config-tail-sampling-always-sample.yaml b/cmd/jaeger/config-tail-sampling-always-sample.yaml index cdba426ef10..a3064f7b69c 100644 --- a/cmd/jaeger/config-tail-sampling-always-sample.yaml +++ b/cmd/jaeger/config-tail-sampling-always-sample.yaml @@ -13,7 +13,7 @@ service: address: 0.0.0.0:8888 logs: level: debug - # TODO Initialize telemetery tracer once OTEL released new feature. + # TODO Initialize telemetry tracer once OTEL released new feature. # https://github.com/open-telemetry/opentelemetry-collector/issues/10663 extensions: diff --git a/cmd/jaeger/config-tail-sampling-service-name-policy.yaml b/cmd/jaeger/config-tail-sampling-service-name-policy.yaml index 97ee2a7e53f..3478a9ff39d 100644 --- a/cmd/jaeger/config-tail-sampling-service-name-policy.yaml +++ b/cmd/jaeger/config-tail-sampling-service-name-policy.yaml @@ -13,7 +13,7 @@ service: address: 0.0.0.0:8888 logs: level: debug - # TODO Initialize telemetery tracer once OTEL released new feature. + # TODO Initialize telemetry tracer once OTEL released new feature. # https://github.com/open-telemetry/opentelemetry-collector/issues/10663 extensions: diff --git a/cmd/jaeger/config.yaml b/cmd/jaeger/config.yaml index 2df3addb078..cc204f85438 100644 --- a/cmd/jaeger/config.yaml +++ b/cmd/jaeger/config.yaml @@ -13,7 +13,7 @@ service: address: 0.0.0.0:8888 logs: level: debug - # TODO Initialize telemetery tracer once OTEL released new feature. + # TODO Initialize telemetry tracer once OTEL released new feature. # https://github.com/open-telemetry/opentelemetry-collector/issues/10663 extensions: diff --git a/cmd/jaeger/docs/migration/all-in-one-metrics.md b/cmd/jaeger/docs/migration/all-in-one-metrics.md new file mode 100644 index 00000000000..28f165b2be3 --- /dev/null +++ b/cmd/jaeger/docs/migration/all-in-one-metrics.md @@ -0,0 +1,86 @@ +# ALL-IN-ONE METRICS +### Combined Metrics + +| V1 Metric | V1 Labels | V2 Metric | V2 Labels | +|-----------|---------------|-----------|---------------| +| jaeger_query_latency | operation, result | jaeger_query_latency | operation, result | +| jaeger_query_responses | operation | jaeger_query_responses | operation | +| jaeger_query_requests_total | operation, result | jaeger_query_requests_total | operation, result | +| go_gc_duration_seconds | N/A | N/A | N/A | +| go_goroutines | N/A | N/A | N/A | +| go_info | version | N/A | N/A | +| go_memstats_alloc_bytes | N/A | N/A | N/A | +| go_memstats_alloc_bytes_total | N/A | N/A | N/A | +| go_memstats_buck_hash_sys_bytes | N/A | N/A | N/A | +| go_memstats_frees_total | N/A | N/A | N/A | +| go_memstats_gc_sys_bytes | N/A | N/A | N/A | +| go_memstats_heap_alloc_bytes | N/A | N/A | N/A | +| go_memstats_heap_idle_bytes | N/A | N/A | N/A | +| go_memstats_heap_inuse_bytes | N/A | N/A | N/A | +| go_memstats_heap_objects | N/A | N/A | N/A | +| go_memstats_heap_released_bytes | N/A | N/A | N/A | +| go_memstats_heap_sys_bytes | N/A | N/A | N/A | +| go_memstats_last_gc_time_seconds | N/A | N/A | N/A | +| go_memstats_lookups_total | N/A | N/A | N/A | +| go_memstats_mallocs_total | N/A | N/A | N/A | +| go_memstats_mcache_inuse_bytes | N/A | N/A | N/A | +| go_memstats_mcache_sys_bytes | N/A | N/A | N/A | +| go_memstats_mspan_inuse_bytes | N/A | N/A | N/A | +| go_memstats_mspan_sys_bytes | N/A | N/A | N/A | +| go_memstats_next_gc_bytes | N/A | N/A | N/A | +| go_memstats_other_sys_bytes | N/A | N/A | N/A | +| go_memstats_stack_inuse_bytes | N/A | N/A | N/A | +| go_memstats_stack_sys_bytes | N/A | N/A | N/A | +| go_memstats_sys_bytes | N/A | N/A | N/A | +| go_threads | N/A | N/A | N/A | +| jaeger_build_info | build_date, revision, version | N/A | N/A | +| jaeger_collector_batch_size | host | N/A | N/A | +| jaeger_collector_http_request_duration | method, path, status | N/A | N/A | +| jaeger_collector_http_server_errors_total | source, status | N/A | N/A | +| jaeger_collector_http_server_requests_total | type | N/A | N/A | +| jaeger_collector_in_queue_latency | host | N/A | N/A | +| jaeger_collector_queue_capacity | host | N/A | N/A | +| jaeger_collector_queue_length | host | N/A | N/A | +| jaeger_collector_save_latency | host | N/A | N/A | +| jaeger_collector_spans_bytes | host | N/A | N/A | +| jaeger_collector_spans_dropped_total | host | N/A | N/A | +| jaeger_collector_spans_received_total | debug, format, svc, transport | N/A | N/A | +| jaeger_collector_spans_rejected_total | debug, format, svc, transport | N/A | N/A | +| jaeger_collector_spans_saved_by_svc_total | debug, result, svc | N/A | N/A | +| jaeger_collector_spans_serviceNames | host | N/A | N/A | +| jaeger_collector_traces_received_total | debug, format, sampler_type, svc, transport | N/A | N/A | +| jaeger_collector_traces_rejected_total | debug, format, sampler_type, svc, transport | N/A | N/A | +| jaeger_collector_traces_saved_by_svc_total | debug, result, sampler_type, svc | N/A | N/A | +| process_cpu_seconds_total | N/A | N/A | N/A | +| process_max_fds | N/A | N/A | N/A | +| process_open_fds | N/A | N/A | N/A | +| process_resident_memory_bytes | N/A | N/A | N/A | +| process_start_time_seconds | N/A | N/A | N/A | +| process_virtual_memory_bytes | N/A | N/A | N/A | +| process_virtual_memory_max_bytes | N/A | N/A | N/A | +| N/A | N/A | exporter_send_failed_spans | exporter, service_instance_id, service_name, service_version | +| N/A | N/A | exporter_sent_spans | exporter, service_instance_id, service_name, service_version | +| N/A | N/A | process_cpu_seconds | service_instance_id, service_name, service_version | +| N/A | N/A | process_memory_rss | service_instance_id, service_name, service_version | +| N/A | N/A | process_runtime_heap_alloc_bytes | service_instance_id, service_name, service_version | +| N/A | N/A | process_runtime_total_alloc_bytes | service_instance_id, service_name, service_version | +| N/A | N/A | process_runtime_total_sys_memory_bytes | service_instance_id, service_name, service_version | +| N/A | N/A | process_uptime | service_instance_id, service_name, service_version | +| N/A | N/A | processor_batch_batch_send_size | processor, service_instance_id, service_name, service_version | +| N/A | N/A | processor_batch_batch_send_size_bytes | processor, service_instance_id, service_name, service_version | +| N/A | N/A | processor_batch_metadata_cardinality | processor, service_instance_id, service_name, service_version | +| N/A | N/A | processor_batch_timeout_trigger_send | processor, service_instance_id, service_name, service_version | +| N/A | N/A | receiver_accepted_spans | receiver, service_instance_id, service_name, service_version, transport | +| N/A | N/A | receiver_refused_spans | receiver, service_instance_id, service_name, service_version, transport | +| N/A | N/A | rpc_server_duration | rpc_grpc_status_code, rpc_method, rpc_service, rpc_system, service_instance_id, service_name, service_version | +| N/A | N/A | rpc_server_request_size | rpc_method, rpc_service, rpc_system, service_instance_id, service_name, service_version | +| N/A | N/A | rpc_server_requests_per_rpc | rpc_grpc_status_code, rpc_method, rpc_service, rpc_system, service_instance_id, service_name, service_version | +| N/A | N/A | rpc_server_response_size | rpc_method, rpc_service, rpc_system, service_instance_id, service_name, service_version | +| N/A | N/A | rpc_server_responses_per_rpc | rpc_grpc_status_code, rpc_method, rpc_service, rpc_system, service_instance_id, service_name, service_version | +| N/A | N/A | target_info | service_instance_id, service_name, service_version | +### Equivalent Metrics + +| V1 Metric | V1 Labels | V2 Metric | V2 Labels | +|-----------|---------------|-----------|---------------| +| jaeger_collector_spans_rejected_total | debug, format, svc, transport | receiver_refused_spans | receiver, service_instance_id, service_name, service_version, transport | +| jaeger_build_info | build_date, revision, version | target_info | service_instance_id, service_name, service_version | diff --git a/cmd/jaeger/docs/migration/badger-metrics.md b/cmd/jaeger/docs/migration/badger-metrics.md new file mode 100644 index 00000000000..65656e44c6a --- /dev/null +++ b/cmd/jaeger/docs/migration/badger-metrics.md @@ -0,0 +1,33 @@ +# BADGER METRICS + +### Combined Metrics + +| V1 Metric | V1 Parameters | V2 Metric | V2 Parameters | +| ------------------------------------------ | ------------- | ---------------------------------------- | ------------- | +| jaeger_badger_compaction_current_num_lsm | N/A | jaeger_badger_compaction_current_num_lsm | N/A | +| jaeger_badger_get_num_memtable | N/A | jaeger_badger_get_num_memtable | N/A | +| jaeger_badger_get_num_user | N/A | jaeger_badger_get_num_user | N/A | +| jaeger_badger_get_with_result_num_user | N/A | jaeger_badger_get_with_result_num_user | N/A | +| jaeger_badger_iterator_num_user | N/A | jaeger_badger_iterator_num_user | N/A | +| jaeger_badger_put_num_user | N/A | jaeger_badger_put_num_user | N/A | +| jaeger_badger_read_bytes_lsm | N/A | jaeger_badger_read_bytes_lsm | N/A | +| jaeger_badger_read_bytes_vlog | N/A | jaeger_badger_read_bytes_vlog | N/A | +| jaeger_badger_read_num_vlog | N/A | jaeger_badger_read_num_vlog | N/A | +| jaeger_badger_size_bytes_lsm | N/A | jaeger_badger_size_bytes_lsm | N/A | +| jaeger_badger_size_bytes_vlog | N/A | jaeger_badger_size_bytes_vlog | N/A | +| jaeger_badger_write_bytes_l0 | N/A | jaeger_badger_write_bytes_l0 | N/A | +| jaeger_badger_write_bytes_user | N/A | jaeger_badger_write_bytes_user | N/A | +| jaeger_badger_write_bytes_vlog | N/A | jaeger_badger_write_bytes_vlog | N/A | +| jaeger_badger_write_num_vlog | N/A | jaeger_badger_write_num_vlog | N/A | +| jaeger_badger_write_pending_num_memtable | N/A | jaeger_badger_write_pending_num_memtable | N/A | +| jaeger_badger_key_log_bytes_available | N/A | N/A | N/A | +| jaeger_badger_storage_maintenance_last_run | N/A | N/A | N/A | +| jaeger_badger_storage_valueloggc_last_run | N/A | N/A | N/A | +| jaeger_badger_value_log_bytes_available | N/A | N/A | N/A | + +### Equivalent Metrics + +| V1 Metric | V1 Parameters | V2 Metric | V2 Parameters | +| ------------------------------------- | ------------------------------ | ---------------------- | ----------------------------------------------------------------------- | +| jaeger_collector_spans_rejected_total | debug, format, svc, transport | receiver_refused_spans | receiver, service_instance_id, service_name, service_version, transport | +| jaeger_build_info | build_date, revision, version | target_info | service_instance_id, service_name, service_version | diff --git a/cmd/jaeger/docs/migration/cassandra-metrics.md b/cmd/jaeger/docs/migration/cassandra-metrics.md new file mode 100644 index 00000000000..95d453f7ca3 --- /dev/null +++ b/cmd/jaeger/docs/migration/cassandra-metrics.md @@ -0,0 +1,22 @@ +# CASSANDRA METRICS +### Combined Metrics + +| V1 Metric | V1 Parameters | V2 Metric | V2 Parameters | +|-----------|---------------|-----------|---------------| +| jaeger_cassandra_attempts_total | table | jaeger_cassandra_attempts_total | table | +| jaeger_cassandra_errors_total | table | jaeger_cassandra_errors_total | table | +| jaeger_cassandra_inserts_total | table | jaeger_cassandra_inserts_total | table | +| jaeger_cassandra_latency_err | table | jaeger_cassandra_latency_err | table | +| jaeger_cassandra_latency_ok | table | jaeger_cassandra_latency_ok | table | +| jaeger_cassandra_read_attempts_total | table | jaeger_cassandra_read_attempts_total | table | +| jaeger_cassandra_read_errors_total | table | jaeger_cassandra_read_errors_total | table | +| jaeger_cassandra_read_inserts_total | table | jaeger_cassandra_read_inserts_total | table | +| jaeger_cassandra_read_latency_err | table | jaeger_cassandra_read_latency_err | table | +| jaeger_cassandra_read_latency_ok | table | jaeger_cassandra_read_latency_ok | table | +| jaeger_cassandra_tag_index_skipped_total | N/A | jaeger_cassandra_tag_index_skipped_total | N/A | +### Equivalent Metrics + +| V1 Metric | V1 Parameters | V2 Metric | V2 Parameters | +|-----------|---------------|-----------|---------------| +| jaeger_collector_spans_rejected_total | debug, format, svc, transport | receiver_refused_spans | receiver, service_instance_id, service_name, service_version, transport | +| jaeger_build_info | build_date, revision, version | target_info | service_instance_id, service_name, service_version | diff --git a/cmd/jaeger/docs/migration/elasticsearch-metrics.md b/cmd/jaeger/docs/migration/elasticsearch-metrics.md new file mode 100644 index 00000000000..9b5a0a0b608 --- /dev/null +++ b/cmd/jaeger/docs/migration/elasticsearch-metrics.md @@ -0,0 +1,21 @@ +# ELASTICSEARCH METRICS +### Combined Metrics + +| V1 Metric | V1 Parameters | V2 Metric | V2 Parameters | +|-----------|---------------|-----------|---------------| +| jaeger_bulk_index_attempts_total | N/A | jaeger_bulk_index_attempts_total | N/A | +| jaeger_bulk_index_errors_total | N/A | jaeger_bulk_index_errors_total | N/A | +| jaeger_bulk_index_inserts_total | N/A | jaeger_bulk_index_inserts_total | N/A | +| jaeger_bulk_index_latency_err | N/A | jaeger_bulk_index_latency_err | N/A | +| jaeger_bulk_index_latency_ok | N/A | jaeger_bulk_index_latency_ok | N/A | +| jaeger_index_create_attempts_total | N/A | jaeger_index_create_attempts_total | N/A | +| jaeger_index_create_errors_total | N/A | jaeger_index_create_errors_total | N/A | +| jaeger_index_create_inserts_total | N/A | jaeger_index_create_inserts_total | N/A | +| jaeger_index_create_latency_err | N/A | jaeger_index_create_latency_err | N/A | +| jaeger_index_create_latency_ok | N/A | jaeger_index_create_latency_ok | N/A | +### Equivalent Metrics + +| V1 Metric | V1 Parameters | V2 Metric | V2 Parameters | +|-----------|---------------|-----------|---------------| +| jaeger_collector_spans_rejected_total | debug, format, svc, transport | receiver_refused_spans | receiver, service_instance_id, service_name, service_version, transport | +| jaeger_build_info | build_date, revision, version | target_info | service_instance_id, service_name, service_version | diff --git a/cmd/jaeger/docs/migration/opensearch-metrics.md b/cmd/jaeger/docs/migration/opensearch-metrics.md new file mode 100644 index 00000000000..aa5052c270b --- /dev/null +++ b/cmd/jaeger/docs/migration/opensearch-metrics.md @@ -0,0 +1,21 @@ +# OPENSEARCH METRICS +### Combined Metrics + +| V1 Metric | V1 Parameters | V2 Metric | V2 Parameters | +|-----------|---------------|-----------|---------------| +| jaeger_bulk_index_attempts_total | N/A | jaeger_bulk_index_attempts_total | N/A | +| jaeger_bulk_index_errors_total | N/A | jaeger_bulk_index_errors_total | N/A | +| jaeger_bulk_index_inserts_total | N/A | jaeger_bulk_index_inserts_total | N/A | +| jaeger_bulk_index_latency_err | N/A | jaeger_bulk_index_latency_err | N/A | +| jaeger_bulk_index_latency_ok | N/A | jaeger_bulk_index_latency_ok | N/A | +| jaeger_index_create_attempts_total | N/A | jaeger_index_create_attempts_total | N/A | +| jaeger_index_create_errors_total | N/A | jaeger_index_create_errors_total | N/A | +| jaeger_index_create_inserts_total | N/A | jaeger_index_create_inserts_total | N/A | +| jaeger_index_create_latency_err | N/A | jaeger_index_create_latency_err | N/A | +| jaeger_index_create_latency_ok | N/A | jaeger_index_create_latency_ok | N/A | +### Equivalent Metrics + +| V1 Metric | V1 Parameters | V2 Metric | V2 Parameters | +|-----------|---------------|-----------|---------------| +| jaeger_collector_spans_rejected_total | debug, format, svc, transport | receiver_refused_spans | receiver, service_instance_id, service_name, service_version, transport | +| jaeger_build_info | build_date, revision, version | target_info | service_instance_id, service_name, service_version | diff --git a/cmd/jaeger/internal/all-in-one.yaml b/cmd/jaeger/internal/all-in-one.yaml index 5417b95d133..65a1d84e60c 100644 --- a/cmd/jaeger/internal/all-in-one.yaml +++ b/cmd/jaeger/internal/all-in-one.yaml @@ -10,10 +10,10 @@ service: service.name: jaeger metrics: level: detailed - address: 0.0.0.0:8888 + address: "${env:JAEGER_LISTEN_HOST:-localhost}:8888" logs: level: info - # TODO Initialize telemetery tracer once OTEL released new feature. + # TODO Initialize telemetry tracer once OTEL released new feature. # https://github.com/open-telemetry/opentelemetry-collector/issues/10663 extensions: @@ -35,31 +35,36 @@ extensions: # sampling_store: some_store # initial_sampling_probability: 0.1 http: + endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:5778" grpc: + endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:5779" healthcheckv2: use_v2: true http: - endpoint: "0.0.0.0:13133" + endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:13133" grpc: expvar: - port: 27777 + endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:27777" receivers: otlp: protocols: grpc: + endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:4317" http: + endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:4318" jaeger: protocols: grpc: - thrift_binary: - thrift_compact: + endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:14250" thrift_http: + endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:14268" zipkin: + endpoint: "${env:JAEGER_LISTEN_HOST:-localhost}:9411" processors: batch: diff --git a/cmd/jaeger/internal/command.go b/cmd/jaeger/internal/command.go index d0b6ea772c5..6ac217dadd6 100644 --- a/cmd/jaeger/internal/command.go +++ b/cmd/jaeger/internal/command.go @@ -30,7 +30,7 @@ func Command() *cobra.Command { info := component.BuildInfo{ Command: "jaeger", Description: description, - Version: version.Get().String(), + Version: version.Get().GitVersion, } settings := otelcol.CollectorSettings{ diff --git a/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go b/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go index 5ebe56c90aa..c7ff1f9208a 100644 --- a/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go +++ b/cmd/jaeger/internal/exporters/storageexporter/exporter_test.go @@ -175,9 +175,11 @@ func makeStorageExtension(t *testing.T, memstoreName string) component.Host { extension.Settings{ TelemetrySettings: telemetrySettings, }, - &jaegerstorage.Config{Backends: map[string]jaegerstorage.Backend{ - memstoreName: {Memory: &memory.Configuration{MaxTraces: 10000}}, - }}, + &jaegerstorage.Config{ + TraceBackends: map[string]jaegerstorage.TraceBackend{ + memstoreName: {Memory: &memory.Configuration{MaxTraces: 10000}}, + }, + }, ) require.NoError(t, err) diff --git a/cmd/jaeger/internal/extension/expvar/config.go b/cmd/jaeger/internal/extension/expvar/config.go index 8f793570b7f..30fcec1f1ee 100644 --- a/cmd/jaeger/internal/extension/expvar/config.go +++ b/cmd/jaeger/internal/extension/expvar/config.go @@ -5,10 +5,11 @@ package expvar import ( "github.com/asaskevich/govalidator" + "go.opentelemetry.io/collector/config/confighttp" ) type Config struct { - Port int `mapstructure:"port"` + confighttp.ServerConfig `mapstructure:",squash"` } func (cfg *Config) Validate() error { diff --git a/cmd/jaeger/internal/extension/expvar/extension.go b/cmd/jaeger/internal/extension/expvar/extension.go index 74dd41cc51c..4a90338e60f 100644 --- a/cmd/jaeger/internal/extension/expvar/extension.go +++ b/cmd/jaeger/internal/extension/expvar/extension.go @@ -8,8 +8,9 @@ import ( "errors" "expvar" "fmt" + "net" "net/http" - "time" + "sync" "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componentstatus" @@ -27,6 +28,8 @@ type expvarExtension struct { config *Config server *http.Server telset component.TelemetrySettings + + shutdownWG sync.WaitGroup } func newExtension(config *Config, telset component.TelemetrySettings) *expvarExtension { @@ -36,20 +39,26 @@ func newExtension(config *Config, telset component.TelemetrySettings) *expvarExt } } -func (c *expvarExtension) Start(_ context.Context, host component.Host) error { - c.server = &http.Server{ - Addr: fmt.Sprintf(":%d", c.config.Port), - Handler: expvar.Handler(), - ReadHeaderTimeout: 3 * time.Second, +func (c *expvarExtension) Start(ctx context.Context, host component.Host) error { + server, err := c.config.ToServer(ctx, host, c.telset, expvar.Handler()) + if err != nil { + return err + } + c.server = server + var hln net.Listener + if hln, err = c.config.ToListener(ctx); err != nil { + return err } - c.telset.Logger.Info("Starting expvar server", zap.String("addr", c.server.Addr)) + c.telset.Logger.Info("Starting expvar server", zap.Stringer("addr", hln.Addr())) + c.shutdownWG.Add(1) go func() { - if err := c.server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) { + defer c.shutdownWG.Done() + + if err := c.server.Serve(hln); err != nil && !errors.Is(err, http.ErrServerClosed) { err = fmt.Errorf("error starting expvar server: %w", err) componentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(err)) } }() - return nil } @@ -58,6 +67,7 @@ func (c *expvarExtension) Shutdown(ctx context.Context) error { if err := c.server.Shutdown(ctx); err != nil { return fmt.Errorf("error shutting down expvar server: %w", err) } + c.shutdownWG.Wait() } return nil } diff --git a/cmd/jaeger/internal/extension/expvar/extension_test.go b/cmd/jaeger/internal/extension/expvar/extension_test.go index 5a61ebc66b7..057baf090cb 100644 --- a/cmd/jaeger/internal/extension/expvar/extension_test.go +++ b/cmd/jaeger/internal/extension/expvar/extension_test.go @@ -13,6 +13,8 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/storagetest" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/configauth" + "go.opentelemetry.io/collector/config/confighttp" "go.uber.org/zap/zaptest" ) @@ -30,7 +32,9 @@ func TestExpvarExtension(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { config := &Config{ - Port: Port, + ServerConfig: confighttp.ServerConfig{ + Endpoint: "0.0.0.0:27777", + }, } s := newExtension(config, component.TelemetrySettings{ Logger: zaptest.NewLogger(t), @@ -51,3 +55,21 @@ func TestExpvarExtension(t *testing.T) { }) } } + +func TestExpvarExtension_StartError(t *testing.T) { + config := &Config{ + ServerConfig: confighttp.ServerConfig{ + Endpoint: "0.0.0.0:27777", + Auth: &confighttp.AuthConfig{ + Authentication: configauth.Authentication{ + AuthenticatorID: component.MustNewID("invalid_auth"), + }, + }, + }, + } + s := newExtension(config, component.TelemetrySettings{ + Logger: zaptest.NewLogger(t), + }) + err := s.Start(context.Background(), storagetest.NewStorageHost()) + require.ErrorContains(t, err, "invalid_auth") +} diff --git a/cmd/jaeger/internal/extension/expvar/factory.go b/cmd/jaeger/internal/extension/expvar/factory.go index 1236128a9d9..a70f94cf4bb 100644 --- a/cmd/jaeger/internal/extension/expvar/factory.go +++ b/cmd/jaeger/internal/extension/expvar/factory.go @@ -5,8 +5,10 @@ package expvar import ( "context" + "fmt" "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/extension" ) @@ -27,7 +29,9 @@ func NewFactory() extension.Factory { func createDefaultConfig() component.Config { return &Config{ - Port: Port, + ServerConfig: confighttp.ServerConfig{ + Endpoint: fmt.Sprintf("0.0.0.0:%d", Port), + }, } } diff --git a/cmd/jaeger/internal/extension/jaegerquery/server.go b/cmd/jaeger/internal/extension/jaegerquery/server.go index c7e3669145d..e99819e0f2d 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server.go @@ -9,7 +9,6 @@ import ( "fmt" "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/extension" "go.opentelemetry.io/collector/extension/extensioncapabilities" @@ -19,10 +18,12 @@ import ( "github.com/jaegertracing/jaeger/internal/metrics/otelmetrics" "github.com/jaegertracing/jaeger/pkg/jtracer" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin/metrics/disabled" "github.com/jaegertracing/jaeger/storage/metricsstore" + "github.com/jaegertracing/jaeger/storage/metricsstore/metricstoremetrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) var ( @@ -55,6 +56,30 @@ func (s *server) Start(ctx context.Context, host component.Host) error { baseFactory := mf.Namespace(metrics.NSOptions{Name: "jaeger"}) queryMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "query"}) v1Factory, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host) + // TODO OTel-collector does not initialize the tracer currently + // https://github.com/open-telemetry/opentelemetry-collector/issues/7532 + //nolint + tracerProvider, err := jtracer.New("jaeger") + if err != nil { + return fmt.Errorf("could not initialize a tracer: %w", err) + } + // make sure to close the tracer if subsequent code exists with error + success := false + defer func(ctx context.Context) { + if success { + s.closeTracer = tracerProvider.Close + } else { + tracerProvider.Close(ctx) + } + }(ctx) + + telset := telemetry.FromOtelComponent(s.telset, host) + telset.TracerProvider = tracerProvider.OTEL + telset.Metrics = telset.Metrics. + Namespace(metrics.NSOptions{Name: "jaeger"}). + Namespace(metrics.NSOptions{Name: "query"}) + + f, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host) if err != nil { return fmt.Errorf("cannot find primary storage from v1 factory %s: %w", s.config.Storage.TracesPrimary, err) } @@ -69,7 +94,7 @@ func (s *server) Start(ctx context.Context, host component.Host) error { return fmt.Errorf("cannot create span reader: %w", err) } - // TODO: decorate trace reader with metrics + spanReader = spanstoremetrics.NewReaderDecorator(spanReader, telset.Metrics) depReader, err := v1Factory.CreateDependencyReader() if err != nil { @@ -89,25 +114,6 @@ func (s *server) Start(ctx context.Context, host component.Host) error { tm := tenancy.NewManager(&s.config.Tenancy) - // TODO OTel-collector does not initialize the tracer currently - // https://github.com/open-telemetry/opentelemetry-collector/issues/7532 - //nolint - tracerProvider, err := jtracer.New("jaeger") - if err != nil { - return fmt.Errorf("could not initialize a tracer: %w", err) - } - s.closeTracer = tracerProvider.Close - telset := telemetery.Setting{ - Logger: s.telset.Logger, - TracerProvider: tracerProvider.OTEL, - Metrics: queryMetricsFactory, - ReportStatus: func(event *componentstatus.Event) { - componentstatus.ReportStatus(host, event) - }, - LeveledMeterProvider: s.telset.LeveledMeterProvider, - Host: host, - } - s.server, err = queryApp.NewServer( ctx, // TODO propagate healthcheck updates up to the collector's runtime @@ -125,6 +131,7 @@ func (s *server) Start(ctx context.Context, host component.Host) error { return fmt.Errorf("could not start jaeger-query: %w", err) } + success = true return nil } @@ -151,16 +158,20 @@ func (s *server) createMetricReader(host component.Host) (metricsstore.Reader, e return disabled.NewMetricsReader() } - mf, err := jaegerstorage.GetMetricsFactory(s.config.Storage.Metrics, host) + msf, err := jaegerstorage.GetMetricStorageFactory(s.config.Storage.Metrics, host) if err != nil { return nil, fmt.Errorf("cannot find metrics storage factory: %w", err) } - metricsReader, err := mf.CreateMetricsReader() + metricsReader, err := msf.CreateMetricsReader() if err != nil { return nil, fmt.Errorf("cannot create metrics reader %w", err) } - return metricsReader, err + + // Decorate the metrics reader with metrics instrumentation. + mf := otelmetrics.NewFactory(s.telset.MeterProvider) + mf = mf.Namespace(metrics.NSOptions{Name: "jaeger_metricstore"}) + return metricstoremetrics.NewReaderDecorator(metricsReader, mf), nil } func (s *server) Shutdown(ctx context.Context) error { diff --git a/cmd/jaeger/internal/extension/jaegerquery/server_test.go b/cmd/jaeger/internal/extension/jaegerquery/server_test.go index 6fd95566e9f..54b3733f24c 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server_test.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server_test.go @@ -17,9 +17,8 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/confignet" - "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/otel/metric" noopmetric "go.opentelemetry.io/otel/metric/noop" + nooptrace "go.opentelemetry.io/otel/trace/noop" "go.uber.org/zap" "go.uber.org/zap/zaptest" @@ -134,7 +133,7 @@ func TestServerStart(t *testing.T) { expectedErr string }{ { - name: "Non-empty config with fake storage host", + name: "Real server with non-empty config", config: &Config{ Storage: Storage{ TracesArchive: "jaeger_storage", @@ -204,15 +203,16 @@ func TestServerStart(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { + // Despite using Noop Tracer below, query service also creates jtracer. + // We want to prevent that tracer from sampling anything in this test. + t.Setenv("OTEL_TRACES_SAMPLER", "always_off") telemetrySettings := component.TelemetrySettings{ - Logger: zaptest.NewLogger(t, zaptest.WrapOptions(zap.AddCaller())), - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noopmetric.NewMeterProvider() - }, - MeterProvider: noopmetric.NewMeterProvider(), + Logger: zaptest.NewLogger(t, zaptest.WrapOptions(zap.AddCaller())), + MeterProvider: noopmetric.NewMeterProvider(), + TracerProvider: nooptrace.NewTracerProvider(), } - tt.config.HTTP.Endpoint = ":0" - tt.config.GRPC.NetAddr.Endpoint = ":0" + tt.config.HTTP.Endpoint = "localhost:0" + tt.config.GRPC.NetAddr.Endpoint = "localhost:0" tt.config.GRPC.NetAddr.Transport = confignet.TransportTypeTCP server := newServer(tt.config, telemetrySettings) err := server.Start(context.Background(), host) @@ -297,7 +297,9 @@ func TestServerAddArchiveStorage(t *testing.T) { t.Run(tt.name, func(t *testing.T) { logger, buf := testutils.NewLogger() telemetrySettings := component.TelemetrySettings{ - Logger: logger, + Logger: logger, + MeterProvider: noopmetric.NewMeterProvider(), + TracerProvider: nooptrace.NewTracerProvider(), } server := newServer(tt.config, telemetrySettings) if tt.extension != nil { @@ -347,7 +349,9 @@ func TestServerAddMetricsStorage(t *testing.T) { t.Run(tt.name, func(t *testing.T) { logger, buf := testutils.NewLogger() telemetrySettings := component.TelemetrySettings{ - Logger: logger, + Logger: logger, + MeterProvider: noopmetric.NewMeterProvider(), + TracerProvider: nooptrace.NewTracerProvider(), } server := newServer(tt.config, telemetrySettings) if tt.extension != nil { diff --git a/cmd/jaeger/internal/extension/jaegerstorage/config.go b/cmd/jaeger/internal/extension/jaegerstorage/config.go index 5f5189841df..0bafa5aa654 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/config.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/config.go @@ -25,8 +25,8 @@ import ( var ( _ component.ConfigValidator = (*Config)(nil) - _ confmap.Unmarshaler = (*Backend)(nil) - _ confmap.Unmarshaler = (*MetricBackends)(nil) + _ confmap.Unmarshaler = (*TraceBackend)(nil) + _ confmap.Unmarshaler = (*MetricBackend)(nil) ) // Config contains configuration(s) for jaeger trace storage. @@ -35,11 +35,12 @@ var ( // We tried to alias this type directly to a map, but conf did not populated it correctly. // Note also that the Backend struct has a custom unmarshaler. type Config struct { - Backends map[string]Backend `mapstructure:"backends"` - MetricBackends map[string]MetricBackends `mapstructure:"metric_backends"` + TraceBackends map[string]TraceBackend `mapstructure:"backends"` + MetricBackends map[string]MetricBackend `mapstructure:"metric_backends"` } -type Backend struct { +// TraceBackend contains configuration for a single trace storage backend. +type TraceBackend struct { Memory *memory.Configuration `mapstructure:"memory"` Badger *badger.Config `mapstructure:"badger"` GRPC *grpc.Config `mapstructure:"grpc"` @@ -48,14 +49,15 @@ type Backend struct { Opensearch *esCfg.Configuration `mapstructure:"opensearch"` } -type MetricBackends struct { +// MetricBackend contains configuration for a single metric storage backend. +type MetricBackend struct { Prometheus *promCfg.Configuration `mapstructure:"prometheus"` } // Unmarshal implements confmap.Unmarshaler. This allows us to provide // defaults for different configs. It cannot be done in createDefaultConfig() // because at that time we don't know which backends the user wants to use. -func (cfg *Backend) Unmarshal(conf *confmap.Conf) error { +func (cfg *TraceBackend) Unmarshal(conf *confmap.Conf) error { // apply defaults if conf.IsSet("memory") { cfg.Memory = &memory.Configuration{ @@ -96,19 +98,19 @@ func (cfg *Backend) Unmarshal(conf *confmap.Conf) error { } func (cfg *Config) Validate() error { - if len(cfg.Backends) == 0 { + if len(cfg.TraceBackends) == 0 { return errors.New("at least one storage is required") } - for name, b := range cfg.Backends { - empty := Backend{} + for name, b := range cfg.TraceBackends { + empty := TraceBackend{} if reflect.DeepEqual(b, empty) { - return fmt.Errorf("no backend defined for storage '%s'", name) + return fmt.Errorf("empty backend configuration for storage '%s'", name) } } return nil } -func (cfg *MetricBackends) Unmarshal(conf *confmap.Conf) error { +func (cfg *MetricBackend) Unmarshal(conf *confmap.Conf) error { // apply defaults if conf.IsSet("prometheus") { v := prometheus.DefaultConfig() diff --git a/cmd/jaeger/internal/extension/jaegerstorage/config_test.go b/cmd/jaeger/internal/extension/jaegerstorage/config_test.go index 58a000051bd..9f531caf255 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/config_test.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/config_test.go @@ -39,7 +39,7 @@ backends: `) cfg := createDefaultConfig().(*Config) require.NoError(t, conf.Unmarshal(cfg)) - require.EqualError(t, cfg.Validate(), "no backend defined for storage 'some_storage'") + require.EqualError(t, cfg.Validate(), "empty backend configuration for storage 'some_storage'") } func TestConfigDefaultMemory(t *testing.T) { @@ -50,7 +50,7 @@ backends: `) cfg := createDefaultConfig().(*Config) require.NoError(t, conf.Unmarshal(cfg)) - assert.NotEmpty(t, cfg.Backends["some_storage"].Memory.MaxTraces) + assert.NotEmpty(t, cfg.TraceBackends["some_storage"].Memory.MaxTraces) } func TestConfigDefaultBadger(t *testing.T) { @@ -61,7 +61,7 @@ backends: `) cfg := createDefaultConfig().(*Config) require.NoError(t, conf.Unmarshal(cfg)) - assert.NotEmpty(t, cfg.Backends["some_storage"].Badger.TTL.Spans) + assert.NotEmpty(t, cfg.TraceBackends["some_storage"].Badger.TTL.Spans) } func TestConfigDefaultGRPC(t *testing.T) { @@ -72,7 +72,7 @@ backends: `) cfg := createDefaultConfig().(*Config) require.NoError(t, conf.Unmarshal(cfg)) - assert.NotEmpty(t, cfg.Backends["some_storage"].GRPC.Timeout) + assert.NotEmpty(t, cfg.TraceBackends["some_storage"].GRPC.Timeout) } func TestConfigDefaultCassandra(t *testing.T) { @@ -83,7 +83,7 @@ backends: `) cfg := createDefaultConfig().(*Config) require.NoError(t, conf.Unmarshal(cfg)) - assert.NotEmpty(t, cfg.Backends["some_storage"].Cassandra.Primary.Connection.Servers) + assert.NotEmpty(t, cfg.TraceBackends["some_storage"].Cassandra.Primary.Connection.Servers) } func TestConfigDefaultElasticsearch(t *testing.T) { @@ -94,7 +94,7 @@ backends: `) cfg := createDefaultConfig().(*Config) require.NoError(t, conf.Unmarshal(cfg)) - assert.NotEmpty(t, cfg.Backends["some_storage"].Elasticsearch.Servers) + assert.NotEmpty(t, cfg.TraceBackends["some_storage"].Elasticsearch.Servers) } func TestConfigDefaultOpensearch(t *testing.T) { @@ -105,7 +105,7 @@ backends: `) cfg := createDefaultConfig().(*Config) require.NoError(t, conf.Unmarshal(cfg)) - assert.NotEmpty(t, cfg.Backends["some_storage"].Opensearch.Servers) + assert.NotEmpty(t, cfg.TraceBackends["some_storage"].Opensearch.Servers) } func TestConfigDefaultPrometheus(t *testing.T) { diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension.go b/cmd/jaeger/internal/extension/jaegerstorage/extension.go index 7f401f86382..e931b611de9 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension.go @@ -10,13 +10,10 @@ import ( "io" "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/extension" - "go.opentelemetry.io/otel/metric" - "github.com/jaegertracing/jaeger/internal/metrics/otelmetrics" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/plugin/metrics/prometheus" "github.com/jaegertracing/jaeger/plugin/storage/badger" "github.com/jaegertracing/jaeger/plugin/storage/cassandra" @@ -43,7 +40,8 @@ type storageExt struct { metricsFactories map[string]storage.MetricsFactory } -// GetStorageFactory locates the extension in Host and retrieves a storage factory from it with the given name. +// GetStorageFactory locates the extension in Host and retrieves +// a trace storage factory from it with the given name. func GetStorageFactory(name string, host component.Host) (storage.Factory, error) { ext, err := findExtension(host) if err != nil { @@ -59,8 +57,9 @@ func GetStorageFactory(name string, host component.Host) (storage.Factory, error return f, nil } -// GetMetricsFactory locates the extension in Host and retrieves a metrics factory from it with the given name. -func GetMetricsFactory(name string, host component.Host) (storage.MetricsFactory, error) { +// GetMetricStorageFactory locates the extension in Host and retrieves +// a metric storage factory from it with the given name. +func GetMetricStorageFactory(name string, host component.Host) (storage.MetricsFactory, error) { ext, err := findExtension(host) if err != nil { return nil, err @@ -116,34 +115,26 @@ func newStorageExt(config *Config, telset component.TelemetrySettings) *storageE } func (s *storageExt) Start(_ context.Context, host component.Host) error { - baseFactory := otelmetrics.NewFactory(s.telset.MeterProvider) - mf := baseFactory.Namespace(metrics.NSOptions{Name: "jaeger"}) - for storageName, cfg := range s.config.Backends { + telset := telemetry.FromOtelComponent(s.telset, host) + telset.Metrics = telset.Metrics.Namespace(metrics.NSOptions{Name: "jaeger"}) + for storageName, cfg := range s.config.TraceBackends { s.telset.Logger.Sugar().Infof("Initializing storage '%s'", storageName) var factory storage.Factory var err error = errors.New("empty configuration") switch { case cfg.Memory != nil: - factory, err = memory.NewFactoryWithConfig(*cfg.Memory, mf, s.telset.Logger), nil + factory, err = memory.NewFactoryWithConfig(*cfg.Memory, telset.Metrics, s.telset.Logger), nil case cfg.Badger != nil: - factory, err = badger.NewFactoryWithConfig(*cfg.Badger, mf, s.telset.Logger) + factory, err = badger.NewFactoryWithConfig(*cfg.Badger, telset.Metrics, s.telset.Logger) case cfg.GRPC != nil: - telset := telemetery.Setting{ - Logger: s.telset.Logger, - Host: host, - Metrics: mf, - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return s.telset.MeterProvider - }, - } //nolint: contextcheck factory, err = grpc.NewFactoryWithConfig(*cfg.GRPC, telset) case cfg.Cassandra != nil: - factory, err = cassandra.NewFactoryWithConfig(*cfg.Cassandra, mf, s.telset.Logger) + factory, err = cassandra.NewFactoryWithConfig(*cfg.Cassandra, telset.Metrics, s.telset.Logger) case cfg.Elasticsearch != nil: - factory, err = es.NewFactoryWithConfig(*cfg.Elasticsearch, mf, s.telset.Logger) + factory, err = es.NewFactoryWithConfig(*cfg.Elasticsearch, telset.Metrics, s.telset.Logger) case cfg.Opensearch != nil: - factory, err = es.NewFactoryWithConfig(*cfg.Opensearch, mf, s.telset.Logger) + factory, err = es.NewFactoryWithConfig(*cfg.Opensearch, telset.Metrics, s.telset.Logger) } if err != nil { return fmt.Errorf("failed to initialize storage '%s': %w", storageName, err) diff --git a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go index 8b49292a600..6213c912765 100644 --- a/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go +++ b/cmd/jaeger/internal/extension/jaegerstorage/extension_test.go @@ -71,13 +71,13 @@ func TestStorageFactoryBadNameError(t *testing.T) { } func TestMetricsFactoryBadHostError(t *testing.T) { - _, err := GetMetricsFactory("something", componenttest.NewNopHost()) + _, err := GetMetricStorageFactory("something", componenttest.NewNopHost()) require.ErrorContains(t, err, "cannot find extension") } func TestMetricsFactoryBadNameError(t *testing.T) { host := storagetest.NewStorageHost().WithExtension(ID, startStorageExtension(t, "", "foo")) - _, err := GetMetricsFactory("bar", host) + _, err := GetMetricStorageFactory("bar", host) require.ErrorContains(t, err, "cannot find metric storage 'bar'") } @@ -116,14 +116,14 @@ func TestGetFactory(t *testing.T) { require.NoError(t, err) require.NotNil(t, f2) - f3, err := GetMetricsFactory(metricname, host) + f3, err := GetMetricStorageFactory(metricname, host) require.NoError(t, err) require.NotNil(t, f3) } func TestBadger(t *testing.T) { ext := makeStorageExtenion(t, &Config{ - Backends: map[string]Backend{ + TraceBackends: map[string]TraceBackend{ "foo": { Badger: &badger.Config{ Ephemeral: true, @@ -141,7 +141,7 @@ func TestBadger(t *testing.T) { func TestGRPC(t *testing.T) { ext := makeStorageExtenion(t, &Config{ - Backends: map[string]Backend{ + TraceBackends: map[string]TraceBackend{ "foo": { GRPC: &grpc.Config{ ClientConfig: configgrpc.ClientConfig{ @@ -159,7 +159,7 @@ func TestGRPC(t *testing.T) { func TestPrometheus(t *testing.T) { ext := makeStorageExtenion(t, &Config{ - MetricBackends: map[string]MetricBackends{ + MetricBackends: map[string]MetricBackend{ "foo": { Prometheus: &promCfg.Configuration{ ServerURL: "localhost:12345", @@ -175,7 +175,7 @@ func TestPrometheus(t *testing.T) { func TestStartError(t *testing.T) { ext := makeStorageExtenion(t, &Config{ - Backends: map[string]Backend{ + TraceBackends: map[string]TraceBackend{ "foo": {}, }, }) @@ -186,7 +186,7 @@ func TestStartError(t *testing.T) { func TestMetricsStorageStartError(t *testing.T) { ext := makeStorageExtenion(t, &Config{ - MetricBackends: map[string]MetricBackends{ + MetricBackends: map[string]MetricBackend{ "foo": { Prometheus: &promCfg.Configuration{}, }, @@ -196,9 +196,9 @@ func TestMetricsStorageStartError(t *testing.T) { require.ErrorContains(t, err, "failed to initialize metrics storage 'foo'") } -func testElasticsearchOrOpensearch(t *testing.T, cfg Backend) { +func testElasticsearchOrOpensearch(t *testing.T, cfg TraceBackend) { ext := makeStorageExtenion(t, &Config{ - Backends: map[string]Backend{ + TraceBackends: map[string]TraceBackend{ "foo": cfg, }, }) @@ -220,7 +220,7 @@ func TestXYZsearch(t *testing.T) { })) defer server.Close() t.Run("Elasticsearch", func(t *testing.T) { - testElasticsearchOrOpensearch(t, Backend{ + testElasticsearchOrOpensearch(t, TraceBackend{ Elasticsearch: &esCfg.Configuration{ Servers: []string{server.URL}, LogLevel: "error", @@ -228,7 +228,7 @@ func TestXYZsearch(t *testing.T) { }) }) t.Run("OpenSearch", func(t *testing.T) { - testElasticsearchOrOpensearch(t, Backend{ + testElasticsearchOrOpensearch(t, TraceBackend{ Opensearch: &esCfg.Configuration{ Servers: []string{server.URL}, LogLevel: "error", @@ -241,7 +241,7 @@ func TestCassandraError(t *testing.T) { // since we cannot successfully create storage factory for Cassandra // without running a Cassandra server, we only test the error case. ext := makeStorageExtenion(t, &Config{ - Backends: map[string]Backend{ + TraceBackends: map[string]TraceBackend{ "cassandra": { Cassandra: &cassandra.Options{}, }, @@ -280,14 +280,14 @@ func makeStorageExtenion(t *testing.T, config *Config) component.Component { func startStorageExtension(t *testing.T, memstoreName string, promstoreName string) component.Component { config := &Config{ - Backends: map[string]Backend{ + TraceBackends: map[string]TraceBackend{ memstoreName: { Memory: &memory.Configuration{ MaxTraces: 10000, }, }, }, - MetricBackends: map[string]MetricBackends{ + MetricBackends: map[string]MetricBackend{ promstoreName: { Prometheus: &promCfg.Configuration{ ServerURL: "localhost:12345", diff --git a/cmd/jaeger/internal/extension/remotesampling/extension.go b/cmd/jaeger/internal/extension/remotesampling/extension.go index be16a7b498d..43a8661f07a 100644 --- a/cmd/jaeger/internal/extension/remotesampling/extension.go +++ b/cmd/jaeger/internal/extension/remotesampling/extension.go @@ -22,6 +22,7 @@ import ( "github.com/jaegertracing/jaeger/cmd/collector/app/sampling" "github.com/jaegertracing/jaeger/cmd/collector/app/sampling/samplingstrategy" "github.com/jaegertracing/jaeger/cmd/jaeger/internal/extension/jaegerstorage" + "github.com/jaegertracing/jaeger/internal/metrics/otelmetrics" "github.com/jaegertracing/jaeger/pkg/clientcfg/clientcfghttp" "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/plugin/sampling/leaderelection" @@ -223,11 +224,13 @@ func (ext *rsExtension) startAdaptiveStrategyProvider(host component.Host) error } func (ext *rsExtension) startHTTPServer(ctx context.Context, host component.Host) error { + mf := otelmetrics.NewFactory(ext.telemetry.MeterProvider) + mf = mf.Namespace(metrics.NSOptions{Name: "jaeger_remote_sampling"}) handler := clientcfghttp.NewHTTPHandler(clientcfghttp.HTTPHandlerParams{ ConfigManager: &clientcfghttp.ConfigManager{ SamplingProvider: ext.strategyProvider, }, - MetricsFactory: metrics.NullFactory, + MetricsFactory: mf, // In v1 the sampling endpoint in the collector was at /api/sampling, because // the collector reused the same port for multiple services. In v2, the extension diff --git a/cmd/jaeger/internal/extension/remotesampling/extension_test.go b/cmd/jaeger/internal/extension/remotesampling/extension_test.go index 83910ed19c6..5b6483b60d8 100644 --- a/cmd/jaeger/internal/extension/remotesampling/extension_test.go +++ b/cmd/jaeger/internal/extension/remotesampling/extension_test.go @@ -50,7 +50,7 @@ func makeStorageExtension(t *testing.T, memstoreName string) component.Host { extension.Settings{ TelemetrySettings: telemetrySettings, }, - &jaegerstorage.Config{Backends: map[string]jaegerstorage.Backend{ + &jaegerstorage.Config{TraceBackends: map[string]jaegerstorage.TraceBackend{ memstoreName: {Memory: &memory.Configuration{MaxTraces: 10000}}, }}, ) diff --git a/cmd/jaeger/internal/processors/adaptivesampling/processor_test.go b/cmd/jaeger/internal/processors/adaptivesampling/processor_test.go index 539d7eab858..fe5198e4efb 100644 --- a/cmd/jaeger/internal/processors/adaptivesampling/processor_test.go +++ b/cmd/jaeger/internal/processors/adaptivesampling/processor_test.go @@ -42,9 +42,11 @@ func makeStorageExtension(t *testing.T, memstoreName string) component.Host { extension.Settings{ TelemetrySettings: telemetrySettings, }, - &jaegerstorage.Config{Backends: map[string]jaegerstorage.Backend{ - memstoreName: {Memory: &memory.Configuration{MaxTraces: 10000}}, - }}, + &jaegerstorage.Config{ + TraceBackends: map[string]jaegerstorage.TraceBackend{ + memstoreName: {Memory: &memory.Configuration{MaxTraces: 10000}}, + }, + }, ) require.NoError(t, err) diff --git a/cmd/query/app/apiv3/grpc_handler.go b/cmd/query/app/apiv3/grpc_handler.go index ffe597f8d06..f27f5560c89 100644 --- a/cmd/query/app/apiv3/grpc_handler.go +++ b/cmd/query/app/apiv3/grpc_handler.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" - "github.com/gogo/protobuf/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -51,8 +50,8 @@ func (h *Handler) FindTraces(request *api_v3.FindTracesRequest, stream api_v3.Qu if query == nil { return status.Error(codes.InvalidArgument, "missing query") } - if query.GetStartTimeMin() == nil || - query.GetStartTimeMax() == nil { + if query.GetStartTimeMin().IsZero() || + query.GetStartTimeMax().IsZero() { return errors.New("start time min and max are required parameters") } @@ -60,35 +59,19 @@ func (h *Handler) FindTraces(request *api_v3.FindTracesRequest, stream api_v3.Qu ServiceName: query.GetServiceName(), OperationName: query.GetOperationName(), Tags: query.GetAttributes(), - NumTraces: int(query.GetNumTraces()), + NumTraces: int(query.GetSearchDepth()), } - if query.GetStartTimeMin() != nil { - startTimeMin, err := types.TimestampFromProto(query.GetStartTimeMin()) - if err != nil { - return err - } - queryParams.StartTimeMin = startTimeMin + if ts := query.GetStartTimeMin(); !ts.IsZero() { + queryParams.StartTimeMin = ts } - if query.GetStartTimeMax() != nil { - startTimeMax, err := types.TimestampFromProto(query.GetStartTimeMax()) - if err != nil { - return err - } - queryParams.StartTimeMax = startTimeMax + if ts := query.GetStartTimeMax(); !ts.IsZero() { + queryParams.StartTimeMax = ts } - if query.GetDurationMin() != nil { - durationMin, err := types.DurationFromProto(query.GetDurationMin()) - if err != nil { - return err - } - queryParams.DurationMin = durationMin + if d := query.GetDurationMin(); d != 0 { + queryParams.DurationMin = d } - if query.GetDurationMax() != nil { - durationMax, err := types.DurationFromProto(query.GetDurationMax()) - if err != nil { - return err - } - queryParams.DurationMax = durationMax + if d := query.GetDurationMax(); d != 0 { + queryParams.DurationMax = d } traces, err := h.QueryService.FindTraces(stream.Context(), queryParams) diff --git a/cmd/query/app/apiv3/grpc_handler_test.go b/cmd/query/app/apiv3/grpc_handler_test.go index 36297505292..b14f1c01abf 100644 --- a/cmd/query/app/apiv3/grpc_handler_test.go +++ b/cmd/query/app/apiv3/grpc_handler_test.go @@ -8,8 +8,8 @@ import ( "errors" "net" "testing" + "time" - "github.com/gogo/protobuf/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -125,7 +125,9 @@ func TestGetTraceTraceIDError(t *testing.T) { }, nil).Once() getTraceStream, err := tsc.client.GetTrace(context.Background(), &api_v3.GetTraceRequest{ - TraceId: "Z", + TraceId: "Z", + StartTime: time.Now().Add(-2 * time.Hour), + EndTime: time.Now(), }) require.NoError(t, err) recv, err := getTraceStream.Recv() @@ -151,10 +153,8 @@ func TestFindTraces(t *testing.T) { ServiceName: "myservice", OperationName: "opname", Attributes: map[string]string{"foo": "bar"}, - StartTimeMin: &types.Timestamp{}, - StartTimeMax: &types.Timestamp{}, - DurationMin: &types.Duration{}, - DurationMax: &types.Duration{}, + StartTimeMin: time.Now().Add(-2 * time.Hour), + StartTimeMax: time.Now(), }, }) require.NoError(t, err) @@ -173,10 +173,7 @@ func TestFindTracesQueryNil(t *testing.T) { assert.Nil(t, recv) responseStream, err = tsc.client.FindTraces(context.Background(), &api_v3.FindTracesRequest{ - Query: &api_v3.TraceQueryParameters{ - StartTimeMin: nil, - StartTimeMax: nil, - }, + Query: &api_v3.TraceQueryParameters{}, }) require.NoError(t, err) recv, err = responseStream.Recv() @@ -191,10 +188,8 @@ func TestFindTracesStorageError(t *testing.T) { responseStream, err := tsc.client.FindTraces(context.Background(), &api_v3.FindTracesRequest{ Query: &api_v3.TraceQueryParameters{ - StartTimeMin: &types.Timestamp{}, - StartTimeMax: &types.Timestamp{}, - DurationMin: &types.Duration{}, - DurationMax: &types.Duration{}, + StartTimeMin: time.Now().Add(-2 * time.Hour), + StartTimeMax: time.Now(), }, }) require.NoError(t, err) diff --git a/cmd/query/app/flags.go b/cmd/query/app/flags.go index df40f502ff2..2e4d128742b 100644 --- a/cmd/query/app/flags.go +++ b/cmd/query/app/flags.go @@ -136,7 +136,7 @@ func (qOpts *QueryOptions) InitFromViper(v *viper.Viper, logger *zap.Logger) (*Q } // BuildQueryServiceOptions creates a QueryServiceOptions struct with appropriate adjusters and archive config -func (qOpts *QueryOptions) BuildQueryServiceOptions(storageFactory storage.Factory, logger *zap.Logger) *querysvc.QueryServiceOptions { +func (qOpts *QueryOptions) BuildQueryServiceOptions(storageFactory storage.BaseFactory, logger *zap.Logger) *querysvc.QueryServiceOptions { opts := &querysvc.QueryServiceOptions{} if !opts.InitArchiveStorage(storageFactory, logger) { logger.Info("Archive storage not initialized") diff --git a/cmd/query/app/internal/api_v3/query_service.pb.go b/cmd/query/app/internal/api_v3/query_service.pb.go index 9d1a17340e5..2f071becc4c 100644 --- a/cmd/query/app/internal/api_v3/query_service.pb.go +++ b/cmd/query/app/internal/api_v3/query_service.pb.go @@ -8,12 +8,15 @@ import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - types "github.com/gogo/protobuf/types" + _ "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" math "math" + math_bits "math/bits" time "time" ) @@ -49,16 +52,25 @@ func (*GetTraceRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{0} } func (m *GetTraceRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetTraceRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetTraceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetTraceRequest.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_GetTraceRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *GetTraceRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetTraceRequest.Merge(m, src) } func (m *GetTraceRequest) XXX_Size() int { - return xxx_messageInfo_GetTraceRequest.Size(m) + return m.Size() } func (m *GetTraceRequest) XXX_DiscardUnknown() { xxx_messageInfo_GetTraceRequest.DiscardUnknown(m) @@ -106,15 +118,18 @@ type TraceQueryParameters struct { // At least one span in a trace must match all specified attributes. Attributes map[string]string `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // Span min start time in. REST API uses RFC-3339ns format. Required. - StartTimeMin *types.Timestamp `protobuf:"bytes,4,opt,name=start_time_min,json=startTimeMin,proto3" json:"start_time_min,omitempty"` + StartTimeMin time.Time `protobuf:"bytes,4,opt,name=start_time_min,json=startTimeMin,proto3,stdtime" json:"start_time_min"` // Span max start time. REST API uses RFC-3339ns format. Required. - StartTimeMax *types.Timestamp `protobuf:"bytes,5,opt,name=start_time_max,json=startTimeMax,proto3" json:"start_time_max,omitempty"` + StartTimeMax time.Time `protobuf:"bytes,5,opt,name=start_time_max,json=startTimeMax,proto3,stdtime" json:"start_time_max"` // Span min duration. REST API uses Golang's time format e.g. 10s. - DurationMin *types.Duration `protobuf:"bytes,6,opt,name=duration_min,json=durationMin,proto3" json:"duration_min,omitempty"` + DurationMin time.Duration `protobuf:"bytes,6,opt,name=duration_min,json=durationMin,proto3,stdduration" json:"duration_min"` // Span max duration. REST API uses Golang's time format e.g. 10s. - DurationMax *types.Duration `protobuf:"bytes,7,opt,name=duration_max,json=durationMax,proto3" json:"duration_max,omitempty"` - // Maximum number of traces in the response. - NumTraces int32 `protobuf:"varint,8,opt,name=num_traces,json=numTraces,proto3" json:"num_traces,omitempty"` + DurationMax time.Duration `protobuf:"bytes,7,opt,name=duration_max,json=durationMax,proto3,stdduration" json:"duration_max"` + // Maximum depth of search. Depending on the backend storage + // implementtaion this could be like a regular LIMIT clause in SQL, + // but not all implementations support such accuracy and for those + // the larger depth value simply means more traces returned. + SearchDepth int32 `protobuf:"varint,8,opt,name=search_depth,json=searchDepth,proto3" json:"search_depth,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -127,16 +142,25 @@ func (*TraceQueryParameters) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{1} } func (m *TraceQueryParameters) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TraceQueryParameters.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *TraceQueryParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TraceQueryParameters.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_TraceQueryParameters.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *TraceQueryParameters) XXX_Merge(src proto.Message) { xxx_messageInfo_TraceQueryParameters.Merge(m, src) } func (m *TraceQueryParameters) XXX_Size() int { - return xxx_messageInfo_TraceQueryParameters.Size(m) + return m.Size() } func (m *TraceQueryParameters) XXX_DiscardUnknown() { xxx_messageInfo_TraceQueryParameters.DiscardUnknown(m) @@ -165,37 +189,37 @@ func (m *TraceQueryParameters) GetAttributes() map[string]string { return nil } -func (m *TraceQueryParameters) GetStartTimeMin() *types.Timestamp { +func (m *TraceQueryParameters) GetStartTimeMin() time.Time { if m != nil { return m.StartTimeMin } - return nil + return time.Time{} } -func (m *TraceQueryParameters) GetStartTimeMax() *types.Timestamp { +func (m *TraceQueryParameters) GetStartTimeMax() time.Time { if m != nil { return m.StartTimeMax } - return nil + return time.Time{} } -func (m *TraceQueryParameters) GetDurationMin() *types.Duration { +func (m *TraceQueryParameters) GetDurationMin() time.Duration { if m != nil { return m.DurationMin } - return nil + return 0 } -func (m *TraceQueryParameters) GetDurationMax() *types.Duration { +func (m *TraceQueryParameters) GetDurationMax() time.Duration { if m != nil { return m.DurationMax } - return nil + return 0 } -func (m *TraceQueryParameters) GetNumTraces() int32 { +func (m *TraceQueryParameters) GetSearchDepth() int32 { if m != nil { - return m.NumTraces + return m.SearchDepth } return 0 } @@ -215,16 +239,25 @@ func (*FindTracesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{2} } func (m *FindTracesRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_FindTracesRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *FindTracesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_FindTracesRequest.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_FindTracesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *FindTracesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_FindTracesRequest.Merge(m, src) } func (m *FindTracesRequest) XXX_Size() int { - return xxx_messageInfo_FindTracesRequest.Size(m) + return m.Size() } func (m *FindTracesRequest) XXX_DiscardUnknown() { xxx_messageInfo_FindTracesRequest.DiscardUnknown(m) @@ -253,16 +286,25 @@ func (*GetServicesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{3} } func (m *GetServicesRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetServicesRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetServicesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetServicesRequest.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_GetServicesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *GetServicesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetServicesRequest.Merge(m, src) } func (m *GetServicesRequest) XXX_Size() int { - return xxx_messageInfo_GetServicesRequest.Size(m) + return m.Size() } func (m *GetServicesRequest) XXX_DiscardUnknown() { xxx_messageInfo_GetServicesRequest.DiscardUnknown(m) @@ -285,16 +327,25 @@ func (*GetServicesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{4} } func (m *GetServicesResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetServicesResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetServicesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetServicesResponse.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_GetServicesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *GetServicesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_GetServicesResponse.Merge(m, src) } func (m *GetServicesResponse) XXX_Size() int { - return xxx_messageInfo_GetServicesResponse.Size(m) + return m.Size() } func (m *GetServicesResponse) XXX_DiscardUnknown() { xxx_messageInfo_GetServicesResponse.DiscardUnknown(m) @@ -327,16 +378,25 @@ func (*GetOperationsRequest) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{5} } func (m *GetOperationsRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetOperationsRequest.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetOperationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetOperationsRequest.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_GetOperationsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *GetOperationsRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_GetOperationsRequest.Merge(m, src) } func (m *GetOperationsRequest) XXX_Size() int { - return xxx_messageInfo_GetOperationsRequest.Size(m) + return m.Size() } func (m *GetOperationsRequest) XXX_DiscardUnknown() { xxx_messageInfo_GetOperationsRequest.DiscardUnknown(m) @@ -374,16 +434,25 @@ func (*Operation) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{6} } func (m *Operation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Operation.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *Operation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Operation.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_Operation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *Operation) XXX_Merge(src proto.Message) { xxx_messageInfo_Operation.Merge(m, src) } func (m *Operation) XXX_Size() int { - return xxx_messageInfo_Operation.Size(m) + return m.Size() } func (m *Operation) XXX_DiscardUnknown() { xxx_messageInfo_Operation.DiscardUnknown(m) @@ -420,16 +489,25 @@ func (*GetOperationsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{7} } func (m *GetOperationsResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GetOperationsResponse.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GetOperationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GetOperationsResponse.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_GetOperationsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *GetOperationsResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_GetOperationsResponse.Merge(m, src) } func (m *GetOperationsResponse) XXX_Size() int { - return xxx_messageInfo_GetOperationsResponse.Size(m) + return m.Size() } func (m *GetOperationsResponse) XXX_DiscardUnknown() { xxx_messageInfo_GetOperationsResponse.DiscardUnknown(m) @@ -460,16 +538,25 @@ func (*GRPCGatewayError) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{8} } func (m *GRPCGatewayError) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GRPCGatewayError.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GRPCGatewayError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GRPCGatewayError.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_GRPCGatewayError.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *GRPCGatewayError) XXX_Merge(src proto.Message) { xxx_messageInfo_GRPCGatewayError.Merge(m, src) } func (m *GRPCGatewayError) XXX_Size() int { - return xxx_messageInfo_GRPCGatewayError.Size(m) + return m.Size() } func (m *GRPCGatewayError) XXX_DiscardUnknown() { xxx_messageInfo_GRPCGatewayError.DiscardUnknown(m) @@ -503,16 +590,25 @@ func (*GRPCGatewayError_GRPCGatewayErrorDetails) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{8, 0} } func (m *GRPCGatewayError_GRPCGatewayErrorDetails) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GRPCGatewayError_GRPCGatewayErrorDetails.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GRPCGatewayError_GRPCGatewayErrorDetails) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GRPCGatewayError_GRPCGatewayErrorDetails.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_GRPCGatewayError_GRPCGatewayErrorDetails.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *GRPCGatewayError_GRPCGatewayErrorDetails) XXX_Merge(src proto.Message) { xxx_messageInfo_GRPCGatewayError_GRPCGatewayErrorDetails.Merge(m, src) } func (m *GRPCGatewayError_GRPCGatewayErrorDetails) XXX_Size() int { - return xxx_messageInfo_GRPCGatewayError_GRPCGatewayErrorDetails.Size(m) + return m.Size() } func (m *GRPCGatewayError_GRPCGatewayErrorDetails) XXX_DiscardUnknown() { xxx_messageInfo_GRPCGatewayError_GRPCGatewayErrorDetails.DiscardUnknown(m) @@ -573,16 +669,25 @@ func (*GRPCGatewayWrapper) Descriptor() ([]byte, []int) { return fileDescriptor_5fcb6756dc1afb8d, []int{9} } func (m *GRPCGatewayWrapper) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GRPCGatewayWrapper.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GRPCGatewayWrapper) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GRPCGatewayWrapper.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_GRPCGatewayWrapper.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *GRPCGatewayWrapper) XXX_Merge(src proto.Message) { xxx_messageInfo_GRPCGatewayWrapper.Merge(m, src) } func (m *GRPCGatewayWrapper) XXX_Size() int { - return xxx_messageInfo_GRPCGatewayWrapper.Size(m) + return m.Size() } func (m *GRPCGatewayWrapper) XXX_DiscardUnknown() { xxx_messageInfo_GRPCGatewayWrapper.DiscardUnknown(m) @@ -615,59 +720,61 @@ func init() { func init() { proto.RegisterFile("query_service.proto", fileDescriptor_5fcb6756dc1afb8d) } var fileDescriptor_5fcb6756dc1afb8d = []byte{ - // 826 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x6e, 0xdc, 0x44, - 0x14, 0x8e, 0x77, 0xb3, 0xc9, 0xee, 0xd9, 0xa4, 0x2d, 0xd3, 0x45, 0x75, 0x8d, 0x48, 0x36, 0x2e, - 0x48, 0x7b, 0xe5, 0x90, 0xcd, 0x05, 0x05, 0x15, 0x51, 0x9a, 0x94, 0x15, 0x42, 0x29, 0xed, 0xa4, - 0x2a, 0x08, 0x55, 0xb2, 0x26, 0xf1, 0xc1, 0x98, 0xae, 0xc7, 0xee, 0xcc, 0x78, 0xc9, 0x3e, 0x03, - 0x37, 0x48, 0xbc, 0x09, 0x4f, 0xc1, 0x53, 0xc0, 0x23, 0xf0, 0x02, 0x5c, 0x20, 0xcf, 0x8c, 0xdd, - 0x5d, 0x2f, 0xa4, 0xc9, 0x95, 0xe7, 0x9c, 0xf9, 0xbe, 0xef, 0xfc, 0xf8, 0x9c, 0x81, 0xdb, 0xaf, - 0x0b, 0x14, 0xf3, 0x50, 0xa2, 0x98, 0x25, 0xe7, 0x18, 0xe4, 0x22, 0x53, 0x19, 0xd9, 0xfe, 0x89, - 0x61, 0x8c, 0x22, 0x60, 0x79, 0x12, 0xce, 0x0e, 0xbd, 0x51, 0x96, 0x23, 0x57, 0x38, 0xc5, 0x14, - 0x95, 0x98, 0xef, 0x6b, 0xcc, 0xbe, 0x12, 0xec, 0x1c, 0xf7, 0x67, 0x07, 0xe6, 0x60, 0x88, 0xde, - 0x20, 0xce, 0xe2, 0xcc, 0xdc, 0x97, 0x27, 0xeb, 0xdd, 0x8d, 0xb3, 0x2c, 0x9e, 0xa2, 0x21, 0x9e, - 0x15, 0x3f, 0xec, 0xab, 0x24, 0x45, 0xa9, 0x58, 0x9a, 0x5b, 0xc0, 0x4e, 0x13, 0x10, 0x15, 0x82, - 0xa9, 0x24, 0xe3, 0xe6, 0xde, 0xff, 0xdd, 0x81, 0x9b, 0x13, 0x54, 0xcf, 0xcb, 0x48, 0x14, 0x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 0x7d, 0xe4, 0x90, 0x97, 0x00, 0x6f, 0xb6, 0x85, 0x0c, 0x1b, 0xda, 0x2b, 0x8b, - 0x74, 0x4d, 0xf5, 0x17, 0xd0, 0x5f, 0xd8, 0x12, 0xb2, 0xb7, 0x9a, 0x7a, 0x63, 0xaf, 0x3c, 0xff, - 0x32, 0x88, 0x19, 0x51, 0x7f, 0x8d, 0xbc, 0x84, 0xed, 0xa5, 0xe9, 0x25, 0xf7, 0x56, 0x69, 0x2b, - 0x8b, 0xe6, 0x7d, 0x70, 0x39, 0xa8, 0x52, 0x7f, 0xb4, 0x07, 0x77, 0x92, 0xcc, 0x62, 0xcb, 0xca, - 0x12, 0x1e, 0x5b, 0xca, 0xf7, 0x1b, 0xe6, 0x7b, 0xb6, 0xa1, 0xeb, 0x3e, 0xfc, 0x37, 0x00, 0x00, - 0xff, 0xff, 0x65, 0xb5, 0x52, 0x6f, 0xdd, 0x07, 0x00, 0x00, + // 851 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdd, 0x6e, 0x1b, 0x55, + 0x10, 0xce, 0xda, 0x71, 0x62, 0x8f, 0x93, 0xb6, 0x9c, 0x1a, 0x75, 0xbb, 0x48, 0x8e, 0xbb, 0x05, + 0xc9, 0x37, 0x6c, 0x88, 0x73, 0x41, 0x41, 0x20, 0xa0, 0x49, 0x6b, 0x01, 0x4a, 0x69, 0x37, 0x55, + 0x41, 0xa8, 0xd2, 0xea, 0x24, 0x3b, 0x6c, 0x96, 0x7a, 0x7f, 0x7a, 0xce, 0x59, 0x63, 0x3f, 0x03, + 0x37, 0x5c, 0xf2, 0x1c, 0xbc, 0x00, 0xb7, 0xbd, 0xe4, 0x09, 0x00, 0xe5, 0x05, 0x78, 0x01, 0x2e, + 0xd0, 0xf9, 0xd9, 0xad, 0xbd, 0xa6, 0x51, 0xd3, 0x2b, 0x9f, 0x99, 0xf3, 0x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c1, 0x8d, 0x38, 0x33, 0x71, 0xf2, 0x95, 0x71, 0x1a, 0x99, 0xf0, 0xef, 0x37, 0xf4, 0xef, + 0xc9, 0x86, 0xd2, 0x60, 0xff, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x94, 0x54, 0x95, 0xcd, 0x15, + 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -930,3 +1037,2232 @@ var _QueryService_serviceDesc = grpc.ServiceDesc{ }, Metadata: "query_service.proto", } + +func (m *GetTraceRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetTraceRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetTraceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintQueryService(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x1a + n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintQueryService(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x12 + if len(m.TraceId) > 0 { + i -= len(m.TraceId) + copy(dAtA[i:], m.TraceId) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.TraceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TraceQueryParameters) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TraceQueryParameters) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TraceQueryParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.SearchDepth != 0 { + i = encodeVarintQueryService(dAtA, i, uint64(m.SearchDepth)) + i-- + dAtA[i] = 0x40 + } + n3, err3 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DurationMax, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMax):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintQueryService(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x3a + n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DurationMin, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMin):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintQueryService(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x32 + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTimeMax, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMax):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintQueryService(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x2a + n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTimeMin, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMin):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintQueryService(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0x22 + if len(m.Attributes) > 0 { + for k := range m.Attributes { + v := m.Attributes[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintQueryService(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintQueryService(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintQueryService(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if len(m.OperationName) > 0 { + i -= len(m.OperationName) + copy(dAtA[i:], m.OperationName) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.OperationName))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceName) > 0 { + i -= len(m.ServiceName) + copy(dAtA[i:], m.ServiceName) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.ServiceName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *FindTracesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FindTracesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FindTracesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Query != nil { + { + size, err := m.Query.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQueryService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetServicesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetServicesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetServicesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *GetServicesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetServicesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetServicesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Services) > 0 { + for iNdEx := len(m.Services) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Services[iNdEx]) + copy(dAtA[i:], m.Services[iNdEx]) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.Services[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *GetOperationsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetOperationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetOperationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SpanKind) > 0 { + i -= len(m.SpanKind) + copy(dAtA[i:], m.SpanKind) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.SpanKind))) + i-- + dAtA[i] = 0x12 + } + if len(m.Service) > 0 { + i -= len(m.Service) + copy(dAtA[i:], m.Service) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.Service))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Operation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Operation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Operation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.SpanKind) > 0 { + i -= len(m.SpanKind) + copy(dAtA[i:], m.SpanKind) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.SpanKind))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetOperationsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetOperationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GetOperationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Operations) > 0 { + for iNdEx := len(m.Operations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Operations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQueryService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *GRPCGatewayError) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GRPCGatewayError) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GRPCGatewayError) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Error != nil { + { + size, err := m.Error.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQueryService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GRPCGatewayError_GRPCGatewayErrorDetails) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GRPCGatewayError_GRPCGatewayErrorDetails) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GRPCGatewayError_GRPCGatewayErrorDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.HttpStatus) > 0 { + i -= len(m.HttpStatus) + copy(dAtA[i:], m.HttpStatus) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.HttpStatus))) + i-- + dAtA[i] = 0x22 + } + if len(m.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintQueryService(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x1a + } + if m.HttpCode != 0 { + i = encodeVarintQueryService(dAtA, i, uint64(m.HttpCode)) + i-- + dAtA[i] = 0x10 + } + if m.GrpcCode != 0 { + i = encodeVarintQueryService(dAtA, i, uint64(m.GrpcCode)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GRPCGatewayWrapper) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GRPCGatewayWrapper) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GRPCGatewayWrapper) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Result != nil { + { + size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQueryService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQueryService(dAtA []byte, offset int, v uint64) int { + offset -= sovQueryService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GetTraceRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TraceId) + if l > 0 { + n += 1 + l + sovQueryService(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime) + n += 1 + l + sovQueryService(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime) + n += 1 + l + sovQueryService(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TraceQueryParameters) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + if l > 0 { + n += 1 + l + sovQueryService(uint64(l)) + } + l = len(m.OperationName) + if l > 0 { + n += 1 + l + sovQueryService(uint64(l)) + } + if len(m.Attributes) > 0 { + for k, v := range m.Attributes { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovQueryService(uint64(len(k))) + 1 + len(v) + sovQueryService(uint64(len(v))) + n += mapEntrySize + 1 + sovQueryService(uint64(mapEntrySize)) + } + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMin) + n += 1 + l + sovQueryService(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMax) + n += 1 + l + sovQueryService(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMin) + n += 1 + l + sovQueryService(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMax) + n += 1 + l + sovQueryService(uint64(l)) + if m.SearchDepth != 0 { + n += 1 + sovQueryService(uint64(m.SearchDepth)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *FindTracesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Query != nil { + l = m.Query.Size() + n += 1 + l + sovQueryService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetServicesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetServicesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Services) > 0 { + for _, s := range m.Services { + l = len(s) + n += 1 + l + sovQueryService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetOperationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Service) + if l > 0 { + n += 1 + l + sovQueryService(uint64(l)) + } + l = len(m.SpanKind) + if l > 0 { + n += 1 + l + sovQueryService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Operation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovQueryService(uint64(l)) + } + l = len(m.SpanKind) + if l > 0 { + n += 1 + l + sovQueryService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GetOperationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Operations) > 0 { + for _, e := range m.Operations { + l = e.Size() + n += 1 + l + sovQueryService(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GRPCGatewayError) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Error != nil { + l = m.Error.Size() + n += 1 + l + sovQueryService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GRPCGatewayError_GRPCGatewayErrorDetails) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.GrpcCode != 0 { + n += 1 + sovQueryService(uint64(m.GrpcCode)) + } + if m.HttpCode != 0 { + n += 1 + sovQueryService(uint64(m.HttpCode)) + } + l = len(m.Message) + if l > 0 { + n += 1 + l + sovQueryService(uint64(l)) + } + l = len(m.HttpStatus) + if l > 0 { + n += 1 + l + sovQueryService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GRPCGatewayWrapper) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Result != nil { + l = m.Result.Size() + n += 1 + l + sovQueryService(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovQueryService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQueryService(x uint64) (n int) { + return sovQueryService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +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 ErrIntOverflowQueryService + } + 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 stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TraceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.StartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.EndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + 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 ErrIntOverflowQueryService + } + 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 ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + 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 ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + 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 Attributes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Attributes == nil { + m.Attributes = 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 ErrIntOverflowQueryService + } + 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 ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthQueryService + } + 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 ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthQueryService + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Attributes[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 ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_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 ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_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 ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_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 ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_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 SearchDepth", wireType) + } + m.SearchDepth = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SearchDepth |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + 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 ErrIntOverflowQueryService + } + 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 ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + 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 := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + 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 ErrIntOverflowQueryService + } + 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 := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + 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 ErrIntOverflowQueryService + } + 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 Services", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Services = append(m.Services, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + 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 ErrIntOverflowQueryService + } + 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 ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Service = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpanKind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpanKind = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Operation) 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 ErrIntOverflowQueryService + } + 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: Operation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Operation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SpanKind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SpanKind = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + 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 ErrIntOverflowQueryService + } + 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 Operations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Operations = append(m.Operations, &Operation{}) + if err := m.Operations[len(m.Operations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GRPCGatewayError) 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 ErrIntOverflowQueryService + } + 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: GRPCGatewayError: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GRPCGatewayError: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + 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 ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Error == nil { + m.Error = &GRPCGatewayError_GRPCGatewayErrorDetails{} + } + if err := m.Error.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GRPCGatewayError_GRPCGatewayErrorDetails) 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 ErrIntOverflowQueryService + } + 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: GRPCGatewayErrorDetails: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GRPCGatewayErrorDetails: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GrpcCode", wireType) + } + m.GrpcCode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GrpcCode |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HttpCode", wireType) + } + m.HttpCode = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HttpCode |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + 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 ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Message = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HttpStatus", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + 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 ErrInvalidLengthQueryService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HttpStatus = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GRPCGatewayWrapper) 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 ErrIntOverflowQueryService + } + 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: GRPCGatewayWrapper: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GRPCGatewayWrapper: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQueryService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQueryService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQueryService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Result == nil { + m.Result = &TracesData{} + } + if err := m.Result.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQueryService(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQueryService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQueryService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQueryService + } + 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, ErrIntOverflowQueryService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQueryService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQueryService + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQueryService + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQueryService + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQueryService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQueryService = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQueryService = fmt.Errorf("proto: unexpected end of group") +) diff --git a/cmd/query/app/internal/api_v3/traces.go b/cmd/query/app/internal/api_v3/traces.go index 04b9c2a850b..2e31d504b57 100644 --- a/cmd/query/app/internal/api_v3/traces.go +++ b/cmd/query/app/internal/api_v3/traces.go @@ -33,9 +33,18 @@ func (td *TracesData) Marshal() ([]byte, error) { } // MarshalTo implements gogocodec.CustomType. -func (*TracesData) MarshalTo([]byte /* data */) (n int, err error) { - // TODO unclear when this might be called, perhaps when type is embedded inside other structs. - panic("unimplemented") +func (td *TracesData) MarshalTo(buf []byte) (n int, err error) { + return td.MarshalToSizedBuffer(buf) +} + +// MarshalToSizedBuffer is used by Gogo. +func (td *TracesData) MarshalToSizedBuffer(buf []byte) (int, error) { + data, err := td.Marshal() + if err != nil { + return 0, err + } + n := copy(buf, data) + return n, nil } // MarshalJSONPB implements gogocodec.CustomType. diff --git a/cmd/query/app/internal/api_v3/traces_test.go b/cmd/query/app/internal/api_v3/traces_test.go index 2ad243b201d..bd6314e73bc 100644 --- a/cmd/query/app/internal/api_v3/traces_test.go +++ b/cmd/query/app/internal/api_v3/traces_test.go @@ -24,7 +24,8 @@ func TestTracesData(t *testing.T) { require.NoError(t, err) // Test MarshalTo - assert.Panics(t, func() { td.MarshalTo(nil) }) + _, err = td.MarshalTo(make([]byte, td.Size())) + require.NoError(t, err) // Test MarshalJSONPB _, err = td.MarshalJSONPB(nil) diff --git a/cmd/query/app/querysvc/query_service.go b/cmd/query/app/querysvc/query_service.go index 5e23de8f499..bd9d19402ea 100644 --- a/cmd/query/app/querysvc/query_service.go +++ b/cmd/query/app/querysvc/query_service.go @@ -145,7 +145,7 @@ func (qs QueryService) GetCapabilities() StorageCapabilities { } // InitArchiveStorage tries to initialize archive storage reader/writer if storage factory supports them. -func (opts *QueryServiceOptions) InitArchiveStorage(storageFactory storage.Factory, logger *zap.Logger) bool { +func (opts *QueryServiceOptions) InitArchiveStorage(storageFactory storage.BaseFactory, logger *zap.Logger) bool { archiveFactory, ok := storageFactory.(storage.ArchiveFactory) if !ok { logger.Info("Archive storage not supported by the factory") diff --git a/cmd/query/app/server.go b/cmd/query/app/server.go index 70dcecd86f4..1047355acfd 100644 --- a/cmd/query/app/server.go +++ b/cmd/query/app/server.go @@ -29,7 +29,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/bearertoken" "github.com/jaegertracing/jaeger/pkg/netutils" "github.com/jaegertracing/jaeger/pkg/recoveryhandler" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/proto-gen/api_v2" "github.com/jaegertracing/jaeger/proto-gen/api_v2/metrics" @@ -48,7 +48,7 @@ type Server struct { httpServer *httpServer separatePorts bool bgFinished sync.WaitGroup - telemetery.Setting + telset telemetry.Settings } // NewServer creates and initializes Server @@ -58,7 +58,7 @@ func NewServer( metricsQuerySvc querysvc.MetricsQueryService, options *QueryOptions, tm *tenancy.Manager, - telset telemetery.Setting, + telset telemetry.Settings, ) (*Server, error) { _, httpPort, err := net.SplitHostPort(options.HTTP.Endpoint) if err != nil { @@ -90,7 +90,7 @@ func NewServer( grpcServer: grpcServer, httpServer: httpServer, separatePorts: separatePorts, - Setting: telset, + telset: telset, }, nil } @@ -98,7 +98,7 @@ func registerGRPCHandlers( server *grpc.Server, querySvc *querysvc.QueryService, metricsQuerySvc querysvc.MetricsQueryService, - telset telemetery.Setting, + telset telemetry.Settings, ) { reflection.Register(server) handler := NewGRPCHandler(querySvc, metricsQuerySvc, GRPCHandlerOptions{ @@ -121,7 +121,7 @@ func createGRPCServer( ctx context.Context, options *QueryOptions, tm *tenancy.Manager, - telset telemetery.Setting, + telset telemetry.Settings, ) (*grpc.Server, error) { var grpcOpts []configgrpc.ToServerOption unaryInterceptors := []grpc.UnaryServerInterceptor{ @@ -145,9 +145,9 @@ func createGRPCServer( ctx, telset.Host, component.TelemetrySettings{ - Logger: telset.Logger, - TracerProvider: telset.TracerProvider, - LeveledMeterProvider: telset.LeveledMeterProvider, + Logger: telset.Logger, + TracerProvider: telset.TracerProvider, + MeterProvider: telset.MeterProvider, }, grpcOpts...) } @@ -164,7 +164,7 @@ func initRouter( metricsQuerySvc querysvc.MetricsQueryService, queryOpts *QueryOptions, tenancyMgr *tenancy.Manager, - telset telemetery.Setting, + telset telemetry.Settings, ) (http.Handler, io.Closer) { apiHandlerOptions := []HandlerOption{ HandlerOptions.Logger(telset.Logger), @@ -206,7 +206,7 @@ func createHTTPServer( metricsQuerySvc querysvc.MetricsQueryService, queryOpts *QueryOptions, tm *tenancy.Manager, - telset telemetery.Setting, + telset telemetry.Settings, ) (*httpServer, error) { handler, staticHandlerCloser := initRouter(querySvc, metricsQuerySvc, queryOpts, tm, telset) handler = recoveryhandler.NewRecoveryHandler(telset.Logger, true)(handler) @@ -214,9 +214,9 @@ func createHTTPServer( ctx, telset.Host, component.TelemetrySettings{ - Logger: telset.Logger, - TracerProvider: telset.TracerProvider, - LeveledMeterProvider: telset.LeveledMeterProvider, + Logger: telset.Logger, + TracerProvider: telset.TracerProvider, + MeterProvider: telset.MeterProvider, }, handler, ) @@ -228,15 +228,6 @@ func createHTTPServer( staticHandlerCloser: staticHandlerCloser, } - // TODO why doesn't OTEL helper do that already? - if queryOpts.HTTP.TLSSetting != nil { - tlsCfg, err := queryOpts.HTTP.TLSSetting.LoadTLSConfig(ctx) // This checks if the certificates are correctly provided - if err != nil { - return nil, errors.Join(err, staticHandlerCloser.Close()) - } - server.TLSConfig = tlsCfg - } - return server, nil } @@ -260,7 +251,7 @@ func (s *Server) initListener(ctx context.Context) (cmux.CMux, error) { if err != nil { return nil, err } - s.Logger.Info( + s.telset.Logger.Info( "Query server started", zap.String("http_addr", s.HTTPAddr()), zap.String("grpc_addr", s.GRPCAddr()), @@ -281,7 +272,7 @@ func (s *Server) initListener(ctx context.Context) (cmux.CMux, error) { tcpPort = port } - s.Logger.Info( + s.telset.Logger.Info( "Query server started", zap.Int("port", tcpPort), zap.String("addr", s.queryOptions.HTTP.Endpoint)) @@ -326,34 +317,29 @@ func (s *Server) Start(ctx context.Context) error { s.bgFinished.Add(1) go func() { defer s.bgFinished.Done() - s.Logger.Info("Starting HTTP server", zap.Int("port", httpPort), zap.String("addr", s.queryOptions.HTTP.Endpoint)) - var err error - if s.queryOptions.HTTP.TLSSetting != nil { - err = s.httpServer.ServeTLS(s.httpConn, "", "") - } else { - err = s.httpServer.Serve(s.httpConn) - } + s.telset.Logger.Info("Starting HTTP server", zap.Int("port", httpPort), zap.String("addr", s.queryOptions.HTTP.Endpoint)) + err := s.httpServer.Serve(s.httpConn) if err != nil && !errors.Is(err, http.ErrServerClosed) && !errors.Is(err, cmux.ErrListenerClosed) && !errors.Is(err, cmux.ErrServerClosed) { - s.Logger.Error("Could not start HTTP server", zap.Error(err)) - s.ReportStatus(componentstatus.NewFatalErrorEvent(err)) + s.telset.Logger.Error("Could not start HTTP server", zap.Error(err)) + s.telset.ReportStatus(componentstatus.NewFatalErrorEvent(err)) return } - s.Logger.Info("HTTP server stopped", zap.Int("port", httpPort), zap.String("addr", s.queryOptions.HTTP.Endpoint)) + s.telset.Logger.Info("HTTP server stopped", zap.Int("port", httpPort), zap.String("addr", s.queryOptions.HTTP.Endpoint)) }() // Start GRPC server concurrently s.bgFinished.Add(1) go func() { defer s.bgFinished.Done() - s.Logger.Info("Starting GRPC server", zap.Int("port", grpcPort), zap.String("addr", s.queryOptions.GRPC.NetAddr.Endpoint)) + s.telset.Logger.Info("Starting GRPC server", zap.Int("port", grpcPort), zap.String("addr", s.queryOptions.GRPC.NetAddr.Endpoint)) err := s.grpcServer.Serve(s.grpcConn) if err != nil && !errors.Is(err, cmux.ErrListenerClosed) && !errors.Is(err, cmux.ErrServerClosed) { - s.Logger.Error("Could not start GRPC server", zap.Error(err)) - s.ReportStatus(componentstatus.NewFatalErrorEvent(err)) + s.telset.Logger.Error("Could not start GRPC server", zap.Error(err)) + s.telset.ReportStatus(componentstatus.NewFatalErrorEvent(err)) return } - s.Logger.Info("GRPC server stopped", zap.Int("port", grpcPort), zap.String("addr", s.queryOptions.GRPC.NetAddr.Endpoint)) + s.telset.Logger.Info("GRPC server stopped", zap.Int("port", grpcPort), zap.String("addr", s.queryOptions.GRPC.NetAddr.Endpoint)) }() // Start cmux server concurrently. @@ -361,16 +347,16 @@ func (s *Server) Start(ctx context.Context) error { s.bgFinished.Add(1) go func() { defer s.bgFinished.Done() - s.Logger.Info("Starting CMUX server", zap.Int("port", tcpPort), zap.String("addr", s.queryOptions.HTTP.Endpoint)) + s.telset.Logger.Info("Starting CMUX server", zap.Int("port", tcpPort), zap.String("addr", s.queryOptions.HTTP.Endpoint)) err := cmuxServer.Serve() // TODO: find a way to avoid string comparison. Even though cmux has ErrServerClosed, it's not returned here. if err != nil && !strings.Contains(err.Error(), "use of closed network connection") { - s.Logger.Error("Could not start multiplexed server", zap.Error(err)) - s.ReportStatus(componentstatus.NewFatalErrorEvent(err)) + s.telset.Logger.Error("Could not start multiplexed server", zap.Error(err)) + s.telset.ReportStatus(componentstatus.NewFatalErrorEvent(err)) return } - s.Logger.Info("CMUX server stopped", zap.Int("port", tcpPort), zap.String("addr", s.queryOptions.HTTP.Endpoint)) + s.telset.Logger.Info("CMUX server stopped", zap.Int("port", tcpPort), zap.String("addr", s.queryOptions.HTTP.Endpoint)) }() } return nil @@ -388,20 +374,20 @@ func (s *Server) GRPCAddr() string { func (s *Server) Close() error { var errs []error - s.Logger.Info("Closing HTTP server") + s.telset.Logger.Info("Closing HTTP server") if err := s.httpServer.Close(); err != nil { errs = append(errs, fmt.Errorf("failed to close HTTP server: %w", err)) } - s.Logger.Info("Stopping gRPC server") + s.telset.Logger.Info("Stopping gRPC server") s.grpcServer.Stop() if !s.separatePorts { - s.Logger.Info("Closing CMux server") + s.telset.Logger.Info("Closing CMux server") s.cmuxServer.Close() } s.bgFinished.Wait() - s.Logger.Info("Server stopped") + s.telset.Logger.Info("Server stopped") return errors.Join(errs...) } diff --git a/cmd/query/app/server_test.go b/cmd/query/app/server_test.go index f26cd78b5fa..51db8aeb239 100644 --- a/cmd/query/app/server_test.go +++ b/cmd/query/app/server_test.go @@ -6,7 +6,6 @@ package app import ( "bytes" "context" - "crypto/tls" "fmt" "net" "net/http" @@ -17,14 +16,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/config/confignet" - "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/config/configtls" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" "go.uber.org/zap" @@ -40,7 +35,7 @@ import ( "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/pkg/healthcheck" "github.com/jaegertracing/jaeger/pkg/jtracer" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/ports" "github.com/jaegertracing/jaeger/proto-gen/api_v2" @@ -51,16 +46,12 @@ import ( var testCertKeyLocation = "../../../pkg/config/tlscfg/testdata" -func initTelSet(logger *zap.Logger, tracerProvider *jtracer.JTracer, hc *healthcheck.HealthCheck) telemetery.Setting { - return telemetery.Setting{ - Logger: logger, - TracerProvider: tracerProvider.OTEL, - ReportStatus: telemetery.HCAdapter(hc), - Host: componenttest.NewNopHost(), - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() - }, - } +func initTelSet(logger *zap.Logger, tracerProvider *jtracer.JTracer, hc *healthcheck.HealthCheck) telemetry.Settings { + telset := telemetry.NoopSettings() + telset.Logger = logger + telset.TracerProvider = tracerProvider.OTEL + telset.ReportStatus = telemetry.HCAdapter(hc) + return telset } func TestServerError(t *testing.T) { @@ -109,7 +100,7 @@ func TestCreateTLSGrpcServerError(t *testing.T) { require.Error(t, err) } -func TestCreateTLSHttpServerError(t *testing.T) { +func TestStartTLSHttpServerError(t *testing.T) { tlsCfg := configtls.ServerConfig{ ClientCAFile: "invalid/path", Config: configtls.Config{ @@ -118,12 +109,16 @@ func TestCreateTLSHttpServerError(t *testing.T) { }, } telset := initTelSet(zaptest.NewLogger(t), jtracer.NoOp(), healthcheck.New()) - _, err := NewServer(context.Background(), &querysvc.QueryService{}, nil, + s, err := NewServer(context.Background(), &querysvc.QueryService{}, nil, &QueryOptions{ HTTP: confighttp.ServerConfig{Endpoint: ":8080", TLSSetting: &tlsCfg}, GRPC: configgrpc.ServerConfig{NetAddr: confignet.AddrConfig{Endpoint: ":8081", Transport: confignet.TransportTypeTCP}}, }, tenancy.NewManager(&tenancy.Options{}), telset) - require.Error(t, err) + require.NoError(t, err) + require.Error(t, s.Start(context.Background())) + t.Cleanup(func() { + require.NoError(t, s.Close()) + }) } var testCases = []struct { @@ -132,7 +127,6 @@ var testCases = []struct { HTTPTLSEnabled bool GRPCTLSEnabled bool clientTLS configtls.ClientConfig - expectError bool expectClientError bool expectServerFail bool }{ @@ -144,7 +138,6 @@ var testCases = []struct { clientTLS: configtls.ClientConfig{ Insecure: true, }, - expectError: false, expectClientError: false, expectServerFail: false, }, @@ -162,7 +155,6 @@ var testCases = []struct { Insecure: true, ServerName: "example.com", }, - expectError: true, expectClientError: true, expectServerFail: false, }, @@ -183,7 +175,6 @@ var testCases = []struct { CAFile: testCertKeyLocation + "/example-CA-cert.pem", }, }, - expectError: true, expectClientError: true, expectServerFail: false, }, @@ -204,7 +195,6 @@ var testCases = []struct { CAFile: testCertKeyLocation + "/example-CA-cert.pem", }, }, - expectError: false, expectClientError: false, expectServerFail: false, }, @@ -226,7 +216,6 @@ var testCases = []struct { CAFile: testCertKeyLocation + "/example-CA-cert.pem", }, }, - expectError: false, expectServerFail: false, expectClientError: true, }, @@ -250,7 +239,6 @@ var testCases = []struct { KeyFile: testCertKeyLocation + "/example-client-key.pem", }, }, - expectError: false, expectServerFail: false, expectClientError: false, }, @@ -275,7 +263,6 @@ var testCases = []struct { KeyFile: testCertKeyLocation + "/example-client-key.pem", }, }, - expectError: false, expectServerFail: false, expectClientError: true, }, @@ -299,7 +286,6 @@ var testCases = []struct { KeyFile: testCertKeyLocation + "/example-client-key.pem", }, }, - expectError: false, expectServerFail: false, expectClientError: false, }, @@ -323,7 +309,6 @@ var testCases = []struct { KeyFile: testCertKeyLocation + "/example-client-key.pem", }, }, - expectError: false, expectServerFail: false, expectClientError: false, }, @@ -360,7 +345,6 @@ func TestServerHTTPTLS(t *testing.T) { HTTPTLSEnabled bool GRPCTLSEnabled bool clientTLS configtls.ClientConfig - expectError bool expectClientError bool expectServerFail bool }, testlen) @@ -413,41 +397,9 @@ func TestServerHTTPTLS(t *testing.T) { require.NoError(t, server.Close()) }) - var clientError error - var clientClose func() error - var clientTLSCfg *tls.Config - - if serverOptions.HTTP.TLSSetting != nil { - var err0 error - clientTLSCfg, err0 = test.clientTLS.LoadTLSConfig(context.Background()) - - require.NoError(t, err0) - dialer := &net.Dialer{Timeout: 2 * time.Second} - conn, err1 := tls.DialWithDialer(dialer, "tcp", server.HTTPAddr(), clientTLSCfg) - clientError = err1 - clientClose = nil - if conn != nil { - clientClose = conn.Close - } - } else { - conn, err1 := net.DialTimeout("tcp", server.HTTPAddr(), 2*time.Second) - clientError = err1 - clientClose = nil - if conn != nil { - clientClose = conn.Close - } - } - - if test.expectError { - require.Error(t, clientError) - } else { - require.NoError(t, clientError) - } - if clientClose != nil { - require.NoError(t, clientClose()) - } - - if test.HTTPTLSEnabled && test.TLS.ClientCAFile != "" { + if test.HTTPTLSEnabled { + clientTLSCfg, err := test.clientTLS.LoadTLSConfig(context.Background()) + require.NoError(t, err) client := &http.Client{ Transport: &http.Transport{ TLSClientConfig: clientTLSCfg, @@ -459,15 +411,18 @@ func TestServerHTTPTLS(t *testing.T) { require.NoError(t, err) req.Header.Add("Accept", "application/json") - resp, err2 := client.Do(req) - if err2 == nil { - resp.Body.Close() - } + resp, err := client.Do(req) + t.Cleanup(func() { + if err == nil { + resp.Body.Close() + } + }) if test.expectClientError { - require.Error(t, err2) + require.Error(t, err) } else { - require.NoError(t, err2) + require.NoError(t, err) + require.Equal(t, http.StatusOK, resp.StatusCode) } } }) @@ -500,7 +455,6 @@ func TestServerGRPCTLS(t *testing.T) { HTTPTLSEnabled bool GRPCTLSEnabled bool clientTLS configtls.ClientConfig - expectError bool expectClientError bool expectServerFail bool }, testlen) @@ -800,12 +754,12 @@ func TestServerHTTPTenancy(t *testing.T) { { name: "no tenant", // no value for tenant header - status: 401, + status: http.StatusUnauthorized, }, { name: "tenant", tenant: "acme", - status: 200, + status: http.StatusOK, }, } diff --git a/cmd/query/app/token_propagation_test.go b/cmd/query/app/token_propagation_test.go index d7b7c537707..5ce7ae4ac14 100644 --- a/cmd/query/app/token_propagation_test.go +++ b/cmd/query/app/token_propagation_test.go @@ -17,18 +17,13 @@ import ( "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/config/confignet" - "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap/zaptest" "github.com/jaegertracing/jaeger/cmd/internal/flags" "github.com/jaegertracing/jaeger/cmd/query/app/querysvc" "github.com/jaegertracing/jaeger/pkg/bearertoken" "github.com/jaegertracing/jaeger/pkg/config" - "github.com/jaegertracing/jaeger/pkg/jtracer" - "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin/storage/es" "github.com/jaegertracing/jaeger/ports" @@ -72,6 +67,10 @@ func runQueryService(t *testing.T, esURL string) *Server { flagsSvc := flags.NewService(ports.QueryAdminHTTP) flagsSvc.Logger = zaptest.NewLogger(t) + telset := telemetry.NoopSettings() + telset.Logger = flagsSvc.Logger + telset.ReportStatus = telemetry.HCAdapter(flagsSvc.HC()) + f := es.NewFactory() v, command := config.Viperize(f.AddFlags) require.NoError(t, command.ParseFlags([]string{ @@ -82,22 +81,14 @@ func runQueryService(t *testing.T, esURL string) *Server { f.InitFromViper(v, flagsSvc.Logger) // set AllowTokenFromContext manually because we don't register the respective CLI flag from query svc f.Options.Primary.Authentication.BearerTokenAuthentication.AllowFromContext = true - require.NoError(t, f.Initialize(metrics.NullFactory, flagsSvc.Logger)) + require.NoError(t, f.Initialize(telset.Metrics, telset.Logger)) defer f.Close() spanReader, err := f.CreateSpanReader() require.NoError(t, err) traceReader := factoryadapter.NewTraceReader(spanReader) - querySvc := querysvc.NewQueryService(traceReader, nil, querysvc.QueryServiceOptions{}) - telset := telemetery.Setting{ - Logger: flagsSvc.Logger, - TracerProvider: jtracer.NoOp().OTEL, - ReportStatus: telemetery.HCAdapter(flagsSvc.HC()), - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() - }, - } + querySvc := querysvc.NewQueryService(spanReader, nil, querysvc.QueryServiceOptions{}) server, err := NewServer(context.Background(), querySvc, nil, &QueryOptions{ BearerTokenPropagation: true, diff --git a/cmd/query/main.go b/cmd/query/main.go index 9029ce7b575..82b571500ec 100644 --- a/cmd/query/main.go +++ b/cmd/query/main.go @@ -12,9 +12,6 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" _ "go.uber.org/automaxprocs" "go.uber.org/zap" @@ -29,14 +26,15 @@ import ( "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/jtracer" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/pkg/version" metricsPlugin "github.com/jaegertracing/jaeger/plugin/metrics" "github.com/jaegertracing/jaeger/plugin/storage" "github.com/jaegertracing/jaeger/ports" - metricsstoreMetrics "github.com/jaegertracing/jaeger/storage/metricsstore/metrics" "github.com/jaegertracing/jaeger/storage_v2/factoryadapter" + "github.com/jaegertracing/jaeger/storage/metricsstore/metricstoremetrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) func main() { @@ -82,17 +80,24 @@ func main() { } } + baseTelset := telemetry.Settings{ + Logger: logger, + Metrics: baseFactory, + TracerProvider: jt.OTEL, + ReportStatus: telemetry.HCAdapter(svc.HC()), + } + // TODO: Need to figure out set enable/disable propagation on storage plugins. v.Set(bearertoken.StoragePropagationKey, queryOpts.BearerTokenPropagation) storageFactory.InitFromViper(v, logger) - if err := storageFactory.Initialize(baseFactory, logger); err != nil { + if err := storageFactory.Initialize(baseTelset.Metrics, baseTelset.Logger); err != nil { logger.Fatal("Failed to init storage factory", zap.Error(err)) } traceReader, err := v2Factory.CreateTraceReader() if err != nil { logger.Fatal("Failed to create trace reader", zap.Error(err)) } - // TODO: decorate trace reader with metrics + spanReader = spanstoremetrics.NewReaderDecorator(spanReader, metricsFactory) dependencyReader, err := storageFactory.CreateDependencyReader() if err != nil { logger.Fatal("Failed to create dependency reader", zap.Error(err)) @@ -108,15 +113,16 @@ func main() { dependencyReader, *queryServiceOptions) tm := tenancy.NewManager(&queryOpts.Tenancy) - telset := telemetery.Setting{ - Logger: logger, - TracerProvider: jt.OTEL, - ReportStatus: telemetery.HCAdapter(svc.HC()), - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() - }, - } - server, err := app.NewServer(context.Background(), queryService, metricsQueryService, queryOpts, tm, telset) + telset := baseTelset // copy + telset.Metrics = metricsFactory + server, err := app.NewServer( + context.Background(), + queryService, + metricsQueryService, + queryOpts, + tm, + telset, + ) if err != nil { logger.Fatal("Failed to create server", zap.Error(err)) } @@ -179,5 +185,5 @@ func createMetricsQueryService( } // Decorate the metrics reader with metrics instrumentation. - return metricsstoreMetrics.NewReadMetricsDecorator(reader, metricsReaderMetricsFactory), nil + return metricstoremetrics.NewReaderDecorator(reader, metricsReaderMetricsFactory), nil } diff --git a/cmd/remote-storage/app/server.go b/cmd/remote-storage/app/server.go index 51f88a16699..546d5c0b16c 100644 --- a/cmd/remote-storage/app/server.go +++ b/cmd/remote-storage/app/server.go @@ -17,7 +17,7 @@ import ( "github.com/jaegertracing/jaeger/cmd/query/app/querysvc" "github.com/jaegertracing/jaeger/pkg/bearertoken" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" "github.com/jaegertracing/jaeger/storage" @@ -32,11 +32,11 @@ type Server struct { grpcConn net.Listener grpcServer *grpc.Server wg sync.WaitGroup - telemetery.Setting + telset telemetry.Settings } // NewServer creates and initializes Server. -func NewServer(options *Options, storageFactory storage.Factory, tm *tenancy.Manager, telset telemetery.Setting) (*Server, error) { +func NewServer(options *Options, storageFactory storage.BaseFactory, tm *tenancy.Manager, telset telemetry.Settings) (*Server, error) { handler, err := createGRPCHandler(storageFactory, telset.Logger) if err != nil { return nil, err @@ -50,11 +50,11 @@ func NewServer(options *Options, storageFactory storage.Factory, tm *tenancy.Man return &Server{ opts: options, grpcServer: grpcServer, - Setting: telset, + telset: telset, }, nil } -func createGRPCHandler(f storage.Factory, logger *zap.Logger) (*shared.GRPCHandler, error) { +func createGRPCHandler(f storage.BaseFactory, logger *zap.Logger) (*shared.GRPCHandler, error) { reader, err := f.CreateSpanReader() if err != nil { return nil, err @@ -128,14 +128,14 @@ func (s *Server) Start() error { if err != nil { return err } - s.Logger.Info("Starting GRPC server", zap.Stringer("addr", listener.Addr())) + s.telset.Logger.Info("Starting GRPC server", zap.Stringer("addr", listener.Addr())) s.grpcConn = listener s.wg.Add(1) go func() { defer s.wg.Done() if err := s.grpcServer.Serve(s.grpcConn); err != nil { - s.Logger.Error("GRPC server exited", zap.Error(err)) - s.ReportStatus(componentstatus.NewFatalErrorEvent(err)) + s.telset.Logger.Error("GRPC server exited", zap.Error(err)) + s.telset.ReportStatus(componentstatus.NewFatalErrorEvent(err)) } }() @@ -148,6 +148,6 @@ func (s *Server) Close() error { s.grpcConn.Close() s.opts.TLSGRPC.Close() s.wg.Wait() - s.ReportStatus(componentstatus.NewEvent(componentstatus.StatusStopped)) + s.telset.ReportStatus(componentstatus.NewEvent(componentstatus.StatusStopped)) return nil } diff --git a/cmd/remote-storage/app/server_test.go b/cmd/remote-storage/app/server_test.go index f2ca612b486..c9a78d31896 100644 --- a/cmd/remote-storage/app/server_test.go +++ b/cmd/remote-storage/app/server_test.go @@ -12,10 +12,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/component/componentstatus" - "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap" "go.uber.org/zap/zaptest/observer" "google.golang.org/grpc" @@ -26,7 +22,7 @@ import ( "github.com/jaegertracing/jaeger/internal/grpctest" "github.com/jaegertracing/jaeger/pkg/config/tlscfg" "github.com/jaegertracing/jaeger/pkg/healthcheck" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/ports" "github.com/jaegertracing/jaeger/proto-gen/storage_v1" @@ -45,19 +41,12 @@ func TestNewServer_CreateStorageErrors(t *testing.T) { factory.On("CreateSpanWriter").Return(nil, nil) factory.On("CreateDependencyReader").Return(nil, errors.New("no deps")).Once() factory.On("CreateDependencyReader").Return(nil, nil) - telset := telemetery.Setting{ - Logger: zap.NewNop(), - ReportStatus: func(*componentstatus.Event) {}, - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() - }, - } f := func() (*Server, error) { return NewServer( &Options{GRPCHostPort: ":0"}, factory, tenancy.NewManager(&tenancy.Options{}), - telset, + telemetry.NoopSettings(), ) } _, err := f() @@ -119,9 +108,9 @@ func TestNewServer_TLSConfigError(t *testing.T) { KeyPath: "invalid/path", ClientCAPath: "invalid/path", } - telset := telemetery.Setting{ + telset := telemetry.Settings{ Logger: zap.NewNop(), - ReportStatus: telemetery.HCAdapter(healthcheck.New()), + ReportStatus: telemetry.HCAdapter(healthcheck.New()), } storageMocks := newStorageMocks() _, err := NewServer( @@ -327,9 +316,9 @@ func TestServerGRPCTLS(t *testing.T) { storageMocks.reader.On("GetServices", mock.AnythingOfType("*context.valueCtx")).Return(expectedServices, nil) tm := tenancy.NewManager(&tenancy.Options{Enabled: true}) - telset := telemetery.Setting{ + telset := telemetry.Settings{ Logger: flagsSvc.Logger, - ReportStatus: telemetery.HCAdapter(flagsSvc.HC()), + ReportStatus: telemetry.HCAdapter(flagsSvc.HC()), } server, err := NewServer( serverOptions, @@ -376,9 +365,9 @@ func TestServerHandlesPortZero(t *testing.T) { zapCore, logs := observer.New(zap.InfoLevel) flagsSvc.Logger = zap.New(zapCore) storageMocks := newStorageMocks() - telset := telemetery.Setting{ + telset := telemetry.Settings{ Logger: flagsSvc.Logger, - ReportStatus: telemetery.HCAdapter(flagsSvc.HC()), + ReportStatus: telemetry.HCAdapter(flagsSvc.HC()), } server, err := NewServer( &Options{GRPCHostPort: ":0"}, diff --git a/cmd/remote-storage/main.go b/cmd/remote-storage/main.go index 3e141246cd8..8f1ed50e9a7 100644 --- a/cmd/remote-storage/main.go +++ b/cmd/remote-storage/main.go @@ -10,8 +10,6 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/noop" _ "go.uber.org/automaxprocs" "go.uber.org/zap" @@ -24,7 +22,7 @@ import ( "github.com/jaegertracing/jaeger/cmd/remote-storage/app" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/pkg/version" "github.com/jaegertracing/jaeger/plugin/storage" @@ -64,19 +62,21 @@ func main() { logger.Fatal("Failed to parse options", zap.Error(err)) } + baseTelset := telemetry.Settings{ + Logger: svc.Logger, + Metrics: baseFactory, + ReportStatus: telemetry.HCAdapter(svc.HC()), + MeterProvider: noop.NewMeterProvider(), // TODO + } + storageFactory.InitFromViper(v, logger) - if err := storageFactory.Initialize(baseFactory, logger); err != nil { + if err := storageFactory.Initialize(baseTelset.Metrics, baseTelset.Logger); err != nil { logger.Fatal("Failed to init storage factory", zap.Error(err)) } tm := tenancy.NewManager(&opts.Tenancy) - telset := telemetery.Setting{ - Logger: svc.Logger, - ReportStatus: telemetery.HCAdapter(svc.HC()), - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() - }, - } + telset := baseTelset // copy + telset.Metrics = metricsFactory server, err := app.NewServer(opts, storageFactory, tm, telset) if err != nil { logger.Fatal("Failed to create server", zap.Error(err)) diff --git a/crossdock/main.go b/crossdock/main.go index f4833886a42..1ca1ca428f1 100644 --- a/crossdock/main.go +++ b/crossdock/main.go @@ -52,7 +52,7 @@ func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { // when method is HEAD, report back with a 200 when ready to run tests - if r.Method == "HEAD" { + if r.Method == http.MethodHead { if !handler.isInitialized() { http.Error(w, "Components not ready", http.StatusServiceUnavailable) } @@ -92,13 +92,15 @@ func (h *clientHandler) isInitialized() bool { } func is2xxStatusCode(statusCode int) bool { - return statusCode >= 200 && statusCode <= 299 + return statusCode >= http.StatusOK && statusCode < http.StatusMultipleChoices } func httpHealthCheck(logger *zap.Logger, service, healthURL string) { for i := 0; i < 240; i++ { res, err := http.Get(healthURL) - res.Body.Close() + if err == nil { + res.Body.Close() + } if err == nil && is2xxStatusCode(res.StatusCode) { logger.Info("Health check successful", zap.String("service", service)) return diff --git a/docker-compose/monitor/README.md b/docker-compose/monitor/README.md index 1d555de4880..b020dda7fd9 100644 --- a/docker-compose/monitor/README.md +++ b/docker-compose/monitor/README.md @@ -98,7 +98,7 @@ JAEGER_IMAGE_TAG=1.62.0 docker compose up or for Jaeger v2: ```shell -JAEGER_IMAGE_TAG=2.0.0-rc2 docker compose -f docker-compose-v2.yml up +JAEGER_IMAGE_TAG=2.0.0 docker compose -f docker-compose-v2.yml up ``` ## Development diff --git a/docker-compose/monitor/docker-compose-v2.yml b/docker-compose/monitor/docker-compose-v2.yml index 8e5a248c509..53a8f761489 100644 --- a/docker-compose/monitor/docker-compose-v2.yml +++ b/docker-compose/monitor/docker-compose-v2.yml @@ -7,11 +7,14 @@ services: image: jaegertracing/jaeger:${JAEGER_IMAGE_TAG:-latest} volumes: - "./jaeger-ui.json:/etc/jaeger/jaeger-ui.json" # Do we need this for v2 ? Seems to be running without this. - - "./jaeger-v2-config.yml:/etc/jaeger/config.yml" + - "../../cmd/jaeger/config-spm.yaml:/etc/jaeger/config.yml" command: ["--config", "/etc/jaeger/config.yml"] ports: - "16686:16686" + - "8888:8888" - "8889:8889" + - "4317:4317" + - "4318:4318" microsim: networks: @@ -26,7 +29,7 @@ services: prometheus: networks: - backend - image: prom/prometheus:latest + image: prom/prometheus:v3.0.1 volumes: - "./prometheus.yml:/etc/prometheus/prometheus.yml" ports: diff --git a/examples/hotrod/docker-compose-v2.yml b/examples/hotrod/docker-compose-v2.yml index a4a82fac049..3e39faad702 100644 --- a/examples/hotrod/docker-compose-v2.yml +++ b/examples/hotrod/docker-compose-v2.yml @@ -4,9 +4,6 @@ services: jaeger: image: ${REGISTRY:-}jaegertracing/jaeger:${JAEGER_VERSION:-latest} - command: - - --set=receivers.otlp.protocols.grpc.endpoint="0.0.0.0:4317" - - --set=receivers.otlp.protocols.http.endpoint="0.0.0.0:4318" ports: - "16686:16686" - "4317:4317" diff --git a/examples/hotrod/pkg/tracing/http.go b/examples/hotrod/pkg/tracing/http.go index 0e938ba60b8..a37d7e70df2 100644 --- a/examples/hotrod/pkg/tracing/http.go +++ b/examples/hotrod/pkg/tracing/http.go @@ -48,7 +48,7 @@ func (c *HTTPClient) GetJSON(ctx context.Context, _ string /* endpoint */, url s defer res.Body.Close() - if res.StatusCode >= 400 { + if res.StatusCode >= http.StatusBadRequest { body, err := io.ReadAll(res.Body) if err != nil { return err diff --git a/examples/hotrod/pkg/tracing/rpcmetrics/metrics.go b/examples/hotrod/pkg/tracing/rpcmetrics/metrics.go index 48556e92170..5daa89f21de 100644 --- a/examples/hotrod/pkg/tracing/rpcmetrics/metrics.go +++ b/examples/hotrod/pkg/tracing/rpcmetrics/metrics.go @@ -5,6 +5,7 @@ package rpcmetrics import ( + "net/http" "sync" "github.com/jaegertracing/jaeger/pkg/metrics" @@ -45,13 +46,13 @@ type Metrics struct { func (m *Metrics) recordHTTPStatusCode(statusCode int64) { switch { - case statusCode >= 200 && statusCode < 300: + case statusCode >= http.StatusOK && statusCode < http.StatusMultipleChoices: m.HTTPStatusCode2xx.Inc(1) - case statusCode >= 300 && statusCode < 400: + case statusCode >= http.StatusMultipleChoices && statusCode < http.StatusBadRequest: m.HTTPStatusCode3xx.Inc(1) - case statusCode >= 400 && statusCode < 500: + case statusCode >= http.StatusBadRequest && statusCode < http.StatusInternalServerError: m.HTTPStatusCode4xx.Inc(1) - case statusCode >= 500 && statusCode < 600: + case statusCode >= http.StatusInternalServerError && statusCode < 600: m.HTTPStatusCode5xx.Inc(1) } } diff --git a/go.mod b/go.mod index 795f27a87da..89411d81081 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 github.com/bsm/sarama-cluster v2.1.13+incompatible github.com/crossdock/crossdock-go v0.0.0-20160816171116-049aabb0122b - github.com/dgraph-io/badger/v4 v4.4.0 + github.com/dgraph-io/badger/v4 v4.5.0 github.com/elastic/go-elasticsearch/v8 v8.16.0 github.com/fsnotify/fsnotify v1.8.0 github.com/go-logr/zapr v1.3.0 @@ -41,7 +41,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 github.com/uber/jaeger-client-go v2.30.0+incompatible github.com/xdg-go/scram v1.1.2 go.opentelemetry.io/collector/component v0.114.0 @@ -144,7 +144,6 @@ require ( github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.3 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/flatbuffers v24.3.25+incompatible // indirect github.com/google/uuid v1.6.0 // indirect diff --git a/go.sum b/go.sum index 43c7988e6fc..044a56635c1 100644 --- a/go.sum +++ b/go.sum @@ -84,8 +84,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dennwc/varint v1.0.0 h1:kGNFFSSw8ToIy3obO/kKr8U9GZYUAxQEVuix4zfDWzE= github.com/dennwc/varint v1.0.0/go.mod h1:hnItb35rvZvJrbTALZtY/iQfDs48JKRG1RPpgziApxA= -github.com/dgraph-io/badger/v4 v4.4.0 h1:rA48XiDynZLyMdlaJl67p9+lqfqwxlgKtCpYLAio7Zk= -github.com/dgraph-io/badger/v4 v4.4.0/go.mod h1:sONMmPPfbnj9FPwS/etCqky/ULth6CQJuAZSuWCmixE= +github.com/dgraph-io/badger/v4 v4.5.0 h1:TeJE3I1pIWLBjYhIYCA1+uxrjWEoJXImFBMEBVSm16g= +github.com/dgraph-io/badger/v4 v4.5.0/go.mod h1:ysgYmIeG8dS/E8kwxT7xHyc7MkmwNYLRoYnFbr7387A= github.com/dgraph-io/ristretto/v2 v2.0.0 h1:l0yiSOtlJvc0otkqyMaDNysg8E9/F/TYZwMbxscNOAQ= github.com/dgraph-io/ristretto/v2 v2.0.0/go.mod h1:FVFokF2dRqXyPyeMnK1YDy8Fc6aTe0IKgbcd03CYeEk= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= @@ -555,8 +555,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= diff --git a/idl b/idl index 7728794957b..de97430b579 160000 --- a/idl +++ b/idl @@ -1 +1 @@ -Subproject commit 7728794957b99056be3a28e6e525e79bf8b353bd +Subproject commit de97430b579cac669422048a0becc5db981b05ad diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 445c6d9d1e2..86312fbfe39 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -3,9 +3,9 @@ module github.com/jaegertracing/jaeger/internal/tools go 1.23.0 require ( - github.com/golangci/golangci-lint v1.62.0 + github.com/golangci/golangci-lint v1.62.2 github.com/josephspurrier/goversioninfo v1.4.1 - github.com/vektra/mockery/v2 v2.47.0 + github.com/vektra/mockery/v2 v2.49.1 mvdan.cc/gofumpt v0.7.0 ) @@ -16,9 +16,9 @@ require ( github.com/Abirdcfly/dupword v0.1.3 // indirect github.com/Antonboom/errname v1.0.0 // indirect github.com/Antonboom/nilnil v1.0.0 // indirect - github.com/Antonboom/testifylint v1.5.0 // indirect + github.com/Antonboom/testifylint v1.5.2 // indirect github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect - github.com/Crocmagnon/fatcontext v0.5.2 // indirect + github.com/Crocmagnon/fatcontext v0.5.3 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect github.com/Masterminds/semver/v3 v3.3.0 // indirect @@ -113,18 +113,18 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mgechev/revive v1.5.0 // indirect + github.com/mgechev/revive v1.5.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.3.2 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.18.0 // indirect + github.com/nunnatsa/ginkgolinter v0.18.3 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/polyfloyd/go-errorlint v1.6.0 // indirect + github.com/polyfloyd/go-errorlint v1.7.0 // indirect github.com/prometheus/client_golang v1.12.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect @@ -160,7 +160,7 @@ require ( github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect github.com/stretchr/objx v0.5.2 // indirect - github.com/stretchr/testify v1.9.0 // indirect + github.com/stretchr/testify v1.10.0 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/tdakkota/asciicheck v0.2.0 // indirect github.com/tetafro/godot v1.4.18 // indirect @@ -171,7 +171,7 @@ require ( github.com/ultraware/funlen v0.1.0 // indirect github.com/ultraware/whitespace v0.1.1 // indirect github.com/uudashr/gocognit v1.1.3 // indirect - github.com/uudashr/iface v1.2.0 // indirect + github.com/uudashr/iface v1.2.1 // indirect github.com/xen0n/gosmopolitan v1.2.2 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.3.0 // indirect @@ -184,7 +184,7 @@ require ( go.uber.org/multierr v1.8.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0 // indirect + golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect golang.org/x/mod v0.22.0 // indirect golang.org/x/sync v0.9.0 // indirect golang.org/x/sys v0.27.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 6f5ab7f671a..8f74b21b0f1 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -43,14 +43,14 @@ github.com/Antonboom/errname v1.0.0 h1:oJOOWR07vS1kRusl6YRSlat7HFnb3mSfMl6sDMRoT github.com/Antonboom/errname v1.0.0/go.mod h1:gMOBFzK/vrTiXN9Oh+HFs+e6Ndl0eTFbtsRTSRdXyGI= github.com/Antonboom/nilnil v1.0.0 h1:n+v+B12dsE5tbAqRODXmEKfZv9j2KcTBrp+LkoM4HZk= github.com/Antonboom/nilnil v1.0.0/go.mod h1:fDJ1FSFoLN6yoG65ANb1WihItf6qt9PJVTn/s2IrcII= -github.com/Antonboom/testifylint v1.5.0 h1:dlUIsDMtCrZWUnvkaCz3quJCoIjaGi41GzjPBGkkJ8A= -github.com/Antonboom/testifylint v1.5.0/go.mod h1:wqaJbu0Blb5Wag2wv7Z5xt+CIV+eVLxtGZrlK13z3AE= +github.com/Antonboom/testifylint v1.5.2 h1:4s3Xhuv5AvdIgbd8wOOEeo0uZG7PbDKQyKY5lGoQazk= +github.com/Antonboom/testifylint v1.5.2/go.mod h1:vxy8VJ0bc6NavlYqjZfmp6EfqXMtBgQ4+mhCojwC1P8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/Crocmagnon/fatcontext v0.5.2 h1:vhSEg8Gqng8awhPju2w7MKHqMlg4/NI+gSDHtR3xgwA= -github.com/Crocmagnon/fatcontext v0.5.2/go.mod h1:87XhRMaInHP44Q7Tlc7jkgKKB7kZAOPiDkFMdKCC+74= +github.com/Crocmagnon/fatcontext v0.5.3 h1:zCh/wjc9oyeF+Gmp+V60wetm8ph2tlsxocgg/J0hOps= +github.com/Crocmagnon/fatcontext v0.5.3/go.mod h1:XoCQYY1J+XTfyv74qLXvNw4xFunr3L1wkopIIKG7wGM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU= @@ -236,8 +236,8 @@ github.com/golangci/go-printf-func-name v0.1.0 h1:dVokQP+NMTO7jwO4bwsRwLWeudOVUP github.com/golangci/go-printf-func-name v0.1.0/go.mod h1:wqhWFH5mUdJQhweRnldEywnR5021wTdZSNgwYceV14s= github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9 h1:/1322Qns6BtQxUZDTAT4SdcoxknUki7IAoK4SAXr8ME= github.com/golangci/gofmt v0.0.0-20240816233607-d8596aa466a9/go.mod h1:Oesb/0uFAyWoaw1U1qS5zyjCg5NP9C9iwjnI4tIsXEE= -github.com/golangci/golangci-lint v1.62.0 h1:/G0g+bi1BhmGJqLdNQkKBWjcim8HjOPc4tsKuHDOhcI= -github.com/golangci/golangci-lint v1.62.0/go.mod h1:jtoOhQcKTz8B6dGNFyfQV3WZkQk+YvBDewDtNpiAJts= +github.com/golangci/golangci-lint v1.62.2 h1:b8K5K9PN+rZN1+mKLtsZHz2XXS9aYKzQ9i25x3Qnxxw= +github.com/golangci/golangci-lint v1.62.2/go.mod h1:ILWWyeFUrctpHVGMa1dg2xZPKoMUTc5OIMgW7HZr34g= github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= github.com/golangci/modinfo v0.3.4 h1:oU5huX3fbxqQXdfspamej74DFX0kyGLkw1ppvXoJ8GA= @@ -385,8 +385,8 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgechev/revive v1.5.0 h1:oaSmjA7rP8+HyoRuCgC531VHwnLH1AlJdjj+1AnQceQ= -github.com/mgechev/revive v1.5.0/go.mod h1:L6T3H8EoerRO86c7WuGpvohIUmiploGiyoYbtIWFmV8= +github.com/mgechev/revive v1.5.1 h1:hE+QPeq0/wIzJwOphdVyUJ82njdd8Khp4fUIHGZHW3M= +github.com/mgechev/revive v1.5.1/go.mod h1:lC9AhkJIBs5zwx8wkudyHrU+IJkrEKmpCmGMnIJPk4o= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -406,8 +406,8 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.18.0 h1:ZXO1wKhPg3A6LpbN5dMuqwhfOjN5c3ous8YdKOuqk9k= -github.com/nunnatsa/ginkgolinter v0.18.0/go.mod h1:vPrWafSULmjMGCMsfGA908if95VnHQNAahvSBOjTuWs= +github.com/nunnatsa/ginkgolinter v0.18.3 h1:WgS7X3zzmni3vwHSBhvSgqrRgUecN6PQUcfB0j1noDw= +github.com/nunnatsa/ginkgolinter v0.18.3/go.mod h1:BE1xyB/PNtXXG1azrvrqJW5eFH0hSRylNzFy8QHPwzs= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= @@ -429,8 +429,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.6.0 h1:tftWV9DE7txiFzPpztTAwyoRLKNj9gpVm2cg8/OwcYY= -github.com/polyfloyd/go-errorlint v1.6.0/go.mod h1:HR7u8wuP1kb1NeN1zqTd1ZMlqUKPPHF+Id4vIPvDqVw= +github.com/polyfloyd/go-errorlint v1.7.0 h1:Zp6lzCK4hpBDj8y8a237YK4EPrMXQWvOe3nGoH4pFrU= +github.com/polyfloyd/go-errorlint v1.7.0/go.mod h1:dGWKu85mGHnegQ2SWpEybFityCg3j7ZbwsVUxAOk9gY= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -539,8 +539,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/tdakkota/asciicheck v0.2.0 h1:o8jvnUANo0qXtnslk2d3nMKTFNlOnJjRrNcj0j9qkHM= @@ -565,10 +565,10 @@ github.com/ultraware/whitespace v0.1.1 h1:bTPOGejYFulW3PkcrqkeQwOd6NKOOXvmGD9bo/ github.com/ultraware/whitespace v0.1.1/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= github.com/uudashr/gocognit v1.1.3 h1:l+a111VcDbKfynh+airAy/DJQKaXh2m9vkoysMPSZyM= github.com/uudashr/gocognit v1.1.3/go.mod h1:aKH8/e8xbTRBwjbCkwZ8qt4l2EpKXl31KMHgSS+lZ2U= -github.com/uudashr/iface v1.2.0 h1:ECJjh5q/1Zmnv/2yFpWV6H3oMg5+Mo+vL0aqw9Gjazo= -github.com/uudashr/iface v1.2.0/go.mod h1:Ux/7d/rAF3owK4m53cTVXL4YoVHKNqnoOeQHn2xrlp0= -github.com/vektra/mockery/v2 v2.47.0 h1:/OgQNNsUxwKCC8rt6cRXxvfj7/f9mYrCbX4m/tcZpFQ= -github.com/vektra/mockery/v2 v2.47.0/go.mod h1:xO2DeYemEPC2tCzIZ+a1tifZ/7Laf/Chxg3vlc+oDsI= +github.com/uudashr/iface v1.2.1 h1:vHHyzAUmWZ64Olq6NZT3vg/z1Ws56kyPdBOd5kTXDF8= +github.com/uudashr/iface v1.2.1/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg= +github.com/vektra/mockery/v2 v2.49.1 h1:P33NkpxL5QNsteqdtOAEOJ94kKXaqdsTHeD6GtVuNUc= +github.com/vektra/mockery/v2 v2.49.1/go.mod h1:xO2DeYemEPC2tCzIZ+a1tifZ/7Laf/Chxg3vlc+oDsI= github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= @@ -630,8 +630,8 @@ golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWB golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0 h1:bVwtbF629Xlyxk6xLQq2TDYmqP0uiWaet5LwRebuY0k= -golang.org/x/exp/typeparams v0.0.0-20240909161429-701f63a606c0/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f h1:WTyX8eCCyfdqiPYkRGm0MqElSfYFH3yR1+rl/mct9sA= +golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= diff --git a/model/adjuster/sort_tags_and_log_fields_test.go b/model/adjuster/sort_tags_and_log_fields_test.go index 4d31c7248b6..afd1983cac0 100644 --- a/model/adjuster/sort_tags_and_log_fields_test.go +++ b/model/adjuster/sort_tags_and_log_fields_test.go @@ -5,6 +5,7 @@ package adjuster import ( + "net/http" "testing" "github.com/stretchr/testify/assert" @@ -88,7 +89,7 @@ func TestSortTagsAndLogFieldsDoesSortFields(t *testing.T) { func TestSortTagsAndLogFieldsDoesSortTags(t *testing.T) { testCases := []model.KeyValues{ { - model.String("http.method", "GET"), + model.String("http.method", http.MethodGet), model.String("http.url", "http://wikipedia.org"), model.Int64("http.status_code", 200), model.String("guid:x-request-id", "f61defd2-7a77-11ef-b54f-4fbb67a6d181"), diff --git a/pkg/bearertoken/transport_test.go b/pkg/bearertoken/transport_test.go index b578934cb38..e03ca8dd8a0 100644 --- a/pkg/bearertoken/transport_test.go +++ b/pkg/bearertoken/transport_test.go @@ -78,7 +78,7 @@ func TestRoundTripper(t *testing.T) { t.Run(tc.name, func(t *testing.T) { server := httptest.NewServer(nil) defer server.Close() - req, err := http.NewRequestWithContext(tc.requestContext, "GET", server.URL, nil) + req, err := http.NewRequestWithContext(tc.requestContext, http.MethodGet, server.URL, nil) require.NoError(t, err) tr := RoundTripper{ diff --git a/pkg/cassandra/metrics/table.go b/pkg/cassandra/metrics/table.go index 8b6132f690d..c31787d0b28 100644 --- a/pkg/cassandra/metrics/table.go +++ b/pkg/cassandra/metrics/table.go @@ -12,17 +12,17 @@ import ( "github.com/jaegertracing/jaeger/pkg/cassandra" "github.com/jaegertracing/jaeger/pkg/metrics" - storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) // Table is a collection of metrics about Cassandra write operations. type Table struct { - storageMetrics.WriteMetrics + spanstoremetrics.WriteMetrics } // NewTable takes a metrics scope and creates a table metrics struct func NewTable(factory metrics.Factory, tableName string) *Table { - t := storageMetrics.WriteMetrics{} + t := spanstoremetrics.WriteMetrics{} metrics.Init(&t, factory.Namespace(metrics.NSOptions{Name: "", Tags: map[string]string{"table": tableName}}), nil) return &Table{t} } diff --git a/pkg/clientcfg/clientcfghttp/handler_test.go b/pkg/clientcfg/clientcfghttp/handler_test.go index 296468b458d..fa16f52d71c 100644 --- a/pkg/clientcfg/clientcfghttp/handler_test.go +++ b/pkg/clientcfg/clientcfghttp/handler_test.go @@ -283,14 +283,14 @@ func TestHTTPHandlerErrors(t *testing.T) { withServer("", probabilistic(0.001), restrictions("luggage", 10), withGorilla, func(ts *testServer) { handler := ts.handler - req := httptest.NewRequest("GET", "http://localhost:80/?service=X", nil) + req := httptest.NewRequest(http.MethodGet, "http://localhost:80/?service=X", nil) w := &mockWriter{header: make(http.Header)} handler.serveSamplingHTTP(w, req, handler.encodeThriftLegacy) ts.metricsFactory.AssertCounterMetrics(t, metricstest.ExpectedMetric{Name: "http-server.errors", Tags: map[string]string{"source": "write", "status": "5xx"}, Value: 1}) - req = httptest.NewRequest("GET", "http://localhost:80/baggageRestrictions?service=X", nil) + req = httptest.NewRequest(http.MethodGet, "http://localhost:80/baggageRestrictions?service=X", nil) handler.serveBaggageHTTP(w, req) ts.metricsFactory.AssertCounterMetrics(t, diff --git a/pkg/es/config/config.go b/pkg/es/config/config.go index f5104a4691b..d0ae9c6ad3d 100644 --- a/pkg/es/config/config.go +++ b/pkg/es/config/config.go @@ -30,7 +30,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/es" eswrapper "github.com/jaegertracing/jaeger/pkg/es/wrapper" "github.com/jaegertracing/jaeger/pkg/metrics" - storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) const ( @@ -217,7 +217,7 @@ func NewClient(c *Configuration, logger *zap.Logger, metricsFactory metrics.Fact return nil, err } - sm := storageMetrics.NewWriteMetrics(metricsFactory, "bulk_index") + sm := spanstoremetrics.NewWriter(metricsFactory, "bulk_index") m := sync.Map{} bulkProc, err := rawClient.BulkProcessor(). diff --git a/pkg/es/wrapper/wrapper.go b/pkg/es/wrapper/wrapper.go index cdca19fd768..e34b8c49590 100644 --- a/pkg/es/wrapper/wrapper.go +++ b/pkg/es/wrapper/wrapper.go @@ -7,6 +7,7 @@ package eswrapper import ( "context" "fmt" + "net/http" "strings" esV8 "github.com/elastic/go-elasticsearch/v8" @@ -193,7 +194,7 @@ func (c TemplateCreatorWrapperV8) Do(context.Context) (*elastic.IndicesPutTempla if err != nil { return nil, fmt.Errorf("error creating index template %s: %w", c.templateName, err) } - if resp.StatusCode != 200 { + if resp.StatusCode != http.StatusOK { return nil, fmt.Errorf("error creating index template %s: %s", c.templateName, resp) } return nil, nil // no response expected by span writer diff --git a/pkg/kafka/auth/config.go b/pkg/kafka/auth/config.go index 955a347777c..734389bc505 100644 --- a/pkg/kafka/auth/config.go +++ b/pkg/kafka/auth/config.go @@ -9,6 +9,7 @@ import ( "github.com/Shopify/sarama" "github.com/spf13/viper" + "go.opentelemetry.io/collector/config/configtls" "go.uber.org/zap" "github.com/jaegertracing/jaeger/pkg/config/tlscfg" @@ -30,10 +31,10 @@ var authTypes = []string{ // AuthenticationConfig describes the configuration properties needed authenticate with kafka cluster type AuthenticationConfig struct { - Authentication string `mapstructure:"type"` - Kerberos KerberosConfig `mapstructure:"kerberos"` - TLS tlscfg.Options `mapstructure:"tls"` - PlainText PlainTextConfig `mapstructure:"plaintext"` + Authentication string + Kerberos KerberosConfig + TLS configtls.ClientConfig + PlainText PlainTextConfig } // SetConfiguration set configure authentication into sarama config structure @@ -42,9 +43,8 @@ func (config *AuthenticationConfig) SetConfiguration(saramaConfig *sarama.Config if strings.Trim(authentication, " ") == "" { authentication = none } - if config.Authentication == tls || config.TLS.Enabled { - err := setTLSConfiguration(&config.TLS, saramaConfig, logger) - if err != nil { + if config.Authentication == tls { + if err := setTLSConfiguration(&config.TLS, saramaConfig, logger); err != nil { return err } } @@ -79,15 +79,14 @@ func (config *AuthenticationConfig) InitFromViper(configPrefix string, v *viper. Prefix: configPrefix, } - var err error - config.TLS, err = tlsClientConfig.InitFromViper(v) + tlsOpts, err := tlsClientConfig.InitFromViper(v) if err != nil { return fmt.Errorf("failed to process Kafka TLS options: %w", err) } if config.Authentication == tls { - config.TLS.Enabled = true + tlsOpts.Enabled = true + config.TLS = tlsOpts.ToOtelClientConfig() } - config.PlainText.Username = v.GetString(configPrefix + plainTextPrefix + suffixPlainTextUsername) config.PlainText.Password = v.GetString(configPrefix + plainTextPrefix + suffixPlainTextPassword) config.PlainText.Mechanism = v.GetString(configPrefix + plainTextPrefix + suffixPlainTextMechanism) diff --git a/pkg/kafka/auth/config_test.go b/pkg/kafka/auth/config_test.go index a32b0077c02..f5354c67d2f 100644 --- a/pkg/kafka/auth/config_test.go +++ b/pkg/kafka/auth/config_test.go @@ -11,11 +11,11 @@ import ( "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/config/configtls" "go.uber.org/zap" "go.uber.org/zap/zaptest" "github.com/jaegertracing/jaeger/pkg/config" - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" ) func addFlags(flags *flag.FlagSet) { @@ -64,9 +64,7 @@ func Test_InitFromViper(t *testing.T) { KeyTabPath: "/path/to/keytab", DisablePAFXFast: true, }, - TLS: tlscfg.Options{ - Enabled: true, - }, + TLS: configtls.ClientConfig{}, PlainText: PlainTextConfig{ Username: "user", Password: "password", @@ -139,7 +137,7 @@ func TestSetConfiguration(t *testing.T) { { name: "TLS authentication with invalid cipher suite", authType: "tls", - expectedError: "error loading tls config: failed to get cipher suite ids from cipher suite names: cipher suite fail not supported or doesn't exist", + expectedError: "error loading tls config: failed to load TLS config: invalid TLS cipher suite: \"fail\"", }, } @@ -149,7 +147,6 @@ func TestSetConfiguration(t *testing.T) { "--kafka.auth.authentication=" + tt.authType, }) authConfig := &AuthenticationConfig{} - defer authConfig.TLS.Close() err := authConfig.InitFromViper(configPrefix, v) require.NoError(t, err) diff --git a/pkg/kafka/auth/tls.go b/pkg/kafka/auth/tls.go index db905b7fc21..2e6bb45515f 100644 --- a/pkg/kafka/auth/tls.go +++ b/pkg/kafka/auth/tls.go @@ -4,17 +4,17 @@ package auth import ( + "context" "fmt" "github.com/Shopify/sarama" + "go.opentelemetry.io/collector/config/configtls" "go.uber.org/zap" - - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" ) -func setTLSConfiguration(config *tlscfg.Options, saramaConfig *sarama.Config, logger *zap.Logger) error { - if config.Enabled { - tlsConfig, err := config.Config(logger) +func setTLSConfiguration(config *configtls.ClientConfig, saramaConfig *sarama.Config, _ *zap.Logger) error { + if !config.Insecure { + tlsConfig, err := config.LoadTLSConfig(context.Background()) if err != nil { return fmt.Errorf("error loading tls config: %w", err) } diff --git a/pkg/kafka/auth/tls_test.go b/pkg/kafka/auth/tls_test.go index d8dadf6cd64..b817b0b82dd 100644 --- a/pkg/kafka/auth/tls_test.go +++ b/pkg/kafka/auth/tls_test.go @@ -9,20 +9,16 @@ import ( "github.com/Shopify/sarama" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/config/configtls" "go.uber.org/zap/zaptest" - - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" ) func TestSetTLSConfiguration(t *testing.T) { logger := zaptest.NewLogger(t) saramaConfig := sarama.NewConfig() - tlsConfig := &tlscfg.Options{ - Enabled: true, - } + tlsConfig := &configtls.ClientConfig{} err := setTLSConfiguration(tlsConfig, saramaConfig, logger) require.NoError(t, err) assert.True(t, saramaConfig.Net.TLS.Enable) assert.NotNil(t, saramaConfig.Net.TLS.Config) - defer tlsConfig.Close() } diff --git a/pkg/prometheus/config/config.go b/pkg/prometheus/config/config.go index c16989253bd..0c8c21baf07 100644 --- a/pkg/prometheus/config/config.go +++ b/pkg/prometheus/config/config.go @@ -7,15 +7,14 @@ import ( "time" "github.com/asaskevich/govalidator" - - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" + "go.opentelemetry.io/collector/config/configtls" ) // Configuration describes the options to customize the storage behavior. type Configuration struct { ServerURL string `valid:"required" mapstructure:"endpoint"` ConnectTimeout time.Duration `mapstructure:"connect_timeout"` - TLS tlscfg.Options + TLS configtls.ClientConfig TokenFilePath string `mapstructure:"token_file_path"` TokenOverrideFromContext bool `mapstructure:"token_override_from_context"` diff --git a/pkg/telemetery/settings.go b/pkg/telemetery/settings.go deleted file mode 100644 index 4d2d9654d08..00000000000 --- a/pkg/telemetery/settings.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2024 The Jaeger Authors. -// SPDX-License-Identifier: Apache-2.0 - -package telemetery - -import ( - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componentstatus" - "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/trace" - "go.uber.org/zap" - - "github.com/jaegertracing/jaeger/pkg/healthcheck" - "github.com/jaegertracing/jaeger/pkg/metrics" -) - -type Setting struct { - Logger *zap.Logger - Metrics metrics.Factory - LeveledMeterProvider func(configtelemetry.Level) metric.MeterProvider - TracerProvider trace.TracerProvider - ReportStatus func(*componentstatus.Event) - Host component.Host -} - -func HCAdapter(hc *healthcheck.HealthCheck) func(*componentstatus.Event) { - return func(event *componentstatus.Event) { - var hcStatus healthcheck.Status - switch event.Status() { - case componentstatus.StatusOK: - hcStatus = healthcheck.Ready - case componentstatus.StatusStarting, - componentstatus.StatusRecoverableError, - componentstatus.StatusPermanentError, - componentstatus.StatusNone, - componentstatus.StatusStopping, - componentstatus.StatusStopped: - hcStatus = healthcheck.Unavailable - case componentstatus.StatusFatalError: - hcStatus = healthcheck.Broken - } - hc.Set(hcStatus) - } -} diff --git a/pkg/telemetry/settings.go b/pkg/telemetry/settings.go new file mode 100644 index 00000000000..1f76b38e107 --- /dev/null +++ b/pkg/telemetry/settings.go @@ -0,0 +1,72 @@ +// Copyright (c) 2024 The Jaeger Authors. +// SPDX-License-Identifier: Apache-2.0 + +package telemetry + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/otel/metric" + noopmetric "go.opentelemetry.io/otel/metric/noop" + "go.opentelemetry.io/otel/trace" + nooptrace "go.opentelemetry.io/otel/trace/noop" + "go.uber.org/zap" + + "github.com/jaegertracing/jaeger/internal/metrics/otelmetrics" + "github.com/jaegertracing/jaeger/pkg/healthcheck" + "github.com/jaegertracing/jaeger/pkg/metrics" +) + +type Settings struct { + Logger *zap.Logger + Metrics metrics.Factory + MeterProvider metric.MeterProvider + TracerProvider trace.TracerProvider + ReportStatus func(*componentstatus.Event) // TODO remove this + Host component.Host +} + +func HCAdapter(hc *healthcheck.HealthCheck) func(*componentstatus.Event) { + return func(event *componentstatus.Event) { + var hcStatus healthcheck.Status + switch event.Status() { + case componentstatus.StatusOK: + hcStatus = healthcheck.Ready + case componentstatus.StatusStarting, + componentstatus.StatusRecoverableError, + componentstatus.StatusPermanentError, + componentstatus.StatusNone, + componentstatus.StatusStopping, + componentstatus.StatusStopped: + hcStatus = healthcheck.Unavailable + case componentstatus.StatusFatalError: + hcStatus = healthcheck.Broken + } + hc.Set(hcStatus) + } +} + +func NoopSettings() Settings { + return Settings{ + Logger: zap.NewNop(), + Metrics: metrics.NullFactory, + MeterProvider: noopmetric.NewMeterProvider(), + TracerProvider: nooptrace.NewTracerProvider(), + ReportStatus: func(*componentstatus.Event) {}, + Host: componenttest.NewNopHost(), + } +} + +func FromOtelComponent(telset component.TelemetrySettings, host component.Host) Settings { + return Settings{ + Logger: telset.Logger, + Metrics: otelmetrics.NewFactory(telset.MeterProvider), + MeterProvider: telset.MeterProvider, + TracerProvider: telset.TracerProvider, + ReportStatus: func(event *componentstatus.Event) { + componentstatus.ReportStatus(host, event) + }, + Host: host, + } +} diff --git a/pkg/telemetery/settings_test.go b/pkg/telemetry/settings_test.go similarity index 56% rename from pkg/telemetery/settings_test.go rename to pkg/telemetry/settings_test.go index 8124397e491..718717772d6 100644 --- a/pkg/telemetery/settings_test.go +++ b/pkg/telemetry/settings_test.go @@ -1,16 +1,22 @@ // Copyright (c) 2024 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package telemetery_test +package telemetry_test import ( + "errors" "testing" "github.com/stretchr/testify/assert" + "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componentstatus" + "go.opentelemetry.io/collector/component/componenttest" + noopmetric "go.opentelemetry.io/otel/metric/noop" + nooptrace "go.opentelemetry.io/otel/trace/noop" + "go.uber.org/zap" "github.com/jaegertracing/jaeger/pkg/healthcheck" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/testutils" ) @@ -65,7 +71,7 @@ func TestHCAdapter(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { hc := healthcheck.New() - hcAdapter := telemetery.HCAdapter(hc) + hcAdapter := telemetry.HCAdapter(hc) event := componentstatus.NewEvent(tt.status) hcAdapter(event) assert.Equal(t, tt.expectedHC, hc.Get()) @@ -73,6 +79,33 @@ func TestHCAdapter(t *testing.T) { } } +func TestNoopSettingss(t *testing.T) { + telset := telemetry.NoopSettings() + assert.NotNil(t, telset.Logger) + assert.NotNil(t, telset.Metrics) + assert.NotNil(t, telset.MeterProvider) + assert.NotNil(t, telset.TracerProvider) + assert.NotNil(t, telset.ReportStatus) + assert.NotNil(t, telset.Host) + telset.ReportStatus(componentstatus.NewFatalErrorEvent(errors.New("foobar"))) +} + +func TestFromOtelComponent(t *testing.T) { + otelTelset := component.TelemetrySettings{ + Logger: zap.NewNop(), + MeterProvider: noopmetric.NewMeterProvider(), + TracerProvider: nooptrace.NewTracerProvider(), + } + host := componenttest.NewNopHost() + telset := telemetry.FromOtelComponent(otelTelset, host) + assert.Equal(t, otelTelset.Logger, telset.Logger) + assert.Equal(t, otelTelset.MeterProvider, telset.MeterProvider) + assert.Equal(t, otelTelset.TracerProvider, telset.TracerProvider) + assert.Equal(t, host, telset.Host) + assert.NotNil(t, telset.ReportStatus) + telset.ReportStatus(componentstatus.NewFatalErrorEvent(errors.New("foobar"))) +} + func TestMain(m *testing.M) { testutils.VerifyGoLeaks(m) } diff --git a/pkg/version/handler.go b/pkg/version/handler.go index bb094af94a9..a92cd11ff3b 100644 --- a/pkg/version/handler.go +++ b/pkg/version/handler.go @@ -18,7 +18,7 @@ func RegisterHandler(mu *http.ServeMux, logger *zap.Logger) { logger.Fatal("Could not get Jaeger version", zap.Error(err)) } mu.HandleFunc("/version", func(w http.ResponseWriter, _ *http.Request) { - w.WriteHeader(200) + w.WriteHeader(http.StatusOK) w.Write(jsonData) }) } diff --git a/plugin/metrics/prometheus/metricsstore/reader.go b/plugin/metrics/prometheus/metricsstore/reader.go index df9fddd6f23..a44ce33d51a 100644 --- a/plugin/metrics/prometheus/metricsstore/reader.go +++ b/plugin/metrics/prometheus/metricsstore/reader.go @@ -5,7 +5,6 @@ package metricsstore import ( "context" - "crypto/tls" "fmt" "net" "net/http" @@ -315,12 +314,10 @@ func logErrorToSpan(span trace.Span, err error) { span.SetStatus(codes.Error, err.Error()) } -func getHTTPRoundTripper(c *config.Configuration, logger *zap.Logger) (rt http.RoundTripper, err error) { - var ctlsConfig *tls.Config - if c.TLS.Enabled { - if ctlsConfig, err = c.TLS.Config(logger); err != nil { - return nil, err - } +func getHTTPRoundTripper(c *config.Configuration, _ *zap.Logger) (rt http.RoundTripper, err error) { + ctlsConfig, err := c.TLS.LoadTLSConfig(context.Background()) + if err != nil { + return nil, err } // KeepAlive and TLSHandshake timeouts are kept to existing Prometheus client's // DefaultRoundTripper to simplify user configuration and may be made configurable when required. diff --git a/plugin/metrics/prometheus/metricsstore/reader_test.go b/plugin/metrics/prometheus/metricsstore/reader_test.go index 4aa9ba1ca21..207070b44c6 100644 --- a/plugin/metrics/prometheus/metricsstore/reader_test.go +++ b/plugin/metrics/prometheus/metricsstore/reader_test.go @@ -18,6 +18,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/config/configtls" "go.opentelemetry.io/otel/codes" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" @@ -25,7 +26,6 @@ import ( "go.uber.org/zap" "github.com/jaegertracing/jaeger/pkg/bearertoken" - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" "github.com/jaegertracing/jaeger/pkg/prometheus/config" "github.com/jaegertracing/jaeger/pkg/testutils" "github.com/jaegertracing/jaeger/proto-gen/api_v2/metrics" @@ -739,13 +739,10 @@ func TestGetRoundTripperTLSConfig(t *testing.T) { t.Run(tc.name, func(t *testing.T) { logger := zap.NewNop() config := &config.Configuration{ - ConnectTimeout: 9 * time.Millisecond, - TLS: tlscfg.Options{ - Enabled: tc.tlsEnabled, - }, + ConnectTimeout: 9 * time.Millisecond, + TLS: configtls.ClientConfig{}, TokenOverrideFromContext: true, } - defer config.TLS.Close() rt, err := getHTTPRoundTripper(config, logger) require.NoError(t, err) @@ -856,9 +853,10 @@ func TestInvalidCertFile(t *testing.T) { reader, err := NewMetricsReader(config.Configuration{ ServerURL: "https://localhost:1234", ConnectTimeout: defaultTimeout, - TLS: tlscfg.Options{ - Enabled: true, - CAPath: "foo", + TLS: configtls.ClientConfig{ + Config: configtls.Config{ + CAFile: "foo", + }, }, }, logger, tracer) require.Error(t, err) diff --git a/plugin/metrics/prometheus/options.go b/plugin/metrics/prometheus/options.go index ad259a0b196..7f400b4842f 100644 --- a/plugin/metrics/prometheus/options.go +++ b/plugin/metrics/prometheus/options.go @@ -44,6 +44,8 @@ type Options struct { config.Configuration `mapstructure:",squash"` } +var tlsFlagsCfg = tlscfg.ClientFlagsConfig{Prefix: prefix} + func DefaultConfig() config.Configuration { return config.Configuration{ ServerURL: defaultServerURL, @@ -64,7 +66,7 @@ func NewOptions() *Options { } // AddFlags from this storage to the CLI. -func (opt *Options) AddFlags(flagSet *flag.FlagSet) { +func (*Options) AddFlags(flagSet *flag.FlagSet) { flagSet.String(prefix+suffixServerURL, defaultServerURL, "The Prometheus server's URL, must include the protocol scheme e.g. http://localhost:9090") flagSet.Duration(prefix+suffixConnectTimeout, defaultConnectTimeout, @@ -92,7 +94,7 @@ func (opt *Options) AddFlags(flagSet *flag.FlagSet) { `For example: `+ `"duration_bucket" (not normalized) -> "duration_milliseconds_bucket (normalized)"`) - opt.getTLSFlagsConfig().AddFlags(flagSet) + tlsFlagsCfg.AddFlags(flagSet) } // InitFromViper initializes the options struct with values from Viper. @@ -113,19 +115,14 @@ func (opt *Options) InitFromViper(v *viper.Viper) error { } var err error - opt.TLS, err = opt.getTLSFlagsConfig().InitFromViper(v) + tlsOpts, err := tlsFlagsCfg.InitFromViper(v) if err != nil { return fmt.Errorf("failed to process Prometheus TLS options: %w", err) } + opt.TLS = tlsOpts.ToOtelClientConfig() return nil } -func (*Options) getTLSFlagsConfig() tlscfg.ClientFlagsConfig { - return tlscfg.ClientFlagsConfig{ - Prefix: prefix, - } -} - // stripWhiteSpace removes all whitespace characters from a string. func stripWhiteSpace(str string) string { return strings.ReplaceAll(str, " ", "") diff --git a/plugin/sampling/strategyprovider/adaptive/aggregator_test.go b/plugin/sampling/strategyprovider/adaptive/aggregator_test.go index eec8ab76892..a2145f80c35 100644 --- a/plugin/sampling/strategyprovider/adaptive/aggregator_test.go +++ b/plugin/sampling/strategyprovider/adaptive/aggregator_test.go @@ -4,6 +4,7 @@ package adaptive import ( + "net/http" "testing" "time" @@ -37,12 +38,12 @@ func TestAggregator(t *testing.T) { a, err := NewAggregator(testOpts, logger, metricsFactory, mockEP, mockStorage) require.NoError(t, err) - a.RecordThroughput("A", "GET", model.SamplerTypeProbabilistic, 0.001) - a.RecordThroughput("B", "POST", model.SamplerTypeProbabilistic, 0.001) - a.RecordThroughput("C", "GET", model.SamplerTypeProbabilistic, 0.001) - a.RecordThroughput("A", "POST", model.SamplerTypeProbabilistic, 0.001) - a.RecordThroughput("A", "GET", model.SamplerTypeProbabilistic, 0.001) - a.RecordThroughput("A", "GET", model.SamplerTypeLowerBound, 0.001) + a.RecordThroughput("A", http.MethodGet, model.SamplerTypeProbabilistic, 0.001) + a.RecordThroughput("B", http.MethodPost, model.SamplerTypeProbabilistic, 0.001) + a.RecordThroughput("C", http.MethodGet, model.SamplerTypeProbabilistic, 0.001) + a.RecordThroughput("A", http.MethodPost, model.SamplerTypeProbabilistic, 0.001) + a.RecordThroughput("A", http.MethodGet, model.SamplerTypeProbabilistic, 0.001) + a.RecordThroughput("A", http.MethodGet, model.SamplerTypeLowerBound, 0.001) a.Start() defer a.Close() @@ -74,17 +75,17 @@ func TestIncrementThroughput(t *testing.T) { require.NoError(t, err) // 20 different probabilities for i := 0; i < 20; i++ { - a.RecordThroughput("A", "GET", model.SamplerTypeProbabilistic, 0.001*float64(i)) + a.RecordThroughput("A", http.MethodGet, model.SamplerTypeProbabilistic, 0.001*float64(i)) } - assert.Len(t, a.(*aggregator).currentThroughput["A"]["GET"].Probabilities, 10) + assert.Len(t, a.(*aggregator).currentThroughput["A"][http.MethodGet].Probabilities, 10) a, err = NewAggregator(testOpts, logger, metricsFactory, mockEP, mockStorage) require.NoError(t, err) // 20 of the same probabilities for i := 0; i < 20; i++ { - a.RecordThroughput("A", "GET", model.SamplerTypeProbabilistic, 0.001) + a.RecordThroughput("A", http.MethodGet, model.SamplerTypeProbabilistic, 0.001) } - assert.Len(t, a.(*aggregator).currentThroughput["A"]["GET"].Probabilities, 1) + assert.Len(t, a.(*aggregator).currentThroughput["A"][http.MethodGet].Probabilities, 1) } func TestLowerboundThroughput(t *testing.T) { @@ -100,9 +101,9 @@ func TestLowerboundThroughput(t *testing.T) { a, err := NewAggregator(testOpts, logger, metricsFactory, mockEP, mockStorage) require.NoError(t, err) - a.RecordThroughput("A", "GET", model.SamplerTypeLowerBound, 0.001) - assert.EqualValues(t, 0, a.(*aggregator).currentThroughput["A"]["GET"].Count) - assert.Empty(t, a.(*aggregator).currentThroughput["A"]["GET"].Probabilities["0.001000"]) + a.RecordThroughput("A", http.MethodGet, model.SamplerTypeLowerBound, 0.001) + assert.EqualValues(t, 0, a.(*aggregator).currentThroughput["A"][http.MethodGet].Count) + assert.Empty(t, a.(*aggregator).currentThroughput["A"][http.MethodGet].Probabilities["0.001000"]) } func TestRecordThroughput(t *testing.T) { @@ -132,7 +133,7 @@ func TestRecordThroughput(t *testing.T) { require.Empty(t, a.(*aggregator).currentThroughput) // Testing span with service name and operation but no probabilistic sampling tags - span.OperationName = "GET" + span.OperationName = http.MethodGet a.HandleRootSpan(span, logger) require.Empty(t, a.(*aggregator).currentThroughput) @@ -142,7 +143,7 @@ func TestRecordThroughput(t *testing.T) { model.String("sampler.param", "0.001"), } a.HandleRootSpan(span, logger) - assert.EqualValues(t, 1, a.(*aggregator).currentThroughput["A"]["GET"].Count) + assert.EqualValues(t, 1, a.(*aggregator).currentThroughput["A"][http.MethodGet].Count) } func TestRecordThroughputFunc(t *testing.T) { @@ -173,7 +174,7 @@ func TestRecordThroughputFunc(t *testing.T) { require.Empty(t, a.(*aggregator).currentThroughput) // Testing span with service name and operation but no probabilistic sampling tags - span.OperationName = "GET" + span.OperationName = http.MethodGet a.HandleRootSpan(span, logger) require.Empty(t, a.(*aggregator).currentThroughput) @@ -183,5 +184,5 @@ func TestRecordThroughputFunc(t *testing.T) { model.String("sampler.param", "0.001"), } a.HandleRootSpan(span, logger) - assert.EqualValues(t, 1, a.(*aggregator).currentThroughput["A"]["GET"].Count) + assert.EqualValues(t, 1, a.(*aggregator).currentThroughput["A"][http.MethodGet].Count) } diff --git a/plugin/sampling/strategyprovider/adaptive/factory.go b/plugin/sampling/strategyprovider/adaptive/factory.go index adf02a2d9f5..7467b3b49d5 100644 --- a/plugin/sampling/strategyprovider/adaptive/factory.go +++ b/plugin/sampling/strategyprovider/adaptive/factory.go @@ -37,11 +37,10 @@ type Factory struct { // NewFactory creates a new Factory. func NewFactory() *Factory { return &Factory{ - options: &Options{}, - logger: zap.NewNop(), - metricsFactory: metrics.NullFactory, - lock: nil, - store: nil, + options: &Options{}, + logger: zap.NewNop(), + lock: nil, + store: nil, } } diff --git a/plugin/sampling/strategyprovider/adaptive/post_aggregator_test.go b/plugin/sampling/strategyprovider/adaptive/post_aggregator_test.go index 6a0f71b1eb6..fd0da089ac6 100644 --- a/plugin/sampling/strategyprovider/adaptive/post_aggregator_test.go +++ b/plugin/sampling/strategyprovider/adaptive/post_aggregator_test.go @@ -5,6 +5,7 @@ package adaptive import ( "errors" + "net/http" "testing" "time" @@ -24,10 +25,10 @@ import ( func testThroughputs() []*model.Throughput { return []*model.Throughput{ - {Service: "svcA", Operation: "GET", Count: 4, Probabilities: map[string]struct{}{"0.1": {}}}, - {Service: "svcA", Operation: "GET", Count: 4, Probabilities: map[string]struct{}{"0.2": {}}}, - {Service: "svcA", Operation: "PUT", Count: 5, Probabilities: map[string]struct{}{"0.1": {}}}, - {Service: "svcB", Operation: "GET", Count: 3, Probabilities: map[string]struct{}{"0.1": {}}}, + {Service: "svcA", Operation: http.MethodGet, Count: 4, Probabilities: map[string]struct{}{"0.1": {}}}, + {Service: "svcA", Operation: http.MethodGet, Count: 4, Probabilities: map[string]struct{}{"0.2": {}}}, + {Service: "svcA", Operation: http.MethodPut, Count: 5, Probabilities: map[string]struct{}{"0.1": {}}}, + {Service: "svcB", Operation: http.MethodGet, Count: 3, Probabilities: map[string]struct{}{"0.1": {}}}, } } @@ -36,12 +37,12 @@ func testThroughputBuckets() []*throughputBucket { { throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "GET": {Count: 45}, - "PUT": {Count: 60}, + http.MethodGet: {Count: 45}, + http.MethodPut: {Count: 60}, }, "svcB": map[string]*model.Throughput{ - "GET": {Count: 30}, - "PUT": {Count: 15}, + http.MethodGet: {Count: 30}, + http.MethodPut: {Count: 15}, }, }, interval: 60 * time.Second, @@ -49,10 +50,10 @@ func testThroughputBuckets() []*throughputBucket { { throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "GET": {Count: 30}, + http.MethodGet: {Count: 30}, }, "svcB": map[string]*model.Throughput{ - "GET": {Count: 45}, + http.MethodGet: {Count: 45}, }, }, interval: 60 * time.Second, @@ -87,12 +88,12 @@ func TestAggregateThroughput(t *testing.T) { require.True(t, ok) require.Len(t, throughput, 2) - opThroughput, ok := throughput["GET"] + opThroughput, ok := throughput[http.MethodGet] require.True(t, ok) assert.Equal(t, int64(8), opThroughput.Count) assert.Equal(t, map[string]struct{}{"0.1": {}, "0.2": {}}, opThroughput.Probabilities) - opThroughput, ok = throughput["PUT"] + opThroughput, ok = throughput[http.MethodPut] require.True(t, ok) assert.Equal(t, int64(5), opThroughput.Count) assert.Equal(t, map[string]struct{}{"0.1": {}}, opThroughput.Probabilities) @@ -101,7 +102,7 @@ func TestAggregateThroughput(t *testing.T) { require.True(t, ok) require.Len(t, throughput, 1) - opThroughput, ok = throughput["GET"] + opThroughput, ok = throughput[http.MethodGet] require.True(t, ok) assert.Equal(t, int64(3), opThroughput.Count) assert.Equal(t, map[string]struct{}{"0.1": {}}, opThroughput.Probabilities) @@ -112,7 +113,7 @@ func TestInitializeThroughput(t *testing.T) { mockStorage.On("GetThroughput", time.Time{}.Add(time.Minute*19), time.Time{}.Add(time.Minute*20)). Return(testThroughputs(), nil) mockStorage.On("GetThroughput", time.Time{}.Add(time.Minute*18), time.Time{}.Add(time.Minute*19)). - Return([]*model.Throughput{{Service: "svcA", Operation: "GET", Count: 7}}, nil) + Return([]*model.Throughput{{Service: "svcA", Operation: http.MethodGet, Count: 7}}, nil) mockStorage.On("GetThroughput", time.Time{}.Add(time.Minute*17), time.Time{}.Add(time.Minute*18)). Return([]*model.Throughput{}, nil) p := &PostAggregator{storage: mockStorage, Options: Options{CalculationInterval: time.Minute, AggregationBuckets: 3}} @@ -154,22 +155,22 @@ func TestGenerateOperationQPS(t *testing.T) { require.True(t, ok) require.Len(t, opQPS, 2) - assert.Equal(t, []float64{0.75, 0.5}, opQPS["GET"]) - assert.Equal(t, []float64{1.0}, opQPS["PUT"]) + assert.Equal(t, []float64{0.75, 0.5}, opQPS[http.MethodGet]) + assert.Equal(t, []float64{1.0}, opQPS[http.MethodPut]) opQPS, ok = svcOpQPS["svcB"] require.True(t, ok) require.Len(t, opQPS, 2) - assert.Equal(t, []float64{0.5, 0.75}, opQPS["GET"]) - assert.Equal(t, []float64{0.25}, opQPS["PUT"]) + assert.Equal(t, []float64{0.5, 0.75}, opQPS[http.MethodGet]) + assert.Equal(t, []float64{0.25}, opQPS[http.MethodPut]) // Test using the previous QPS if the throughput is not provided p.prependThroughputBucket( &throughputBucket{ throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "GET": {Count: 30}, + http.MethodGet: {Count: 30}, }, }, interval: 60 * time.Second, @@ -182,15 +183,15 @@ func TestGenerateOperationQPS(t *testing.T) { require.True(t, ok) require.Len(t, opQPS, 2) - assert.Equal(t, []float64{0.5, 0.75, 0.5}, opQPS["GET"]) - assert.Equal(t, []float64{1.0}, opQPS["PUT"]) + assert.Equal(t, []float64{0.5, 0.75, 0.5}, opQPS[http.MethodGet]) + assert.Equal(t, []float64{1.0}, opQPS[http.MethodPut]) opQPS, ok = svcOpQPS["svcB"] require.True(t, ok) require.Len(t, opQPS, 2) - assert.Equal(t, []float64{0.5, 0.75}, opQPS["GET"]) - assert.Equal(t, []float64{0.25}, opQPS["PUT"]) + assert.Equal(t, []float64{0.5, 0.75}, opQPS[http.MethodGet]) + assert.Equal(t, []float64{0.25}, opQPS[http.MethodPut]) } func TestGenerateOperationQPS_UseMostRecentBucketOnly(t *testing.T) { @@ -202,14 +203,14 @@ func TestGenerateOperationQPS_UseMostRecentBucketOnly(t *testing.T) { require.True(t, ok) require.Len(t, opQPS, 2) - assert.Equal(t, []float64{0.75}, opQPS["GET"]) - assert.Equal(t, []float64{1.0}, opQPS["PUT"]) + assert.Equal(t, []float64{0.75}, opQPS[http.MethodGet]) + assert.Equal(t, []float64{1.0}, opQPS[http.MethodPut]) p.prependThroughputBucket( &throughputBucket{ throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "GET": {Count: 30}, + http.MethodGet: {Count: 30}, }, }, interval: 60 * time.Second, @@ -223,8 +224,8 @@ func TestGenerateOperationQPS_UseMostRecentBucketOnly(t *testing.T) { require.True(t, ok) require.Len(t, opQPS, 2) - assert.Equal(t, []float64{0.5}, opQPS["GET"]) - assert.Equal(t, []float64{1.0}, opQPS["PUT"]) + assert.Equal(t, []float64{0.5}, opQPS[http.MethodGet]) + assert.Equal(t, []float64{1.0}, opQPS[http.MethodPut]) } func TestCalculateWeightedQPS(t *testing.T) { @@ -239,14 +240,14 @@ func TestCalculateProbability(t *testing.T) { { throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "GET": {Probabilities: map[string]struct{}{"0.500000": {}}}, + http.MethodGet: {Probabilities: map[string]struct{}{"0.500000": {}}}, }, }, }, } probabilities := model.ServiceOperationProbabilities{ "svcA": map[string]float64{ - "GET": 0.5, + http.MethodGet: 0.5, }, } cfg := Options{ @@ -269,12 +270,12 @@ func TestCalculateProbability(t *testing.T) { expectedProbability float64 errMsg string }{ - {"svcA", "GET", 2.0, 0.25, "modify existing probability"}, - {"svcA", "PUT", 2.0, 0.0005, "modify default probability"}, - {"svcB", "GET", 0.9, 0.001, "qps within equivalence threshold"}, - {"svcB", "PUT", 0.000001, 1.0, "test max probability"}, - {"svcB", "DELETE", 1000000000, 0.00001, "test min probability"}, - {"svcB", "DELETE", 0.0, 0.002, "test 0 qps"}, + {"svcA", http.MethodGet, 2.0, 0.25, "modify existing probability"}, + {"svcA", http.MethodPut, 2.0, 0.0005, "modify default probability"}, + {"svcB", http.MethodGet, 0.9, 0.001, "qps within equivalence threshold"}, + {"svcB", http.MethodPut, 0.000001, 1.0, "test max probability"}, + {"svcB", http.MethodDelete, 1000000000, 0.00001, "test min probability"}, + {"svcB", http.MethodDelete, 0.0, 0.002, "test 0 qps"}, } for _, test := range tests { probability := p.calculateProbability(test.service, test.operation, test.qps) @@ -285,13 +286,13 @@ func TestCalculateProbability(t *testing.T) { func TestCalculateProbabilitiesAndQPS(t *testing.T) { prevProbabilities := model.ServiceOperationProbabilities{ "svcB": map[string]float64{ - "GET": 0.16, - "PUT": 0.03, + http.MethodGet: 0.16, + http.MethodPut: 0.03, }, } qps := model.ServiceOperationQPS{ "svcB": map[string]float64{ - "GET": 0.625, + http.MethodGet: 0.625, }, } mets := metricstest.NewFactory(0) @@ -309,12 +310,12 @@ func TestCalculateProbabilitiesAndQPS(t *testing.T) { probabilities, qps := p.calculateProbabilitiesAndQPS() require.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.00136, "PUT": 0.001}, probabilities["svcA"]) - assert.Equal(t, map[string]float64{"GET": 0.16, "PUT": 0.03}, probabilities["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.00136, http.MethodPut: 0.001}, probabilities["svcA"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.16, http.MethodPut: 0.03}, probabilities["svcB"]) require.Len(t, qps, 2) - assert.Equal(t, map[string]float64{"GET": 0.7352941176470588, "PUT": 1}, qps["svcA"]) - assert.Equal(t, map[string]float64{"GET": 0.5147058823529411, "PUT": 0.25}, qps["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.7352941176470588, http.MethodPut: 1}, qps["svcA"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.5147058823529411, http.MethodPut: 0.25}, qps["svcB"]) _, gauges := mets.Backend.Snapshot() assert.EqualValues(t, 4, gauges["test"]) @@ -477,11 +478,11 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { { throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "GET": {Count: 3, Probabilities: map[string]struct{}{"0.001000": {}}}, - "PUT": {Count: 60, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodGet: {Count: 3, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 60, Probabilities: map[string]struct{}{"0.001000": {}}}, }, "svcB": map[string]*model.Throughput{ - "PUT": {Count: 15, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 15, Probabilities: map[string]struct{}{"0.001000": {}}}, }, }, interval: 60 * time.Second, @@ -506,8 +507,8 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { probabilities, qps := p.calculateProbabilitiesAndQPS() require.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.002, "PUT": 0.001}, probabilities["svcA"]) - assert.Equal(t, map[string]float64{"PUT": 0.002}, probabilities["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.002, http.MethodPut: 0.001}, probabilities["svcA"]) + assert.Equal(t, map[string]float64{http.MethodPut: 0.002}, probabilities["svcB"]) p.probabilities = probabilities p.qps = qps @@ -518,11 +519,11 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { p.prependThroughputBucket(&throughputBucket{ throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "PUT": {Count: 60, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 60, Probabilities: map[string]struct{}{"0.001000": {}}}, }, "svcB": map[string]*model.Throughput{ - "GET": {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, - "PUT": {Count: 0, Probabilities: map[string]struct{}{"0.002000": {}}}, + http.MethodGet: {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 0, Probabilities: map[string]struct{}{"0.002000": {}}}, }, }, interval: 60 * time.Second, @@ -531,8 +532,8 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { probabilities, qps = p.calculateProbabilitiesAndQPS() require.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.002, "PUT": 0.001}, probabilities["svcA"]) - assert.Equal(t, map[string]float64{"PUT": 0.004, "GET": 0.002}, probabilities["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.002, http.MethodPut: 0.001}, probabilities["svcA"]) + assert.Equal(t, map[string]float64{http.MethodPut: 0.004, http.MethodGet: 0.002}, probabilities["svcB"]) p.probabilities = probabilities p.qps = qps @@ -543,11 +544,11 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { p.prependThroughputBucket(&throughputBucket{ throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "GET": {Count: 0, Probabilities: map[string]struct{}{"0.002000": {}}}, - "PUT": {Count: 60, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodGet: {Count: 0, Probabilities: map[string]struct{}{"0.002000": {}}}, + http.MethodPut: {Count: 60, Probabilities: map[string]struct{}{"0.001000": {}}}, }, "svcB": map[string]*model.Throughput{ - "GET": {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodGet: {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, }, }, interval: 60 * time.Second, @@ -556,8 +557,8 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { probabilities, qps = p.calculateProbabilitiesAndQPS() require.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.004, "PUT": 0.001}, probabilities["svcA"]) - assert.Equal(t, map[string]float64{"PUT": 0.008, "GET": 0.002}, probabilities["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.004, http.MethodPut: 0.001}, probabilities["svcA"]) + assert.Equal(t, map[string]float64{http.MethodPut: 0.008, http.MethodGet: 0.002}, probabilities["svcB"]) p.probabilities = probabilities p.qps = qps @@ -567,12 +568,12 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { p.prependThroughputBucket(&throughputBucket{ throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "GET": {Count: 1, Probabilities: map[string]struct{}{"0.004000": {}}}, - "PUT": {Count: 60, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodGet: {Count: 1, Probabilities: map[string]struct{}{"0.004000": {}}}, + http.MethodPut: {Count: 60, Probabilities: map[string]struct{}{"0.001000": {}}}, }, "svcB": map[string]*model.Throughput{ - "GET": {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, - "PUT": {Count: 15, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodGet: {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 15, Probabilities: map[string]struct{}{"0.001000": {}}}, }, }, interval: 60 * time.Second, @@ -581,8 +582,8 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { probabilities, qps = p.calculateProbabilitiesAndQPS() require.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.008, "PUT": 0.001}, probabilities["svcA"]) - assert.Equal(t, map[string]float64{"PUT": 0.008, "GET": 0.002}, probabilities["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.008, http.MethodPut: 0.001}, probabilities["svcA"]) + assert.Equal(t, map[string]float64{http.MethodPut: 0.008, http.MethodGet: 0.002}, probabilities["svcB"]) p.probabilities = probabilities p.qps = qps @@ -591,11 +592,11 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { p.prependThroughputBucket(&throughputBucket{ throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "PUT": {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, }, "svcB": map[string]*model.Throughput{ - "GET": {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, - "PUT": {Count: 15, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodGet: {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 15, Probabilities: map[string]struct{}{"0.001000": {}}}, }, }, interval: 60 * time.Second, @@ -604,8 +605,8 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { probabilities, qps = p.calculateProbabilitiesAndQPS() require.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.016, "PUT": 0.001468867216804201}, probabilities["svcA"]) - assert.Equal(t, map[string]float64{"PUT": 0.008, "GET": 0.002}, probabilities["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.016, http.MethodPut: 0.001468867216804201}, probabilities["svcA"]) + assert.Equal(t, map[string]float64{http.MethodPut: 0.008, http.MethodGet: 0.002}, probabilities["svcB"]) p.probabilities = probabilities p.qps = qps @@ -615,11 +616,11 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { p.prependThroughputBucket(&throughputBucket{ throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "PUT": {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, }, "svcB": map[string]*model.Throughput{ - "GET": {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, - "PUT": {Count: 1, Probabilities: map[string]struct{}{"0.008000": {}}}, + http.MethodGet: {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 1, Probabilities: map[string]struct{}{"0.008000": {}}}, }, }, interval: 60 * time.Second, @@ -628,8 +629,8 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { probabilities, qps = p.calculateProbabilitiesAndQPS() require.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.032, "PUT": 0.001468867216804201}, probabilities["svcA"]) - assert.Equal(t, map[string]float64{"PUT": 0.016, "GET": 0.002}, probabilities["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.032, http.MethodPut: 0.001468867216804201}, probabilities["svcA"]) + assert.Equal(t, map[string]float64{http.MethodPut: 0.016, http.MethodGet: 0.002}, probabilities["svcB"]) p.probabilities = probabilities p.qps = qps @@ -639,10 +640,10 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { p.prependThroughputBucket(&throughputBucket{ throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "PUT": {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 30, Probabilities: map[string]struct{}{"0.001000": {}}}, }, "svcB": map[string]*model.Throughput{ - "GET": {Count: 15, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodGet: {Count: 15, Probabilities: map[string]struct{}{"0.001000": {}}}, }, }, interval: 60 * time.Second, @@ -651,8 +652,8 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { probabilities, qps = p.calculateProbabilitiesAndQPS() require.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.064, "PUT": 0.001468867216804201}, probabilities["svcA"]) - assert.Equal(t, map[string]float64{"PUT": 0.032, "GET": 0.002}, probabilities["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.064, http.MethodPut: 0.001468867216804201}, probabilities["svcA"]) + assert.Equal(t, map[string]float64{http.MethodPut: 0.032, http.MethodGet: 0.002}, probabilities["svcB"]) p.probabilities = probabilities p.qps = qps @@ -662,10 +663,10 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { p.prependThroughputBucket(&throughputBucket{ throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "PUT": {Count: 20, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 20, Probabilities: map[string]struct{}{"0.001000": {}}}, }, "svcB": map[string]*model.Throughput{ - "GET": {Count: 10, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodGet: {Count: 10, Probabilities: map[string]struct{}{"0.001000": {}}}, }, }, interval: 60 * time.Second, @@ -674,8 +675,8 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { probabilities, qps = p.calculateProbabilitiesAndQPS() require.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.128, "PUT": 0.001468867216804201}, probabilities["svcA"]) - assert.Equal(t, map[string]float64{"PUT": 0.064, "GET": 0.002}, probabilities["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.128, http.MethodPut: 0.001468867216804201}, probabilities["svcA"]) + assert.Equal(t, map[string]float64{http.MethodPut: 0.064, http.MethodGet: 0.002}, probabilities["svcB"]) p.probabilities = probabilities p.qps = qps @@ -685,12 +686,12 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { p.prependThroughputBucket(&throughputBucket{ throughput: serviceOperationThroughput{ "svcA": map[string]*model.Throughput{ - "PUT": {Count: 20, Probabilities: map[string]struct{}{"0.001000": {}}}, - "GET": {Count: 120, Probabilities: map[string]struct{}{"0.128000": {}}}, + http.MethodPut: {Count: 20, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodGet: {Count: 120, Probabilities: map[string]struct{}{"0.128000": {}}}, }, "svcB": map[string]*model.Throughput{ - "PUT": {Count: 60, Probabilities: map[string]struct{}{"0.064000": {}}}, - "GET": {Count: 10, Probabilities: map[string]struct{}{"0.001000": {}}}, + http.MethodPut: {Count: 60, Probabilities: map[string]struct{}{"0.064000": {}}}, + http.MethodGet: {Count: 10, Probabilities: map[string]struct{}{"0.001000": {}}}, }, }, interval: 60 * time.Second, @@ -699,8 +700,8 @@ func TestCalculateProbabilitiesAndQPSMultiple(t *testing.T) { probabilities, qps = p.calculateProbabilitiesAndQPS() require.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.0882586677054928, "PUT": 0.001468867216804201}, probabilities["svcA"]) - assert.Equal(t, map[string]float64{"PUT": 0.09587513707888091, "GET": 0.002}, probabilities["svcB"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.0882586677054928, http.MethodPut: 0.001468867216804201}, probabilities["svcA"]) + assert.Equal(t, map[string]float64{http.MethodPut: 0.09587513707888091, http.MethodGet: 0.002}, probabilities["svcB"]) p.probabilities = probabilities p.qps = qps diff --git a/plugin/sampling/strategyprovider/adaptive/provider_test.go b/plugin/sampling/strategyprovider/adaptive/provider_test.go index 8a26d8fc34d..1342cd21790 100644 --- a/plugin/sampling/strategyprovider/adaptive/provider_test.go +++ b/plugin/sampling/strategyprovider/adaptive/provider_test.go @@ -5,6 +5,7 @@ package adaptive import ( "context" + "net/http" "testing" "time" @@ -68,10 +69,10 @@ func TestProviderRealisticRunCalculationLoop(t *testing.T) { logger := zap.NewNop() // NB: This is an extremely long test since it uses near realistic (1/6th scale) processor config values testThroughputs := []*model.Throughput{ - {Service: "svcA", Operation: "GET", Count: 10}, - {Service: "svcA", Operation: "POST", Count: 9}, - {Service: "svcA", Operation: "PUT", Count: 5}, - {Service: "svcA", Operation: "DELETE", Count: 20}, + {Service: "svcA", Operation: http.MethodGet, Count: 10}, + {Service: "svcA", Operation: http.MethodPost, Count: 9}, + {Service: "svcA", Operation: http.MethodPut, Count: 5}, + {Service: "svcA", Operation: http.MethodDelete, Count: 20}, } mockStorage := &smocks.Store{} mockStorage.On("GetThroughput", mock.AnythingOfType("time.Time"), mock.AnythingOfType("time.Time")). @@ -110,16 +111,16 @@ func TestProviderRealisticRunCalculationLoop(t *testing.T) { for _, s := range strategies { switch s.Operation { - case "GET": + case http.MethodGet: assert.InDelta(t, 0.001, s.ProbabilisticSampling.SamplingRate, 1e-4, "Already at 1QPS, no probability change") - case "POST": + case http.MethodPost: assert.InDelta(t, 0.001, s.ProbabilisticSampling.SamplingRate, 1e-4, "Within epsilon of 1QPS, no probability change") - case "PUT": + case http.MethodPut: assert.InEpsilon(t, 0.002, s.ProbabilisticSampling.SamplingRate, 0.025, "Under sampled, double probability") - case "DELETE": + case http.MethodDelete: assert.InEpsilon(t, 0.0005, s.ProbabilisticSampling.SamplingRate, 0.025, "Over sampled, halve probability") } @@ -129,7 +130,7 @@ func TestProviderRealisticRunCalculationLoop(t *testing.T) { func TestProviderGenerateStrategyResponses(t *testing.T) { probabilities := model.ServiceOperationProbabilities{ "svcA": map[string]float64{ - "GET": 0.5, + http.MethodGet: 0.5, }, } p := &Provider{ @@ -149,7 +150,7 @@ func TestProviderGenerateStrategyResponses(t *testing.T) { DefaultLowerBoundTracesPerSecond: 0.0001, PerOperationStrategies: []*api_v2.OperationSamplingStrategy{ { - Operation: "GET", + Operation: http.MethodGet, ProbabilisticSampling: &api_v2.ProbabilisticSamplingStrategy{ SamplingRate: 0.5, }, diff --git a/plugin/sampling/strategyprovider/static/provider.go b/plugin/sampling/strategyprovider/static/provider.go index 56890ed63c0..8c801de8f79 100644 --- a/plugin/sampling/strategyprovider/static/provider.go +++ b/plugin/sampling/strategyprovider/static/provider.go @@ -104,7 +104,7 @@ func (h *samplingProvider) downloadSamplingStrategies(samplingURL string) ([]byt ctx, cx := context.WithTimeout(context.Background(), time.Second) defer cx() - req, err := http.NewRequestWithContext(ctx, "GET", samplingURL, nil) + req, err := http.NewRequestWithContext(ctx, http.MethodGet, samplingURL, nil) if err != nil { return nil, fmt.Errorf("cannot construct HTTP request: %w", err) } diff --git a/plugin/sampling/strategyprovider/static/provider_test.go b/plugin/sampling/strategyprovider/static/provider_test.go index ba7992f18f8..783caeb5c54 100644 --- a/plugin/sampling/strategyprovider/static/provider_test.go +++ b/plugin/sampling/strategyprovider/static/provider_test.go @@ -73,15 +73,15 @@ func mockStrategyServer(t *testing.T) (*httptest.Server, *atomic.Pointer[string] return case "/bad-status": - w.WriteHeader(404) + w.WriteHeader(http.StatusNotFound) return case "/service-unavailable": - w.WriteHeader(503) + w.WriteHeader(http.StatusServiceUnavailable) return default: - w.WriteHeader(200) + w.WriteHeader(http.StatusOK) w.Header().Set("Content-Type", "application/json") w.Write([]byte(*strategy.Load())) } diff --git a/plugin/storage/cassandra/samplingstore/storage_test.go b/plugin/storage/cassandra/samplingstore/storage_test.go index 238d9723f56..774ffeb5422 100644 --- a/plugin/storage/cassandra/samplingstore/storage_test.go +++ b/plugin/storage/cassandra/samplingstore/storage_test.go @@ -6,6 +6,7 @@ package samplingstore import ( "errors" + "net/http" "testing" "time" @@ -329,12 +330,12 @@ func TestStringToThroughput(t *testing.T) { func TestProbabilitiesAndQPSToString(t *testing.T) { probabilities := model.ServiceOperationProbabilities{ "svc,1": map[string]float64{ - "GET": 0.001, + http.MethodGet: 0.001, }, } qps := model.ServiceOperationQPS{ "svc,1": map[string]float64{ - "GET": 62.3, + http.MethodGet: 62.3, }, } str := probabilitiesAndQPSToString(probabilities, qps) @@ -348,17 +349,17 @@ func TestStringToProbabilitiesAndQPS(t *testing.T) { assert.Len(t, probabilities, 2) assert.Equal(t, map[string]*model.ProbabilityAndQPS{ - "GET": { + http.MethodGet: { Probability: 0.001, QPS: 63.2, }, - "PUT": { + http.MethodPut: { Probability: 0.002, QPS: 0.0, }, }, probabilities["svc1"]) assert.Equal(t, map[string]*model.ProbabilityAndQPS{ - "GET": { + http.MethodGet: { Probability: 0.5, QPS: 34.2, }, @@ -371,8 +372,8 @@ func TestStringToProbabilities(t *testing.T) { probabilities := s.stringToProbabilities(testStr) assert.Len(t, probabilities, 2) - assert.Equal(t, map[string]float64{"GET": 0.001, "PUT": 0.002}, probabilities["svc1"]) - assert.Equal(t, map[string]float64{"GET": 0.5}, probabilities["svc2"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.001, http.MethodPut: 0.002}, probabilities["svc1"]) + assert.Equal(t, map[string]float64{http.MethodGet: 0.5}, probabilities["svc2"]) } func TestProbabilitiesSetToString(t *testing.T) { diff --git a/plugin/storage/es/options_test.go b/plugin/storage/es/options_test.go index 33d933b5830..87b2ce11d7f 100644 --- a/plugin/storage/es/options_test.go +++ b/plugin/storage/es/options_test.go @@ -5,6 +5,7 @@ package es import ( + "net/http" "testing" "time" @@ -117,7 +118,7 @@ func TestOptionsWithFlags(t *testing.T) { assert.Equal(t, "2006.01.02", aux.Indices.Services.DateLayout) assert.Equal(t, "2006.01.02.15", aux.Indices.Spans.DateLayout) assert.True(t, primary.UseILM) - assert.Equal(t, "POST", aux.SendGetBodyAs) + assert.Equal(t, http.MethodPost, aux.SendGetBodyAs) } func TestEmptyRemoteReadClusters(t *testing.T) { diff --git a/plugin/storage/es/spanstore/writer.go b/plugin/storage/es/spanstore/writer.go index 77e781d8aaf..4a3c9ac0563 100644 --- a/plugin/storage/es/spanstore/writer.go +++ b/plugin/storage/es/spanstore/writer.go @@ -17,7 +17,7 @@ import ( cfg "github.com/jaegertracing/jaeger/pkg/es/config" "github.com/jaegertracing/jaeger/pkg/metrics" "github.com/jaegertracing/jaeger/plugin/storage/es/spanstore/dbmodel" - storageMetrics "github.com/jaegertracing/jaeger/storage/spanstore/metrics" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) const ( @@ -28,7 +28,7 @@ const ( ) type spanWriterMetrics struct { - indexCreate *storageMetrics.WriteMetrics + indexCreate *spanstoremetrics.WriteMetrics } type serviceWriter func(string, *dbmodel.Span) @@ -72,7 +72,7 @@ func NewSpanWriter(p SpanWriterParams) *SpanWriter { client: p.Client, logger: p.Logger, writerMetrics: spanWriterMetrics{ - indexCreate: storageMetrics.NewWriteMetrics(p.MetricsFactory, "index_create"), + indexCreate: spanstoremetrics.NewWriter(p.MetricsFactory, "index_create"), }, serviceWriter: serviceOperationStorage.Write, spanConverter: dbmodel.NewFromDomain(p.AllTagsAsFields, p.TagKeysAsFields, p.TagDotReplacement), diff --git a/plugin/storage/grpc/factory.go b/plugin/storage/grpc/factory.go index 11fa15eb008..e198068a7cb 100644 --- a/plugin/storage/grpc/factory.go +++ b/plugin/storage/grpc/factory.go @@ -12,7 +12,6 @@ import ( "github.com/spf13/viper" "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configgrpc" "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" @@ -25,7 +24,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/bearertoken" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" @@ -43,33 +42,28 @@ var ( // interface comformance checks // Factory implements storage.Factory and creates storage components backed by a storage plugin. type Factory struct { - metricsFactory metrics.Factory - logger *zap.Logger - tracerProvider trace.TracerProvider config Config + telset telemetry.Settings services *ClientPluginServices tracedRemoteConn *grpc.ClientConn untracedRemoteConn *grpc.ClientConn - host component.Host - meterProvider metric.MeterProvider } // NewFactory creates a new Factory. func NewFactory() *Factory { return &Factory{ - host: componenttest.NewNopHost(), + telset: telemetry.NoopSettings(), } } // NewFactoryWithConfig is used from jaeger(v2). func NewFactoryWithConfig( cfg Config, - telset telemetery.Setting, + telset telemetry.Settings, ) (*Factory, error) { f := NewFactory() f.config = cfg - f.host = telset.Host - f.meterProvider = telset.LeveledMeterProvider(configtelemetry.LevelNone) + f.telset = telset if err := f.Initialize(telset.Metrics, telset.Logger); err != nil { return nil, err } @@ -90,17 +84,18 @@ func (f *Factory) InitFromViper(v *viper.Viper, logger *zap.Logger) { // Initialize implements storage.Factory func (f *Factory) Initialize(metricsFactory metrics.Factory, logger *zap.Logger) error { - f.metricsFactory, f.logger = metricsFactory, logger - f.tracerProvider = otel.GetTracerProvider() + f.telset.Metrics = metricsFactory + f.telset.Logger = logger + f.telset.TracerProvider = otel.GetTracerProvider() - tracedTelset := getTelset(logger, f.tracerProvider, f.meterProvider) - untracedTelset := getTelset(logger, noop.NewTracerProvider(), f.meterProvider) + tracedTelset := getTelset(logger, f.telset.TracerProvider, f.telset.MeterProvider) + untracedTelset := getTelset(logger, noop.NewTracerProvider(), f.telset.MeterProvider) newClientFn := func(telset component.TelemetrySettings, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error) { clientOpts := make([]configgrpc.ToClientConnOption, 0) for _, opt := range opts { clientOpts = append(clientOpts, configgrpc.WithGrpcDialOption(opt)) } - return f.config.ToClientConn(context.Background(), f.host, telset, clientOpts...) + return f.config.ToClientConn(context.Background(), f.telset.Host, telset, clientOpts...) } var err error diff --git a/plugin/storage/grpc/factory_test.go b/plugin/storage/grpc/factory_test.go index d1642049e8e..c96897bae16 100644 --- a/plugin/storage/grpc/factory_test.go +++ b/plugin/storage/grpc/factory_test.go @@ -16,19 +16,15 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componenttest" "go.opentelemetry.io/collector/config/configauth" "go.opentelemetry.io/collector/config/configgrpc" - "go.opentelemetry.io/collector/config/configtelemetry" "go.opentelemetry.io/collector/exporter/exporterhelper" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap" "google.golang.org/grpc" "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared" "github.com/jaegertracing/jaeger/plugin/storage/grpc/shared/mocks" @@ -110,14 +106,7 @@ func TestNewFactoryError(t *testing.T) { Auth: &configauth.Authentication{}, }, } - telset := telemetery.Setting{ - Logger: zap.NewNop(), - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() - }, - Host: componenttest.NewNopHost(), - Metrics: metrics.NullFactory, - } + telset := telemetry.NoopSettings() t.Run("with_config", func(t *testing.T) { _, err := NewFactoryWithConfig(*cfg, telset) assert.ErrorContains(t, err, "authenticator") @@ -188,14 +177,7 @@ func TestGRPCStorageFactoryWithConfig(t *testing.T) { Enabled: true, }, } - telset := telemetery.Setting{ - Logger: zap.NewNop(), - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() - }, - Host: componenttest.NewNopHost(), - Metrics: metrics.NullFactory, - } + telset := telemetry.NoopSettings() f, err := NewFactoryWithConfig(cfg, telset) require.NoError(t, err) require.NoError(t, f.Close()) diff --git a/plugin/storage/grpc/proto/storage.proto b/plugin/storage/grpc/proto/storage.proto index 51c804948fb..7491b665043 100644 --- a/plugin/storage/grpc/proto/storage.proto +++ b/plugin/storage/grpc/proto/storage.proto @@ -72,6 +72,14 @@ message GetTraceRequest { (gogoproto.customtype) = "github.com/jaegertracing/jaeger/model.TraceID", (gogoproto.customname) = "TraceID" ]; + google.protobuf.Timestamp start_time = 2 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false + ]; + google.protobuf.Timestamp end_time = 3 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false + ]; } message GetServicesRequest {} diff --git a/plugin/storage/grpc/proto/storage_test.proto b/plugin/storage/grpc/proto/storage_test.proto index b279e05dbab..49d001975c4 100644 --- a/plugin/storage/grpc/proto/storage_test.proto +++ b/plugin/storage/grpc/proto/storage_test.proto @@ -18,6 +18,10 @@ package storageprototest; option go_package = "./storageprototest"; +import "google/protobuf/timestamp.proto"; + message GetTraceRequest { bytes trace_id = 1; + google.protobuf.Timestamp start_time = 2; + google.protobuf.Timestamp end_time = 3; } diff --git a/plugin/storage/grpc/proto/storage_v1/storage_test.go b/plugin/storage/grpc/proto/storage_v1/storage_test.go index 6d5be333e76..12aff133c26 100644 --- a/plugin/storage/grpc/proto/storage_v1/storage_test.go +++ b/plugin/storage/grpc/proto/storage_v1/storage_test.go @@ -10,6 +10,7 @@ import ( "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "google.golang.org/protobuf/types/known/timestamppb" "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/pkg/testutils" @@ -31,9 +32,15 @@ func TestGetTraceRequestMarshalProto(t *testing.T) { } for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - ref1 := storage_v1.GetTraceRequest{TraceID: model.NewTraceID(2, 3)} + ref1 := storage_v1.GetTraceRequest{ + TraceID: model.NewTraceID(2, 3), + StartTime: time.Unix(1, 2).UTC(), + EndTime: time.Unix(3, 4).UTC(), + } ref2 := storageprototest.GetTraceRequest{ - TraceId: []byte{0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3}, + TraceId: []byte{0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3}, + StartTime: timestamppb.New(time.Unix(1, 2).UTC()), + EndTime: timestamppb.New(time.Unix(3, 4).UTC()), } d1, err := testCase.marshal(&ref1) require.NoError(t, err) diff --git a/plugin/storage/grpc/proto/storageprototest/storage_test.pb.go b/plugin/storage/grpc/proto/storageprototest/storage_test.pb.go index 369e573cf8f..d2c84edaec3 100644 --- a/plugin/storage/grpc/proto/storageprototest/storage_test.pb.go +++ b/plugin/storage/grpc/proto/storageprototest/storage_test.pb.go @@ -23,6 +23,7 @@ package storageprototest import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -39,7 +40,9 @@ type GetTraceRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` + TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` + StartTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + EndTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` } func (x *GetTraceRequest) Reset() { @@ -81,17 +84,40 @@ func (x *GetTraceRequest) GetTraceId() []byte { return nil } +func (x *GetTraceRequest) GetStartTime() *timestamppb.Timestamp { + if x != nil { + return x.StartTime + } + return nil +} + +func (x *GetTraceRequest) GetEndTime() *timestamppb.Timestamp { + if x != nil { + return x.EndTime + } + return nil +} + var File_storage_test_proto protoreflect.FileDescriptor var file_storage_test_proto_rawDesc = []byte{ 0x0a, 0x12, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x74, 0x65, 0x73, 0x74, 0x22, 0x2c, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x54, 0x72, 0x61, - 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, - 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x72, 0x61, - 0x63, 0x65, 0x49, 0x64, 0x42, 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x74, 0x6f, 0x74, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9e, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x54, + 0x72, 0x61, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, + 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, + 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, + 0x65, 0x12, 0x35, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, + 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x14, 0x5a, 0x12, 0x2e, 0x2f, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x65, 0x73, 0x74, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -108,14 +134,17 @@ func file_storage_test_proto_rawDescGZIP() []byte { var file_storage_test_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_storage_test_proto_goTypes = []interface{}{ - (*GetTraceRequest)(nil), // 0: storageprototest.GetTraceRequest + (*GetTraceRequest)(nil), // 0: storageprototest.GetTraceRequest + (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp } var file_storage_test_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: storageprototest.GetTraceRequest.start_time:type_name -> google.protobuf.Timestamp + 1, // 1: storageprototest.GetTraceRequest.end_time:type_name -> google.protobuf.Timestamp + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_storage_test_proto_init() } diff --git a/plugin/storage/integration/remote_memory_storage.go b/plugin/storage/integration/remote_memory_storage.go index ff6c64918cf..74f813fa2b9 100644 --- a/plugin/storage/integration/remote_memory_storage.go +++ b/plugin/storage/integration/remote_memory_storage.go @@ -10,9 +10,6 @@ import ( "time" "github.com/stretchr/testify/require" - "go.opentelemetry.io/collector/config/configtelemetry" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" "go.uber.org/zap" "go.uber.org/zap/zaptest" "google.golang.org/grpc" @@ -23,7 +20,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/config" "github.com/jaegertracing/jaeger/pkg/healthcheck" "github.com/jaegertracing/jaeger/pkg/metrics" - "github.com/jaegertracing/jaeger/pkg/telemetery" + "github.com/jaegertracing/jaeger/pkg/telemetry" "github.com/jaegertracing/jaeger/pkg/tenancy" "github.com/jaegertracing/jaeger/plugin/storage" "github.com/jaegertracing/jaeger/ports" @@ -51,13 +48,9 @@ func StartNewRemoteMemoryStorage(t *testing.T) *RemoteMemoryStorage { require.NoError(t, storageFactory.Initialize(metrics.NullFactory, logger)) t.Logf("Starting in-process remote storage server on %s", opts.GRPCHostPort) - telset := telemetery.Setting{ - Logger: logger, - ReportStatus: telemetery.HCAdapter(healthcheck.New()), - LeveledMeterProvider: func(_ configtelemetry.Level) metric.MeterProvider { - return noop.NewMeterProvider() - }, - } + telset := telemetry.NoopSettings() + telset.Logger = logger + telset.ReportStatus = telemetry.HCAdapter(healthcheck.New()) server, err := app.NewServer(opts, storageFactory, tm, telset) require.NoError(t, err) require.NoError(t, server.Start()) diff --git a/plugin/storage/kafka/factory.go b/plugin/storage/kafka/factory.go index d1b59194073..1e089eeab35 100644 --- a/plugin/storage/kafka/factory.go +++ b/plugin/storage/kafka/factory.go @@ -105,6 +105,5 @@ func (f *Factory) Close() error { if f.producer != nil { errs = append(errs, f.producer.Close()) } - errs = append(errs, f.options.Config.TLS.Close()) return errors.Join(errs...) } diff --git a/plugin/storage/kafka/options_test.go b/plugin/storage/kafka/options_test.go index a2b10405e3b..cb41caac0a3 100644 --- a/plugin/storage/kafka/options_test.go +++ b/plugin/storage/kafka/options_test.go @@ -11,9 +11,9 @@ import ( "github.com/Shopify/sarama" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/config/configtls" "github.com/jaegertracing/jaeger/pkg/config" - "github.com/jaegertracing/jaeger/pkg/config/tlscfg" "github.com/jaegertracing/jaeger/pkg/kafka/auth" ) @@ -181,15 +181,15 @@ func TestTLSFlags(t *testing.T) { }, { flags: []string{"--kafka.producer.authentication=kerberos", "--kafka.producer.tls.enabled=true"}, - expected: auth.AuthenticationConfig{Authentication: "kerberos", Kerberos: kerb, TLS: tlscfg.Options{Enabled: true}, PlainText: plain}, + expected: auth.AuthenticationConfig{Authentication: "kerberos", Kerberos: kerb, TLS: configtls.ClientConfig{}, PlainText: plain}, }, { flags: []string{"--kafka.producer.authentication=tls"}, - expected: auth.AuthenticationConfig{Authentication: "tls", Kerberos: kerb, TLS: tlscfg.Options{Enabled: true}, PlainText: plain}, + expected: auth.AuthenticationConfig{Authentication: "tls", Kerberos: kerb, TLS: configtls.ClientConfig{}, PlainText: plain}, }, { flags: []string{"--kafka.producer.authentication=tls", "--kafka.producer.tls.enabled=false"}, - expected: auth.AuthenticationConfig{Authentication: "tls", Kerberos: kerb, TLS: tlscfg.Options{Enabled: true}, PlainText: plain}, + expected: auth.AuthenticationConfig{Authentication: "tls", Kerberos: kerb, TLS: configtls.ClientConfig{}, PlainText: plain}, }, } diff --git a/proto-gen/.gitignore b/proto-gen/.gitignore new file mode 100644 index 00000000000..53c89564813 --- /dev/null +++ b/proto-gen/.gitignore @@ -0,0 +1 @@ +.patched/ diff --git a/proto-gen/api_v2/query.pb.go b/proto-gen/api_v2/query.pb.go index 1a2584bf6c7..f9bbee7313f 100644 --- a/proto-gen/api_v2/query.pb.go +++ b/proto-gen/api_v2/query.pb.go @@ -142,12 +142,12 @@ func (m *SpansResponseChunk) GetSpans() []model.Span { type ArchiveTraceRequest 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"` // Optional. The start time to search trace ID. - StartTime *time.Time `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time,omitempty"` + StartTime time.Time `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time"` // Optional. The end time to search trace ID. - EndTime *time.Time `protobuf:"bytes,3,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + EndTime time.Time `protobuf:"bytes,3,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *ArchiveTraceRequest) Reset() { *m = ArchiveTraceRequest{} } @@ -183,18 +183,18 @@ func (m *ArchiveTraceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_ArchiveTraceRequest proto.InternalMessageInfo -func (m *ArchiveTraceRequest) GetStartTime() *time.Time { +func (m *ArchiveTraceRequest) GetStartTime() time.Time { if m != nil { return m.StartTime } - return nil + return time.Time{} } -func (m *ArchiveTraceRequest) GetEndTime() *time.Time { +func (m *ArchiveTraceRequest) GetEndTime() time.Time { if m != nil { return m.EndTime } - return nil + return time.Time{} } type ArchiveTraceResponse struct { @@ -771,69 +771,68 @@ func init() { func init() { proto.RegisterFile("query.proto", fileDescriptor_5c6ac9b241082464) } var fileDescriptor_5c6ac9b241082464 = []byte{ - // 986 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x4f, 0x73, 0xdb, 0x44, - 0x14, 0x47, 0x8e, 0x1d, 0xdb, 0x4f, 0x76, 0x4b, 0xd7, 0x4e, 0x2b, 0x54, 0xb0, 0x1d, 0x85, 0x76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30, 0xa0, 0x9e, 0xe8, 0x57, 0x9c, 0x30, 0xe6, 0x1d, 0xa8, 0x88, 0x3d, 0x29, 0x20, 0xf4, - 0xfe, 0xc6, 0x0b, 0x34, 0xd7, 0x95, 0x16, 0x56, 0x1b, 0xd0, 0x80, 0xb0, 0xa7, 0x72, 0x9e, 0x12, - 0x40, 0xeb, 0x4d, 0x68, 0xe5, 0xa4, 0x72, 0x4c, 0x91, 0x09, 0x35, 0x35, 0x79, 0x92, 0xe5, 0x75, - 0x37, 0x3d, 0x5b, 0x8f, 0xa1, 0x3d, 0x20, 0xec, 0xe3, 0x64, 0xe6, 0xd2, 0xd8, 0x0c, 0xa8, 0x2a, - 0x1d, 0x95, 0x60, 0x72, 0x44, 0xd7, 0xa1, 0xce, 0x17, 0xc1, 0x70, 0x12, 0x50, 0x4f, 0x25, 0x5a, - 0xe3, 0x82, 0x0f, 0x03, 0xea, 0x59, 0xef, 0x41, 0x3d, 0xc5, 0x42, 0x08, 0xca, 0x99, 0xe9, 0x17, - 0xdf, 0x67, 0x5b, 0x2f, 0x60, 0xad, 0x10, 0x8c, 0xca, 0xe0, 0x66, 0x86, 0x2c, 0x9c, 0x16, 0x49, - 0x1e, 0x05, 0x29, 0xba, 0x0d, 0x90, 0x4a, 0x62, 0xa3, 0x24, 0x38, 0x63, 0x14, 0xca, 0x9a, 0xc2, - 0xbb, 0x19, 0x5d, 0xeb, 0x47, 0x0d, 0xae, 0x0e, 0x08, 0xdb, 0x21, 0x33, 0x42, 0x3d, 0x42, 0x47, - 0xc1, 0x49, 0x9b, 0xf2, 0xdb, 0x5b, 0xfb, 0xef, 0xdb, 0xbb, 0x74, 0x91, 0xed, 0xbd, 0x07, 0xd7, - 0x96, 0xe2, 0x53, 0xd5, 0x19, 0x40, 0xc3, 0xcb, 0xc8, 0xd5, 0x26, 0x7f, 0xad, 0x90, 0x77, 0x6a, - 0xba, 0xf8, 0x28, 0xa0, 0x13, 0xb5, 0xd3, 0x73, 0x86, 0xfd, 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 0x3f, 0xee, 0x68, 0xbf, 0x1c, 0x77, 0xb4, 0x3f, 0x8e, 0x3b, 0x1a, 0x5c, 0x0b, 0x42, 0x3b, 0xf7, - 0xf7, 0x42, 0xa1, 0x7e, 0xb6, 0x2a, 0x7f, 0xf7, 0x56, 0x05, 0xd3, 0xde, 0xfa, 0x27, 0x00, 0x00, - 0xff, 0xff, 0xe1, 0xcd, 0xd3, 0x44, 0x9e, 0x0a, 0x00, 0x00, + // 971 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0x67, 0x9d, 0x38, 0xb6, 0xdf, 0xda, 0x2d, 0x7d, 0x76, 0xda, 0x65, 0x0b, 0xb6, 0xb3, 0xa1, + 0x55, 0x84, 0x94, 0xdd, 0x62, 0x0e, 0x94, 0x0a, 0x09, 0x9a, 0xa6, 0xb5, 0x0a, 0xb4, 0xc0, 0x36, + 0x27, 0x38, 0x58, 0x13, 0xef, 0xb0, 0x5e, 0x1c, 0xcf, 0xba, 0xbb, 0xe3, 0x10, 0x0b, 0x71, 0xe1, + 0x13, 0x20, 0x71, 0xe1, 0xc4, 0x95, 0x13, 0xdf, 0xa3, 0x47, 0x24, 0x6e, 0x1c, 0x02, 0x8a, 0xf8, + 0x08, 0x1c, 0x38, 0xa2, 0xf9, 0xb3, 0x8e, 0xbd, 0x8e, 0x42, 0x1b, 0x8e, 0x9c, 0xbc, 0xf3, 0xe6, + 0xbd, 0xdf, 0xfb, 0xfb, 0x7b, 0x63, 0x30, 0x9f, 0x4e, 0x68, 0x32, 0x75, 0xc7, 0x49, 0xcc, 0x63, + 0xac, 0x7d, 0x49, 0x68, 0x48, 0x13, 0x97, 0x8c, 0xa3, 0xde, 0x61, 0xc7, 0x36, 0x47, 0x71, 0x40, + 0x0f, 0xd4, 0x9d, 0xdd, 0x08, 0xe3, 0x30, 0x96, 0x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 0x1c, 0xb3, 0x94, + 0xde, 0x1b, 0x4c, 0xd8, 0x10, 0x3d, 0x28, 0xa6, 0x42, 0x6a, 0x19, 0xed, 0x95, 0x2d, 0xb3, 0x53, + 0x77, 0x17, 0xba, 0xe5, 0x0a, 0x8b, 0x9d, 0x55, 0x01, 0xe6, 0x2b, 0x3d, 0xe7, 0x6f, 0x03, 0xea, + 0x77, 0x93, 0xfe, 0x20, 0x3a, 0xa4, 0xff, 0xb7, 0x0a, 0x5e, 0x85, 0xc6, 0x62, 0xe6, 0xaa, 0x90, + 0xce, 0x4f, 0xab, 0xd0, 0x90, 0x92, 0x4f, 0xc5, 0xd8, 0x7f, 0x42, 0x12, 0x32, 0xa2, 0x9c, 0x26, + 0x29, 0x6e, 0x40, 0x35, 0xa5, 0xc9, 0x61, 0xd4, 0xa7, 0x3d, 0x46, 0x46, 0x54, 0xd6, 0xa5, 0xe2, + 0x9b, 0x5a, 0xf6, 0x98, 0x8c, 0x28, 0xde, 0x80, 0x4b, 0xf1, 0x98, 0xaa, 0xf9, 0x54, 0x4a, 0x05, + 0xa9, 0x54, 0x9b, 0x49, 0xa5, 0xda, 0x5d, 0x58, 0xe5, 0x24, 0x4c, 0xad, 0x15, 0xd9, 0xa5, 0xed, + 0x5c, 0x97, 0xce, 0x72, 0xee, 0xee, 0x91, 0x30, 0xbd, 0xcf, 0x78, 0x32, 0xf5, 0xa5, 0x29, 0x7e, + 0x00, 0x97, 0x4e, 0x6b, 0xd8, 0x1b, 0x45, 0xcc, 0x5a, 0x7d, 0x81, 0x22, 0x54, 0x67, 0x75, 0x7c, + 0x14, 0xb1, 0x3c, 0x16, 0x39, 0xb2, 0x8a, 0x17, 0xc3, 0x22, 0x47, 0xf8, 0x00, 0xaa, 0x19, 0x41, + 0x65, 0x54, 0x6b, 0x12, 0xe9, 0x95, 0x25, 0xa4, 0x5d, 0xad, 0xa4, 0x80, 0x7e, 0x10, 0x40, 0x66, + 0x66, 0x28, 0x62, 0x5a, 0xc0, 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xe7, 0x76, 0x45, 0xfa, 0x32, 0xb1, 0xe2, 0x65, 0x94, 0xc6, 0x18, 0x6a, 0x0b, 0x2c, 0xc2, 0xcd, + 0x65, 0x9c, 0x25, 0xc2, 0xdb, 0xaf, 0x9f, 0xaf, 0xa4, 0xdd, 0xd5, 0xa5, 0xbb, 0x1a, 0x9a, 0xde, + 0x29, 0x77, 0xf0, 0x2b, 0xf9, 0xb7, 0x6a, 0x7e, 0x34, 0xf1, 0xc6, 0x32, 0xda, 0x19, 0xd4, 0xb2, + 0x6f, 0xfe, 0x9b, 0x9a, 0x76, 0xbb, 0x2e, 0xdd, 0x5e, 0xc6, 0x9a, 0x37, 0x3f, 0xaf, 0x3b, 0xdb, + 0xcf, 0x4e, 0x9a, 0xc6, 0x2f, 0x27, 0x4d, 0xe3, 0x8f, 0x93, 0xa6, 0x01, 0xd7, 0xa2, 0xd8, 0x5d, + 0xf8, 0x9b, 0xa1, 0x51, 0x3f, 0x5b, 0x53, 0xbf, 0xfb, 0x6b, 0x92, 0x69, 0x6f, 0xfd, 0x13, 0x00, + 0x00, 0xff, 0xff, 0x66, 0xd6, 0x53, 0xfb, 0xa6, 0x0a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1269,26 +1268,22 @@ func (m *ArchiveTraceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if m.EndTime != nil { - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndTime):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintQuery(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x1a + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime):]) + if err3 != nil { + return 0, err3 } - if m.StartTime != nil { - n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartTime):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintQuery(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x12 + i -= n3 + i = encodeVarintQuery(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x1a + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime):]) + if err4 != nil { + return 0, err4 } + i -= n4 + i = encodeVarintQuery(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x12 { size := m.TraceID.Size() i -= size @@ -1799,14 +1794,10 @@ func (m *ArchiveTraceRequest) Size() (n int) { _ = l l = m.TraceID.Size() n += 1 + l + sovQuery(uint64(l)) - if m.StartTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartTime) - n += 1 + l + sovQuery(uint64(l)) - } - if m.EndTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndTime) - n += 1 + l + sovQuery(uint64(l)) - } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime) + n += 1 + l + sovQuery(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime) + n += 1 + l + sovQuery(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2340,10 +2331,7 @@ func (m *ArchiveTraceRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.StartTime == nil { - m.StartTime = new(time.Time) - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.StartTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.StartTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2376,10 +2364,7 @@ func (m *ArchiveTraceRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.EndTime == nil { - m.EndTime = new(time.Time) - } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.EndTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.EndTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/proto-gen/patch-api-v3.sed b/proto-gen/patch-api-v3.sed new file mode 100644 index 00000000000..6427c8d58b4 --- /dev/null +++ b/proto-gen/patch-api-v3.sed @@ -0,0 +1,20 @@ +s|import "google/protobuf/duration.proto";|import "google/protobuf/duration.proto";\ +\ +import "gogoproto/gogo.proto";\ +\ +option (gogoproto.marshaler_all) = true;\ +option (gogoproto.unmarshaler_all) = true;\ +option (gogoproto.sizer_all) = true;\ +|g + +s|google.protobuf.Timestamp \(.*\);|google.protobuf.Timestamp \1 \ + [\ + (gogoproto.nullable) = false,\ + (gogoproto.stdtime) = true\ + ];|g + +s|google.protobuf.Duration \(.*\);|google.protobuf.Duration \1 \ + [\ + (gogoproto.nullable) = false,\ + (gogoproto.stdduration) = true\ + ];|g diff --git a/proto-gen/storage_v1/storage.pb.go b/proto-gen/storage_v1/storage.pb.go index 5564abb7ed4..72e11ee49ce 100644 --- a/proto-gen/storage_v1/storage.pb.go +++ b/proto-gen/storage_v1/storage.pb.go @@ -304,6 +304,8 @@ var xxx_messageInfo_CloseWriterResponse proto.InternalMessageInfo 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"` + StartTime time.Time `protobuf:"bytes,2,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time"` + EndTime time.Time `protobuf:"bytes,3,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -342,6 +344,20 @@ func (m *GetTraceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_GetTraceRequest proto.InternalMessageInfo +func (m *GetTraceRequest) GetStartTime() time.Time { + if m != nil { + return m.StartTime + } + return time.Time{} +} + +func (m *GetTraceRequest) GetEndTime() time.Time { + if m != nil { + return m.EndTime + } + return time.Time{} +} + type GetServicesRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1006,77 +1022,78 @@ func init() { func init() { proto.RegisterFile("storage.proto", fileDescriptor_0d2c4ccf1453ffdb) } var fileDescriptor_0d2c4ccf1453ffdb = []byte{ - // 1117 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x6f, 0xdc, 0xc4, - 0x1b, 0xfe, 0x39, 0xd9, 0x6d, 0x76, 0xdf, 0xdd, 0xb4, 0xc9, 0xec, 0xf6, 0x57, 0xd7, 0xd0, 0x24, - 0x18, 0x9a, 0x04, 0x04, 0xde, 0x66, 0x39, 0x80, 0xa0, 0x08, 0x9a, 0x3f, 0x8d, 0x02, 0x14, 0x8a, - 0x13, 0xb5, 0x12, 0x85, 0xac, 0x66, 0xe3, 0xc1, 0x19, 0xb2, 0x1e, 0x6f, 0xed, 0xf1, 0x2a, 0x11, - 0xe2, 0xc6, 0x07, 0xe0, 0xc8, 0x89, 0x13, 0x12, 0xdf, 0x83, 0x53, 0x8f, 0x9c, 0x39, 0x04, 0x94, - 0x2b, 0x5f, 0x02, 0x79, 0x66, 0xec, 0xd8, 0x6b, 0x2b, 0x49, 0xa3, 0xdc, 0x3c, 0xef, 0x3c, 0xf3, - 0xbc, 0xff, 0x66, 0x9e, 0xd7, 0x30, 0x1d, 0x72, 0x3f, 0xc0, 0x2e, 0xb1, 0x86, 0x81, 0xcf, 0x7d, - 0x34, 0xfb, 0x3d, 0x26, 0x2e, 0x09, 0xac, 0xc4, 0x3a, 0x5a, 0x31, 0xda, 0xae, 0xef, 0xfa, 0x62, - 0xb7, 0x13, 0x7f, 0x49, 0xa0, 0x31, 0xef, 0xfa, 0xbe, 0x3b, 0x20, 0x1d, 0xb1, 0xea, 0x47, 0xdf, - 0x75, 0x38, 0xf5, 0x48, 0xc8, 0xb1, 0x37, 0x54, 0x80, 0xb9, 0x71, 0x80, 0x13, 0x05, 0x98, 0x53, - 0x9f, 0xa9, 0xfd, 0x86, 0xe7, 0x3b, 0x64, 0x20, 0x17, 0xe6, 0xaf, 0x1a, 0xfc, 0x7f, 0x93, 0xf0, - 0x75, 0x32, 0x24, 0xcc, 0x21, 0x6c, 0x8f, 0x92, 0xd0, 0x26, 0xcf, 0x23, 0x12, 0x72, 0xb4, 0x06, - 0x10, 0x72, 0x1c, 0xf0, 0x5e, 0xec, 0x40, 0xd7, 0x16, 0xb4, 0xe5, 0x46, 0xd7, 0xb0, 0x24, 0xb9, - 0x95, 0x90, 0x5b, 0x3b, 0x89, 0xf7, 0xd5, 0xda, 0x8b, 0xe3, 0xf9, 0xff, 0xfd, 0xfc, 0xf7, 0xbc, - 0x66, 0xd7, 0xc5, 0xb9, 0x78, 0x07, 0x7d, 0x0c, 0x35, 0xc2, 0x1c, 0x49, 0x31, 0xf1, 0x12, 0x14, - 0x53, 0x84, 0x39, 0xb1, 0xdd, 0xec, 0xc3, 0xad, 0x42, 0x7c, 0xe1, 0xd0, 0x67, 0x21, 0x41, 0x9b, - 0xd0, 0x74, 0x32, 0x76, 0x5d, 0x5b, 0x98, 0x5c, 0x6e, 0x74, 0xef, 0x58, 0xaa, 0x92, 0x78, 0x48, - 0x7b, 0xa3, 0xae, 0x95, 0x1e, 0x3d, 0xfa, 0x9c, 0xb2, 0x83, 0xd5, 0x4a, 0xec, 0xc2, 0xce, 0x1d, - 0x34, 0x3f, 0x84, 0x99, 0xa7, 0x01, 0xe5, 0x64, 0x7b, 0x88, 0x59, 0x92, 0xf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x57, 0x7f, 0xe9, 0xba, 0x3f, 0x69, 0xa0, 0xe7, 0xff, 0x8d, 0x33, 0xce, - 0xf7, 0x85, 0xf3, 0xec, 0x36, 0x7a, 0xb3, 0xdc, 0x79, 0xc9, 0xef, 0xbf, 0xf1, 0xd6, 0x45, 0xa0, - 0xaa, 0x02, 0x11, 0x20, 0xe9, 0x33, 0xab, 0xab, 0x71, 0xcb, 0x73, 0xeb, 0x52, 0xd1, 0x28, 0x0a, - 0x74, 0x69, 0xcb, 0xcb, 0x04, 0x7b, 0x55, 0x7f, 0x71, 0x32, 0xa7, 0xfd, 0x79, 0x32, 0xa7, 0xfd, - 0x73, 0x32, 0xa7, 0x7d, 0x0d, 0x0a, 0xde, 0x1b, 0xad, 0xf4, 0xaf, 0x89, 0x29, 0xff, 0xee, 0x7f, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x6c, 0xa3, 0xc0, 0x72, 0x65, 0x0d, 0x00, 0x00, + // 1128 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4f, 0x73, 0xdb, 0x44, + 0x14, 0x47, 0xb1, 0xdd, 0xd8, 0xcf, 0x4e, 0x9b, 0xac, 0x5d, 0xaa, 0x0a, 0x9a, 0x04, 0x41, 0x93, + 0xc0, 0x80, 0xdc, 0x98, 0x03, 0x0c, 0x94, 0x81, 0xe6, 0x4f, 0x33, 0x01, 0x0a, 0x45, 0xc9, 0xb4, + 0x33, 0x14, 0xe2, 0x59, 0x47, 0x8b, 0x22, 0x62, 0xad, 0x5c, 0x69, 0xe5, 0x49, 0x86, 0xe1, 0xc6, + 0x07, 0xe0, 0xc8, 0x89, 0x13, 0x33, 0x7c, 0x0f, 0x4e, 0x3d, 0x72, 0xe6, 0x10, 0x98, 0x5c, 0xb9, + 0xf2, 0x01, 0x18, 0xed, 0xae, 0x14, 0xfd, 0x9b, 0x24, 0x4d, 0x73, 0xf3, 0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xd3, 0xe8, 0x4f, 0x66, 0x8f, 0xb6, 0x78, 0x26, + 0x4e, 0xb6, 0xda, 0x01, 0xdc, 0xb8, 0x97, 0x7f, 0x76, 0xb2, 0xe6, 0xdf, 0xca, 0xcf, 0xcc, 0x94, + 0xfe, 0x12, 0x3b, 0xad, 0x77, 0x98, 0xb1, 0x9c, 0xe9, 0xb6, 0x1d, 0xfe, 0x81, 0x29, 0xb5, 0x97, + 0xdf, 0x74, 0xbd, 0x9f, 0x14, 0x50, 0xb3, 0x9f, 0xe8, 0x29, 0xe3, 0x7b, 0xdc, 0x78, 0x5a, 0x8d, + 0xde, 0x2c, 0x37, 0x5e, 0xf2, 0x2f, 0x44, 0x7b, 0xeb, 0x3c, 0x50, 0x99, 0x81, 0x10, 0x90, 0xb0, + 0x99, 0x9e, 0xab, 0x51, 0xc9, 0x33, 0xe7, 0xd2, 0xa1, 0x51, 0x1c, 0xd0, 0xa5, 0x25, 0x2f, 0x1b, + 0xd8, 0x2b, 0xea, 0xb3, 0xe3, 0x59, 0xe5, 0xcf, 0xe3, 0x59, 0xe5, 0x9f, 0xe3, 0x59, 0xe5, 0x6b, + 0x90, 0xf0, 0xfe, 0x78, 0x79, 0x70, 0x85, 0x6f, 0xf9, 0x77, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, + 0x4d, 0x42, 0xc0, 0x41, 0xec, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2125,6 +2142,22 @@ func (m *GetTraceRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.EndTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintStorage(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x1a + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintStorage(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x12 { size := m.TraceID.Size() i -= size @@ -2362,37 +2395,37 @@ func (m *TraceQueryParameters) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x40 } - n4, err4 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DurationMax, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMax):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintStorage(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x3a - n5, err5 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DurationMin, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMin):]) - if err5 != nil { - return 0, err5 - } - i -= n5 - i = encodeVarintStorage(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0x32 - n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTimeMax, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMax):]) + n6, err6 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DurationMax, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMax):]) if err6 != nil { return 0, err6 } i -= n6 i = encodeVarintStorage(dAtA, i, uint64(n6)) i-- - dAtA[i] = 0x2a - n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTimeMin, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMin):]) + dAtA[i] = 0x3a + n7, err7 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.DurationMin, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.DurationMin):]) if err7 != nil { return 0, err7 } i -= n7 i = encodeVarintStorage(dAtA, i, uint64(n7)) i-- + dAtA[i] = 0x32 + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTimeMax, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMax):]) + if err8 != nil { + return 0, err8 + } + i -= n8 + i = encodeVarintStorage(dAtA, i, uint64(n8)) + i-- + dAtA[i] = 0x2a + n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.StartTimeMin, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTimeMin):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintStorage(dAtA, i, uint64(n9)) + i-- dAtA[i] = 0x22 if len(m.Tags) > 0 { for k := range m.Tags { @@ -2779,6 +2812,10 @@ func (m *GetTraceRequest) Size() (n int) { _ = l l = m.TraceID.Size() n += 1 + l + sovStorage(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.StartTime) + n += 1 + l + sovStorage(uint64(l)) + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.EndTime) + n += 1 + l + sovStorage(uint64(l)) if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -3529,6 +3566,72 @@ func (m *GetTraceRequest) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartTime", 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 < 0 { + return ErrInvalidLengthStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.StartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndTime", 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 < 0 { + return ErrInvalidLengthStorage + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.EndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipStorage(dAtA[iNdEx:]) diff --git a/scripts/compare_metrics.py b/scripts/compare_metrics.py deleted file mode 100755 index 36fe190d592..00000000000 --- a/scripts/compare_metrics.py +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (c) 2024 The Jaeger Authors. -# SPDX-License-Identifier: Apache-2.0 - -import json - -v1_metrics_path = "./V1_Metrics.json" -v2_metrics_path = "./V2_Metrics.json" - -with open(v1_metrics_path, 'r') as file: - v1_metrics = json.load(file) - -with open(v2_metrics_path, 'r') as file: - v2_metrics = json.load(file) - -# Extract names and labels of the metrics -def extract_metrics_with_labels(metrics, strip_prefix=None): - result = {} - for metric in metrics: - name = metric['name'] - if strip_prefix and name.startswith(strip_prefix): - name = name[len(strip_prefix):] - labels = {} - if 'metrics' in metric and 'labels' in metric['metrics'][0]: - labels = metric['metrics'][0]['labels'] - result[name] = labels - return result - - -v1_metrics_with_labels = extract_metrics_with_labels(v1_metrics) -v2_metrics_with_labels = extract_metrics_with_labels( - v2_metrics, strip_prefix="otelcol_") - -# Compare the metrics names and labels -common_metrics = {} -v1_only_metrics = {} -v2_only_metrics = {} - -for name, labels in v1_metrics_with_labels.items(): - if name in v2_metrics_with_labels: - common_metrics[name] = labels - elif not name.startswith("jaeger_agent"): - v1_only_metrics[name] = labels - -for name, labels in v2_metrics_with_labels.items(): - if name not in v1_metrics_with_labels: - v2_only_metrics[name] = labels - -differences = { - "common_metrics": common_metrics, - "v1_only_metrics": v1_only_metrics, - "v2_only_metrics": v2_only_metrics -} - -# Write the differences to a new JSON file -differences_path = "./differences.json" -with open(differences_path, 'w') as file: - json.dump(differences, file, indent=4) - -print(f"Differences written to {differences_path}") diff --git a/scripts/utils/compare_metrics.py b/scripts/utils/compare_metrics.py new file mode 100755 index 00000000000..390f2b7d470 --- /dev/null +++ b/scripts/utils/compare_metrics.py @@ -0,0 +1,130 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + +import json +import argparse +import subprocess + +#Instructions of use: + +# To generate V1_Metrics.json and V2_Metrics.json, run the following commands: +# i.e for elastic search first run the following command: +# docker compose -f docker-compose/elasticsearch/v7/docker-compose.yml up +# 1. Generate V1_Metrics.json and V2_Metrics.json by the following commands: +# V1 binary cmd: SPAN_STORAGE_TYPE=elasticsearch go run -tags=ui ./cmd/all-in-one +# extract the metrics by running the following command: +# prom2json http://localhost:14269/metrics > V1_Metrics.json +# Stop the v1 binary and for v2 binary run the following command: +# go run -tags ui ./cmd/jaeger/main.go --config ./cmd/jaeger/config-elasticsearch.yaml +# extract the metrics by running the following command: +# prom2json http://localhost:8888/metrics > V2_Metrics.json +# it is first recomended to generate the differences for all-in-one.json by running the following command: +# python3 compare_metrics.py --out md --is_storage F +# rename that file to all_in_one.json and use it to filter out the overlapping metrics by using the is_storage falg to T +# 2. Run the script with the following command: +# python3 compare_metrics.py --out {json or md} --is_storage {T or F} +# 3. The script will compare the metrics in V1_Metrics.json and V2_Metrics.json and output the differences to differences.json + + +# Extract names and labels of the metrics +def extract_metrics_with_labels(metrics, strip_prefix=None): + result = {} + for metric in metrics: + + name = metric['name'] + print(name) + if strip_prefix and name.startswith(strip_prefix): + name = name[len(strip_prefix):] + labels = {} + if 'metrics' in metric and 'labels' in metric['metrics'][0]: + labels = metric['metrics'][0]['labels'] + result[name] = labels + return result + +def remove_overlapping_metrics(all_in_one_data, other_json_data): + """Remove overlapping metrics found in all_in-one.json from another JSON.""" + # Loop through v1 and v2 metrics to remove overlaps + for metric_category in ['common_metrics', 'v1_only_metrics', 'v2_only_metrics']: + if metric_category in all_in_one_data and metric_category in other_json_data: + for metric in all_in_one_data[metric_category]: + if metric in other_json_data[metric_category]: + del other_json_data[metric_category][metric] + + return other_json_data + + +# Your current compare_metrics.py logic goes here +def main(): + parser = argparse.ArgumentParser(description='Compare metrics and output format.') + parser.add_argument('--out', choices=['json', 'md'], default='json', + help='Output format: json (default) or md') + parser.add_argument('--is_storage', choices=['T','F'],default='F', help='Remove overlapping storage metrics') + # Parse the arguments + args = parser.parse_args() + + # Call your existing compare logic here + print("Running metric comparison...") + v1_metrics_path = "" #Add the path to the V1_Metrics.json file + v2_metrics_path = "" #Add the path to the V2_Metrics.json file + + with open(v1_metrics_path, 'r') as file: + v1_metrics = json.load(file) + + with open(v2_metrics_path, 'r') as file: + v2_metrics = json.load(file) + + v1_metrics_with_labels = extract_metrics_with_labels(v1_metrics) + v2_metrics_with_labels = extract_metrics_with_labels( + v2_metrics, strip_prefix="otelcol_") + + # Compare the metrics names and labels + common_metrics = {} + v1_only_metrics = {} + v2_only_metrics = {} + + for name, labels in v1_metrics_with_labels.items(): + if name in v2_metrics_with_labels: + common_metrics[name] = labels + elif not name.startswith("jaeger_agent"): + v1_only_metrics[name] = labels + + for name, labels in v2_metrics_with_labels.items(): + if name not in v1_metrics_with_labels: + v2_only_metrics[name] = labels + + differences = { + "common_metrics": common_metrics, + "v1_only_metrics": v1_only_metrics, + "v2_only_metrics": v2_only_metrics, + } + + #Write the differences to a new JSON file + differences_path = "./differences.json" + with open(differences_path, 'w') as file: + json.dump(differences, file, indent=4) + + print(f"Differences written to {differences_path}") + if args.is_storage == 'T': + all_in_one_path = "" #Add the path to the all_in_one.json file + with open(all_in_one_path, 'r') as file: + all_in_one_data = json.load(file) + with open(differences_path, 'r') as file: + other_json_data = json.load(file) + other_json_data = remove_overlapping_metrics(all_in_one_data, other_json_data) + with open(differences_path, 'w') as file: + json.dump(other_json_data, file, indent=4) + print(f"Overlapping storage metrics removed from {differences_path}") + # If the user requested markdown output, run metrics_md.py + if args.out == 'md': + try: + print("Running metrics_md.py to generate markdown output...") + subprocess.run(['python3', 'metrics-md.py'], check=True) + except subprocess.CalledProcessError as e: + print(f"Error running metrics_md.py: {e}") + + # If json output is requested or no output type is provided (default is json) + else: + print("Output in JSON format.") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/scripts/utils/metrics-md.py b/scripts/utils/metrics-md.py new file mode 100644 index 00000000000..2b158697257 --- /dev/null +++ b/scripts/utils/metrics-md.py @@ -0,0 +1,117 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + +import json + + +def generate_spans_markdown_table(v1_spans, v2_spans): + """ + Generates a markdown table specifically for spans metrics with two main columns V1 and V2. + + Args: + v1_spans (dict): The dictionary of V1 spans metrics. + v2_spans (dict): The dictionary of V2 spans metrics. + + Returns: + str: The generated markdown table as a string. + """ + table = "### Equivalent Metrics\n\n" + table += "| V1 Metric | V1 Parameters | V2 Metric | V2 Parameters |\n" + table += "|-----------|---------------|-----------|---------------|\n" + + + # Iterate through the metrics using zip_longest to handle mismatched lengths + from itertools import zip_longest + + for (v1_metric, v1_params), (v2_metric, v2_params) in zip_longest(v1_spans.items(), v2_spans.items(), fillvalue=('', {})): + v1_inner_keys = ', '.join(v1_params.keys()) if v1_params else '' + v2_inner_keys = ', '.join(v2_params.keys()) if v2_params else '' + table += f"| {v1_metric} | {v1_inner_keys} | {v2_metric} | {v2_inner_keys} |\n" + + return table + + + +def generate_combined_markdown_table(common_metrics, v1_metrics, v2_metrics): + """ + Generates a markdown table for combined metrics from common, V1, and V2. + + Args: + common_metrics (dict): The dictionary of common metrics. + v1_metrics (dict): The dictionary of V1 only metrics. + v2_metrics (dict): The dictionary of V2 only metrics. + + Returns: + str: The generated markdown table as a string. + """ + table = "### Combined Metrics\n\n" + table += "| V1 Metric | V1 Parameters | V2 Metric | V2 Parameters |\n" + table += "|-----------|---------------|-----------|---------------|\n" + for metric_name, params in common_metrics.items(): + v1_params = ', '.join(common_metrics[metric_name].keys()) if params else 'N/A' + v2_params = ', '.join(common_metrics[metric_name].keys()) if params else 'N/A' + table += f"| {metric_name} | {v1_params} | {metric_name} | {v2_params} |\n" + + # Then, handle V1-only metrics (V2 shows as N/A) + for metric_name, v1_params in v1_metrics.items(): + v1_params_str = ', '.join(v1_params.keys()) if v1_params else 'N/A' + table += f"| {metric_name} | {v1_params_str} | N/A | N/A |\n" + + # Then, handle V2-only metrics (V1 shows as N/A) + for metric_name, v2_params in v2_metrics.items(): + v2_params_str = ', '.join(v2_params.keys()) if v2_params else 'N/A' + table += f"| N/A | N/A | {metric_name} | {v2_params_str} |\n" + + return table + +class ConvertJson: + + def __init__(self, json_fp, h1): + self.fp = json_fp + self.h1 = h1 + self.jdata = self.get_json() + self.mddata = self.format_json_to_md() + + def get_json(self): + with open(self.fp) as f: + res = json.load(f) + return res + + def format_json_to_md(self): + text = f'# {self.h1}\n' + dct = self.jdata + + # Extracting individual metric dictionaries + common_metrics = dct.get("common_metrics", {}) + v1_only_metrics = dct.get("v1_only_metrics", {}) + v2_only_metrics = dct.get("v2_only_metrics", {}) + + # Generate combined table + combined_metrics_table = generate_combined_markdown_table( + common_metrics, v1_only_metrics, v2_only_metrics + ) + + filtered_v1_metrics = { + "jaeger_collector_spans_rejected_total": {"debug": "false", "format": "","svc": "","transport":""}, + "jaeger_build_info": {"build_date": "","revision": ""," version": ""} # Add more metrics as needed + } + + # Hardcoding filtered v2 metrics + filtered_v2_metrics = { + "receiver_refused_spans": {"receiver": "","service_instance_id": "","service_name": "","service_version": "","transport": ""}, + "target_info": {"service_instance_id": "","service_name": "","service_version": ""} # Add more metrics as needed + } + spans_metrics_table = generate_spans_markdown_table(filtered_v1_metrics, filtered_v2_metrics) + text += combined_metrics_table+spans_metrics_table + return text + + def convert_dict_to_md(self, output_fn): + with open(output_fn, 'w') as writer: + writer.writelines(self.mddata) + print('Dict successfully converted to md') + +# Usage +fn = '' # Enter the path of the JSON file generated by compare_metrics.py +title = "TITLE" +converter = ConvertJson(fn, title) +converter.convert_dict_to_md(output_fn='metrics.md') \ No newline at end of file diff --git a/storage/factory.go b/storage/factory.go index f3e8ea7f4af..ca4afe34259 100644 --- a/storage/factory.go +++ b/storage/factory.go @@ -18,6 +18,19 @@ import ( "github.com/jaegertracing/jaeger/storage/spanstore" ) +// BaseFactory is the same as Factory, but without the Initialize method. +// It was a design mistake originally to add Initialize to the Factory interface. +type BaseFactory interface { + // CreateSpanReader creates a spanstore.Reader. + CreateSpanReader() (spanstore.Reader, error) + + // CreateSpanWriter creates a spanstore.Writer. + CreateSpanWriter() (spanstore.Writer, error) + + // CreateDependencyReader creates a dependencystore.Reader. + CreateDependencyReader() (dependencystore.Reader, error) +} + // Factory defines an interface for a factory that can create implementations of different storage components. // Implementations are also encouraged to implement plugin.Configurable interface. // @@ -25,18 +38,10 @@ import ( // // plugin.Configurable type Factory interface { + BaseFactory // Initialize performs internal initialization of the factory, such as opening connections to the backend store. // It is called after all configuration of the factory itself has been done. Initialize(metricsFactory metrics.Factory, logger *zap.Logger) error - - // CreateSpanReader creates a spanstore.Reader. - CreateSpanReader() (spanstore.Reader, error) - - // CreateSpanWriter creates a spanstore.Writer. - CreateSpanWriter() (spanstore.Writer, error) - - // CreateDependencyReader creates a dependencystore.Reader. - CreateDependencyReader() (dependencystore.Reader, error) } // Purger defines an interface that is capable of purging the storage. diff --git a/storage/metricsstore/metrics/decorator.go b/storage/metricsstore/metricstoremetrics/decorator.go similarity index 96% rename from storage/metricsstore/metrics/decorator.go rename to storage/metricsstore/metricstoremetrics/decorator.go index 7491634a8c5..cb62dae8c9e 100644 --- a/storage/metricsstore/metrics/decorator.go +++ b/storage/metricsstore/metricstoremetrics/decorator.go @@ -1,7 +1,7 @@ // Copyright (c) 2022 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package metrics +package metricstoremetrics import ( "context" @@ -39,7 +39,7 @@ func (q *queryMetrics) emit(err error, latency time.Duration) { } // NewReadMetricsDecorator returns a new ReadMetricsDecorator. -func NewReadMetricsDecorator(reader metricsstore.Reader, metricsFactory metrics.Factory) *ReadMetricsDecorator { +func NewReaderDecorator(reader metricsstore.Reader, metricsFactory metrics.Factory) *ReadMetricsDecorator { return &ReadMetricsDecorator{ reader: reader, getLatenciesMetrics: buildQueryMetrics("get_latencies", metricsFactory), diff --git a/storage/metricsstore/metrics/decorator_test.go b/storage/metricsstore/metricstoremetrics/decorator_test.go similarity index 95% rename from storage/metricsstore/metrics/decorator_test.go rename to storage/metricsstore/metricstoremetrics/decorator_test.go index f28d1589be7..16aabc94364 100644 --- a/storage/metricsstore/metrics/decorator_test.go +++ b/storage/metricsstore/metricstoremetrics/decorator_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2022 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package metrics_test +package metricstoremetrics_test import ( "context" @@ -15,7 +15,7 @@ import ( "github.com/jaegertracing/jaeger/pkg/testutils" protometrics "github.com/jaegertracing/jaeger/proto-gen/api_v2/metrics" "github.com/jaegertracing/jaeger/storage/metricsstore" - "github.com/jaegertracing/jaeger/storage/metricsstore/metrics" + "github.com/jaegertracing/jaeger/storage/metricsstore/metricstoremetrics" "github.com/jaegertracing/jaeger/storage/metricsstore/mocks" ) @@ -23,7 +23,7 @@ func TestSuccessfulUnderlyingCalls(t *testing.T) { mf := metricstest.NewFactory(0) mockReader := mocks.Reader{} - mrs := metrics.NewReadMetricsDecorator(&mockReader, mf) + mrs := metricstoremetrics.NewReaderDecorator(&mockReader, mf) glParams := &metricsstore.LatenciesQueryParameters{} mockReader.On("GetLatencies", context.Background(), glParams). Return(&protometrics.MetricFamily{}, nil) @@ -96,7 +96,7 @@ func TestFailingUnderlyingCalls(t *testing.T) { mf := metricstest.NewFactory(0) mockReader := mocks.Reader{} - mrs := metrics.NewReadMetricsDecorator(&mockReader, mf) + mrs := metricstoremetrics.NewReaderDecorator(&mockReader, mf) glParams := &metricsstore.LatenciesQueryParameters{} mockReader.On("GetLatencies", context.Background(), glParams). Return(&protometrics.MetricFamily{}, errors.New("failure")) diff --git a/storage/mocks/BaseFactory.go b/storage/mocks/BaseFactory.go new file mode 100644 index 00000000000..69e391526f7 --- /dev/null +++ b/storage/mocks/BaseFactory.go @@ -0,0 +1,124 @@ +// Copyright (c) The Jaeger Authors. +// SPDX-License-Identifier: Apache-2.0 +// +// Run 'make generate-mocks' to regenerate. + +// Code generated by mockery. DO NOT EDIT. + +package mocks + +import ( + dependencystore "github.com/jaegertracing/jaeger/storage/dependencystore" + mock "github.com/stretchr/testify/mock" + + spanstore "github.com/jaegertracing/jaeger/storage/spanstore" +) + +// BaseFactory is an autogenerated mock type for the BaseFactory type +type BaseFactory struct { + mock.Mock +} + +// CreateDependencyReader provides a mock function with given fields: +func (_m *BaseFactory) CreateDependencyReader() (dependencystore.Reader, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for CreateDependencyReader") + } + + var r0 dependencystore.Reader + var r1 error + if rf, ok := ret.Get(0).(func() (dependencystore.Reader, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() dependencystore.Reader); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(dependencystore.Reader) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CreateSpanReader provides a mock function with given fields: +func (_m *BaseFactory) CreateSpanReader() (spanstore.Reader, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for CreateSpanReader") + } + + var r0 spanstore.Reader + var r1 error + if rf, ok := ret.Get(0).(func() (spanstore.Reader, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() spanstore.Reader); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(spanstore.Reader) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CreateSpanWriter provides a mock function with given fields: +func (_m *BaseFactory) CreateSpanWriter() (spanstore.Writer, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for CreateSpanWriter") + } + + var r0 spanstore.Writer + var r1 error + if rf, ok := ret.Get(0).(func() (spanstore.Writer, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() spanstore.Writer); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(spanstore.Writer) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// NewBaseFactory creates a new instance of BaseFactory. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewBaseFactory(t interface { + mock.TestingT + Cleanup(func()) +}) *BaseFactory { + mock := &BaseFactory{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/storage/spanstore/metrics/package_test.go b/storage/spanstore/spanstoremetrics/package_test.go similarity index 89% rename from storage/spanstore/metrics/package_test.go rename to storage/spanstore/spanstoremetrics/package_test.go index 81295a3e78d..df29173d75d 100644 --- a/storage/spanstore/metrics/package_test.go +++ b/storage/spanstore/spanstoremetrics/package_test.go @@ -1,7 +1,7 @@ // Copyright (c) 2023 The Jaeger Authors. // SPDX-License-Identifier: Apache-2.0 -package metrics +package spanstoremetrics import ( "testing" diff --git a/storage/spanstore/metrics/decorator.go b/storage/spanstore/spanstoremetrics/read_metrics.go similarity index 95% rename from storage/spanstore/metrics/decorator.go rename to storage/spanstore/spanstoremetrics/read_metrics.go index 7b1fdd222bc..0f4ca13d0c0 100644 --- a/storage/spanstore/metrics/decorator.go +++ b/storage/spanstore/spanstoremetrics/read_metrics.go @@ -2,7 +2,7 @@ // Copyright (c) 2017 Uber Technologies, Inc. // SPDX-License-Identifier: Apache-2.0 -package metrics +package spanstoremetrics import ( "context" @@ -42,8 +42,8 @@ func (q *queryMetrics) emit(err error, latency time.Duration, responses int) { } } -// NewReadMetricsDecorator returns a new ReadMetricsDecorator. -func NewReadMetricsDecorator(spanReader spanstore.Reader, metricsFactory metrics.Factory) *ReadMetricsDecorator { +// NewReaderDecorator returns a new ReadMetricsDecorator. +func NewReaderDecorator(spanReader spanstore.Reader, metricsFactory metrics.Factory) *ReadMetricsDecorator { return &ReadMetricsDecorator{ spanReader: spanReader, findTracesMetrics: buildQueryMetrics("find_traces", metricsFactory), diff --git a/storage/spanstore/metrics/decorator_test.go b/storage/spanstore/spanstoremetrics/read_metrics_test.go similarity index 95% rename from storage/spanstore/metrics/decorator_test.go rename to storage/spanstore/spanstoremetrics/read_metrics_test.go index 5fef39cd9ec..8f9c40863b5 100644 --- a/storage/spanstore/metrics/decorator_test.go +++ b/storage/spanstore/spanstoremetrics/read_metrics_test.go @@ -2,7 +2,7 @@ // Copyright (c) 2017 Uber Technologies, Inc. // SPDX-License-Identifier: Apache-2.0 -package metrics_test +package spanstoremetrics_test import ( "context" @@ -14,15 +14,15 @@ import ( "github.com/jaegertracing/jaeger/internal/metricstest" "github.com/jaegertracing/jaeger/model" "github.com/jaegertracing/jaeger/storage/spanstore" - "github.com/jaegertracing/jaeger/storage/spanstore/metrics" "github.com/jaegertracing/jaeger/storage/spanstore/mocks" + "github.com/jaegertracing/jaeger/storage/spanstore/spanstoremetrics" ) func TestSuccessfulUnderlyingCalls(t *testing.T) { mf := metricstest.NewFactory(0) mockReader := mocks.Reader{} - mrs := metrics.NewReadMetricsDecorator(&mockReader, mf) + mrs := spanstoremetrics.NewReaderDecorator(&mockReader, mf) mockReader.On("GetServices", context.Background()).Return([]string{}, nil) mrs.GetServices(context.Background()) operationQuery := spanstore.OperationQueryParameters{ServiceName: "something"} @@ -89,7 +89,7 @@ func TestFailingUnderlyingCalls(t *testing.T) { mf := metricstest.NewFactory(0) mockReader := mocks.Reader{} - mrs := metrics.NewReadMetricsDecorator(&mockReader, mf) + mrs := spanstoremetrics.NewReaderDecorator(&mockReader, mf) mockReader.On("GetServices", context.Background()). Return(nil, errors.New("Failure")) mrs.GetServices(context.Background()) diff --git a/storage/spanstore/metrics/write_metrics.go b/storage/spanstore/spanstoremetrics/write_metrics.go similarity index 85% rename from storage/spanstore/metrics/write_metrics.go rename to storage/spanstore/spanstoremetrics/write_metrics.go index 4a83a2d7759..d08c34576f8 100644 --- a/storage/spanstore/metrics/write_metrics.go +++ b/storage/spanstore/spanstoremetrics/write_metrics.go @@ -2,7 +2,7 @@ // Copyright (c) 2017 Uber Technologies, Inc. // SPDX-License-Identifier: Apache-2.0 -package metrics +package spanstoremetrics import ( "time" @@ -19,8 +19,8 @@ type WriteMetrics struct { LatencyErr metrics.Timer `metric:"latency-err"` } -// NewWriteMetrics takes a metrics scope and creates a metrics struct -func NewWriteMetrics(factory metrics.Factory, tableName string) *WriteMetrics { +// NewWriter takes a metrics scope and creates a metrics struct +func NewWriter(factory metrics.Factory, tableName string) *WriteMetrics { t := &WriteMetrics{} metrics.Init(t, factory.Namespace(metrics.NSOptions{Name: tableName, Tags: nil}), nil) return t diff --git a/storage/spanstore/metrics/write_metrics_test.go b/storage/spanstore/spanstoremetrics/write_metrics_test.go similarity index 95% rename from storage/spanstore/metrics/write_metrics_test.go rename to storage/spanstore/spanstoremetrics/write_metrics_test.go index d84c732a899..2e28283e43e 100644 --- a/storage/spanstore/metrics/write_metrics_test.go +++ b/storage/spanstore/spanstoremetrics/write_metrics_test.go @@ -2,7 +2,7 @@ // Copyright (c) 2017 Uber Technologies, Inc. // SPDX-License-Identifier: Apache-2.0 -package metrics +package spanstoremetrics import ( "errors" @@ -53,7 +53,7 @@ func TestTableEmit(t *testing.T) { } for _, tc := range testCases { mf := metricstest.NewFactory(time.Second) - tm := NewWriteMetrics(mf, "a_table") + tm := NewWriter(mf, "a_table") tm.Emit(tc.err, 50*time.Millisecond) counts, gauges := mf.Snapshot() assert.Equal(t, tc.counts, counts)