From d7f01d1aa0480de7a0c0e33027f8f2a7cb279d4d Mon Sep 17 00:00:00 2001 From: Mahad Zaryab <43658574+mahadzaryab1@users.noreply.github.com> Date: Tue, 24 Sep 2024 21:05:19 -0400 Subject: [PATCH] [jaeger-v2] Refactor Configuration For Query Service (#5998) ## Which problem is this PR solving? - Part of #5996 ## Description of the changes - Reworked the configuration for `jaeger-query` to have more logical groupings. - [Migration document](https://docs.google.com/document/d/1-01QRgMFWbHGXXJqs5cL4kA-P10BfU0TD9Kvp3rEw3M/edit?usp=sharing) ## How was this change tested? - CI ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [x] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: Mahad Zaryab --- cmd/jaeger/config-badger.yaml | 8 +-- cmd/jaeger/config-cassandra.yaml | 8 +-- cmd/jaeger/config-elasticsearch.yaml | 8 +-- cmd/jaeger/config-kafka-ingester.yaml | 3 +- cmd/jaeger/config-opensearch.yaml | 8 +-- cmd/jaeger/config-remote-storage.yaml | 6 ++- .../config-tail-sampling-always-sample.yaml | 3 +- ...fig-tail-sampling-service-name-policy.yaml | 3 +- cmd/jaeger/config.yaml | 8 +-- cmd/jaeger/internal/all-in-one.yaml | 3 +- .../internal/extension/jaegerquery/config.go | 22 +++++--- .../extension/jaegerquery/config_test.go | 6 ++- .../internal/extension/jaegerquery/server.go | 12 ++--- .../extension/jaegerquery/server_test.go | 50 +++++++++++++------ .../internal/integration/e2e_integration.go | 6 ++- cmd/query/app/flags.go | 50 +++++++++---------- cmd/query/app/flags_test.go | 6 +-- cmd/query/app/static_handler.go | 18 +++---- cmd/query/app/static_handler_test.go | 32 +++++++----- docker-compose/monitor/jaeger-v2-config.yml | 5 +- .../tail-sampling/jaeger-v2-config.yml | 3 +- 21 files changed, 160 insertions(+), 108 deletions(-) diff --git a/cmd/jaeger/config-badger.yaml b/cmd/jaeger/config-badger.yaml index 7cbbdccd8bb..3d222bf37bb 100644 --- a/cmd/jaeger/config-badger.yaml +++ b/cmd/jaeger/config-badger.yaml @@ -12,9 +12,11 @@ extensions: http: jaeger_query: - trace_storage: some_store - trace_storage_archive: another_store - ui_config: ./cmd/jaeger/config-ui.json + storage: + traces: some_store + traces_archive: another_store + ui: + config_file: ./cmd/jaeger/config-ui.json jaeger_storage: backends: diff --git a/cmd/jaeger/config-cassandra.yaml b/cmd/jaeger/config-cassandra.yaml index 893b3a1800f..90983141cff 100644 --- a/cmd/jaeger/config-cassandra.yaml +++ b/cmd/jaeger/config-cassandra.yaml @@ -12,9 +12,11 @@ extensions: http: jaeger_query: - trace_storage: some_storage - trace_storage_archive: another_storage - ui_config: ./cmd/jaeger/config-ui.json + storage: + traces: some_storage + traces_archive: another_storage + ui: + config_file: ./cmd/jaeger/config-ui.json jaeger_storage: backends: diff --git a/cmd/jaeger/config-elasticsearch.yaml b/cmd/jaeger/config-elasticsearch.yaml index 42cf78571c6..dbf5c0375bd 100644 --- a/cmd/jaeger/config-elasticsearch.yaml +++ b/cmd/jaeger/config-elasticsearch.yaml @@ -12,9 +12,11 @@ extensions: http: jaeger_query: - trace_storage: some_storage - trace_storage_archive: another_storage - ui_config: ./cmd/jaeger/config-ui.json + storage: + traces: some_storage + traces_archive: another_storage + ui: + config_file: ./cmd/jaeger/config-ui.json jaeger_storage: backends: diff --git a/cmd/jaeger/config-kafka-ingester.yaml b/cmd/jaeger/config-kafka-ingester.yaml index 9adfc308a9c..34412849cb5 100644 --- a/cmd/jaeger/config-kafka-ingester.yaml +++ b/cmd/jaeger/config-kafka-ingester.yaml @@ -19,7 +19,8 @@ extensions: endpoint: 0.0.0.0:14133 jaeger_query: - trace_storage: some_storage + storage: + traces: some_storage jaeger_storage: backends: diff --git a/cmd/jaeger/config-opensearch.yaml b/cmd/jaeger/config-opensearch.yaml index 19be6e941c1..f4d3085179f 100644 --- a/cmd/jaeger/config-opensearch.yaml +++ b/cmd/jaeger/config-opensearch.yaml @@ -12,9 +12,11 @@ extensions: http: jaeger_query: - trace_storage: some_storage - trace_storage_archive: another_storage - ui_config: ./cmd/jaeger/config-ui.json + storage: + traces: some_storage + traces_archive: another_storage + ui: + config_file: ./cmd/jaeger/config-ui.json jaeger_storage: backends: diff --git a/cmd/jaeger/config-remote-storage.yaml b/cmd/jaeger/config-remote-storage.yaml index 7c8b3dd7228..1f5cc699df5 100644 --- a/cmd/jaeger/config-remote-storage.yaml +++ b/cmd/jaeger/config-remote-storage.yaml @@ -12,8 +12,10 @@ extensions: http: jaeger_query: - trace_storage: some-storage - ui_config: ./cmd/jaeger/config-ui.json + storage: + traces: some-storage + ui: + config_file: ./cmd/jaeger/config-ui.json jaeger_storage: backends: diff --git a/cmd/jaeger/config-tail-sampling-always-sample.yaml b/cmd/jaeger/config-tail-sampling-always-sample.yaml index 648950fc4fc..9f0f238f52b 100644 --- a/cmd/jaeger/config-tail-sampling-always-sample.yaml +++ b/cmd/jaeger/config-tail-sampling-always-sample.yaml @@ -14,7 +14,8 @@ extensions: use_v2: true http: jaeger_query: - trace_storage: some_storage + storage: + traces: some_storage jaeger_storage: backends: some_storage: diff --git a/cmd/jaeger/config-tail-sampling-service-name-policy.yaml b/cmd/jaeger/config-tail-sampling-service-name-policy.yaml index fc4abff70af..4b7ffa1fa0a 100644 --- a/cmd/jaeger/config-tail-sampling-service-name-policy.yaml +++ b/cmd/jaeger/config-tail-sampling-service-name-policy.yaml @@ -14,7 +14,8 @@ extensions: use_v2: true http: jaeger_query: - trace_storage: some_storage + storage: + traces: some_storage jaeger_storage: backends: some_storage: diff --git a/cmd/jaeger/config.yaml b/cmd/jaeger/config.yaml index f068e81ef6a..c1615d86460 100644 --- a/cmd/jaeger/config.yaml +++ b/cmd/jaeger/config.yaml @@ -17,9 +17,11 @@ extensions: # endpoint: 0.0.0.0:55679 jaeger_query: - trace_storage: some_store - trace_storage_archive: another_store - ui_config: ./cmd/jaeger/config-ui.json + storage: + traces: some_store + traces_archive: another_store + ui: + config_file: ./cmd/jaeger/config-ui.json jaeger_storage: backends: diff --git a/cmd/jaeger/internal/all-in-one.yaml b/cmd/jaeger/internal/all-in-one.yaml index bc29cabba9e..bc5433b67c5 100644 --- a/cmd/jaeger/internal/all-in-one.yaml +++ b/cmd/jaeger/internal/all-in-one.yaml @@ -16,7 +16,8 @@ service: extensions: jaeger_query: - trace_storage: some_storage + storage: + traces: some_storage jaeger_storage: backends: diff --git a/cmd/jaeger/internal/extension/jaegerquery/config.go b/cmd/jaeger/internal/extension/jaegerquery/config.go index 9abaf0c1a64..926fe225230 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/config.go +++ b/cmd/jaeger/internal/extension/jaegerquery/config.go @@ -10,7 +10,6 @@ import ( "go.opentelemetry.io/collector/config/confighttp" queryApp "github.com/jaegertracing/jaeger/cmd/query/app" - "github.com/jaegertracing/jaeger/pkg/tenancy" ) var _ component.ConfigValidator = (*Config)(nil) @@ -18,12 +17,21 @@ var _ component.ConfigValidator = (*Config)(nil) // Config represents the configuration for jaeger-query, type Config struct { queryApp.QueryOptionsBase `mapstructure:",squash"` - TraceStoragePrimary string `valid:"required" mapstructure:"trace_storage"` - TraceStorageArchive string `valid:"optional" mapstructure:"trace_storage_archive"` - MetricStorage string `valid:"optional" mapstructure:"metric_storage"` - HTTP confighttp.ServerConfig `mapstructure:",squash"` - GRPC configgrpc.ServerConfig `mapstructure:",squash"` - Tenancy tenancy.Options `mapstructure:"multi_tenancy"` + // Storage holds configuration related to the various data stores that are to be queried. + Storage Storage `mapstructure:"storage"` + // HTTP holds the HTTP configuration that the query service uses to serve requests. + HTTP confighttp.ServerConfig `mapstructure:"http"` + // GRPC holds the GRPC configuration that the query service uses to serve requests. + GRPC configgrpc.ServerConfig `mapstructure:"grpc"` +} + +type Storage struct { + // TracesPrimary contains the name of the primary trace storage that is being queried. + TracesPrimary string `mapstructure:"traces" valid:"required"` + // TracesArchive contains the name of the archive trace storage that is being queried. + TracesArchive string `mapstructure:"traces_archive" valid:"optional"` + // Metrics contains the name of the metric storage that is being queried. + Metrics string `mapstructure:"metrics" valid:"optional"` } func (cfg *Config) Validate() error { diff --git a/cmd/jaeger/internal/extension/jaegerquery/config_test.go b/cmd/jaeger/internal/extension/jaegerquery/config_test.go index 94911971e32..249605e0380 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/config_test.go +++ b/cmd/jaeger/internal/extension/jaegerquery/config_test.go @@ -19,12 +19,14 @@ func Test_Validate(t *testing.T) { { name: "Empty config", config: &Config{}, - expectedErr: "TraceStoragePrimary: non zero value required", + expectedErr: "Storage.TracesPrimary: non zero value required", }, { name: "Non empty-config", config: &Config{ - TraceStoragePrimary: "some-storage", + Storage: Storage{ + TracesPrimary: "some-storage", + }, }, expectedErr: "", }, diff --git a/cmd/jaeger/internal/extension/jaegerquery/server.go b/cmd/jaeger/internal/extension/jaegerquery/server.go index d11ab1d593f..729308f0f10 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server.go @@ -55,9 +55,9 @@ func (s *server) Start(_ context.Context, host component.Host) error { mf := otelmetrics.NewFactory(s.telset.MeterProvider) baseFactory := mf.Namespace(metrics.NSOptions{Name: "jaeger"}) queryMetricsFactory := baseFactory.Namespace(metrics.NSOptions{Name: "query"}) - f, err := jaegerstorage.GetStorageFactory(s.config.TraceStoragePrimary, host) + f, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesPrimary, host) if err != nil { - return fmt.Errorf("cannot find primary storage %s: %w", s.config.TraceStoragePrimary, err) + return fmt.Errorf("cannot find primary storage %s: %w", s.config.Storage.TracesPrimary, err) } spanReader, err := f.CreateSpanReader() @@ -124,12 +124,12 @@ func (s *server) Start(_ context.Context, host component.Host) error { } func (s *server) addArchiveStorage(opts *querysvc.QueryServiceOptions, host component.Host) error { - if s.config.TraceStorageArchive == "" { + if s.config.Storage.TracesArchive == "" { s.telset.Logger.Info("Archive storage not configured") return nil } - f, err := jaegerstorage.GetStorageFactory(s.config.TraceStorageArchive, host) + f, err := jaegerstorage.GetStorageFactory(s.config.Storage.TracesArchive, host) if err != nil { return fmt.Errorf("cannot find archive storage factory: %w", err) } @@ -141,12 +141,12 @@ func (s *server) addArchiveStorage(opts *querysvc.QueryServiceOptions, host comp } func (s *server) createMetricReader(host component.Host) (metricsstore.Reader, error) { - if s.config.MetricStorage == "" { + if s.config.Storage.Metrics == "" { s.telset.Logger.Info("Metric storage not configured") return disabled.NewMetricsReader() } - mf, err := jaegerstorage.GetMetricsFactory(s.config.MetricStorage, host) + mf, err := jaegerstorage.GetMetricsFactory(s.config.Storage.Metrics, host) if err != nil { return nil, fmt.Errorf("cannot find metrics storage factory: %w", err) } diff --git a/cmd/jaeger/internal/extension/jaegerquery/server_test.go b/cmd/jaeger/internal/extension/jaegerquery/server_test.go index faaeeb1ce38..213ae878379 100644 --- a/cmd/jaeger/internal/extension/jaegerquery/server_test.go +++ b/cmd/jaeger/internal/extension/jaegerquery/server_test.go @@ -134,53 +134,67 @@ func TestServerStart(t *testing.T) { { name: "Non-empty config with fake storage host", config: &Config{ - TraceStorageArchive: "jaeger_storage", - TraceStoragePrimary: "jaeger_storage", - MetricStorage: "jaeger_metrics_storage", + Storage: Storage{ + TracesArchive: "jaeger_storage", + TracesPrimary: "jaeger_storage", + Metrics: "jaeger_metrics_storage", + }, }, }, { name: "factory error", config: &Config{ - TraceStoragePrimary: "need-factory-error", + Storage: Storage{ + TracesPrimary: "need-factory-error", + }, }, expectedErr: "cannot find primary storage", }, { name: "span reader error", config: &Config{ - TraceStoragePrimary: "need-span-reader-error", + Storage: Storage{ + TracesPrimary: "need-span-reader-error", + }, }, expectedErr: "cannot create span reader", }, { name: "dependency error", config: &Config{ - TraceStoragePrimary: "need-dependency-reader-error", + Storage: Storage{ + TracesPrimary: "need-dependency-reader-error", + }, }, expectedErr: "cannot create dependencies reader", }, { name: "storage archive error", config: &Config{ - TraceStorageArchive: "need-factory-error", - TraceStoragePrimary: "jaeger_storage", + Storage: Storage{ + TracesArchive: "need-factory-error", + TracesPrimary: "jaeger_storage", + }, }, expectedErr: "cannot find archive storage factory", }, { name: "metrics storage error", config: &Config{ - MetricStorage: "need-factory-error", - TraceStoragePrimary: "jaeger_storage", + Storage: Storage{ + Metrics: "need-factory-error", + TracesPrimary: "jaeger_storage", + }, }, expectedErr: "cannot find metrics storage factory", }, { name: " metrics reader error", config: &Config{ - MetricStorage: "need-metrics-reader-error", - TraceStoragePrimary: "jaeger_storage", + Storage: Storage{ + Metrics: "need-metrics-reader-error", + TracesPrimary: "jaeger_storage", + }, }, expectedErr: "cannot create metrics reader", }, @@ -254,7 +268,9 @@ func TestServerAddArchiveStorage(t *testing.T) { { name: "Archive storage set", config: &Config{ - TraceStorageArchive: "random-value", + Storage: Storage{ + TracesArchive: "random-value", + }, }, qSvcOpts: &querysvc.QueryServiceOptions{}, expectedOutput: "", @@ -263,7 +279,9 @@ func TestServerAddArchiveStorage(t *testing.T) { { name: "Archive storage not supported", config: &Config{ - TraceStorageArchive: "badger", + Storage: Storage{ + TracesArchive: "badger", + }, }, qSvcOpts: &querysvc.QueryServiceOptions{}, extension: fakeStorageExt{}, @@ -313,7 +331,9 @@ func TestServerAddMetricsStorage(t *testing.T) { { name: "Metrics storage set", config: &Config{ - MetricStorage: "random-value", + Storage: Storage{ + Metrics: "random-value", + }, }, expectedOutput: "", expectedErr: "cannot find metrics storage factory: cannot find extension", diff --git a/cmd/jaeger/internal/integration/e2e_integration.go b/cmd/jaeger/internal/integration/e2e_integration.go index fdfaa15c663..e6805ba5eb2 100644 --- a/cmd/jaeger/internal/integration/e2e_integration.go +++ b/cmd/jaeger/internal/integration/e2e_integration.go @@ -126,7 +126,7 @@ func (s *E2EStorageIntegration) e2eInitialize(t *testing.T, storage string) { Path: "./cmd/jaeger/jaeger", Args: []string{"jaeger", "--config", configFile}, // Change the working directory to the root of this project - // since the binary config file jaeger_query's ui_config points to + // since the binary config file jaeger_query's ui.config_file points to // "./cmd/jaeger/config-ui.json" Dir: "../../../..", }, @@ -223,7 +223,9 @@ func createStorageCleanerConfig(t *testing.T, configFile string, storage string) extensions := extensionsAny.(map[string]any) queryAny, ok := extensions["jaeger_query"] require.True(t, ok) - traceStorageAny, ok := queryAny.(map[string]any)["trace_storage"] + storageAny, ok := queryAny.(map[string]any)["storage"] + require.True(t, ok) + traceStorageAny, ok := storageAny.(map[string]any)["traces"] require.True(t, ok) traceStorage := traceStorageAny.(string) extensions["storage_cleaner"] = map[string]string{"trace_storage": traceStorage} diff --git a/cmd/query/app/flags.go b/cmd/query/app/flags.go index 34d6fde6d98..9629a36eba5 100644 --- a/cmd/query/app/flags.go +++ b/cmd/query/app/flags.go @@ -48,39 +48,37 @@ var tlsHTTPFlagsConfig = tlscfg.ServerFlagsConfig{ Prefix: "query.http", } -// QueryOptionsStaticAssets contains configuration for handling static assets -type QueryOptionsStaticAssets struct { - // Path is the path for the static assets for the UI (https://github.com/uber/jaeger-ui) - Path string `valid:"optional" mapstructure:"path"` - // LogAccess tells static handler to log access to static assets, useful in debugging - LogAccess bool `valid:"optional" mapstructure:"log_access"` +type UIConfig struct { + // ConfigFile is the path to a configuration file for the UI. + ConfigFile string `mapstructure:"config_file" valid:"optional"` + // AssetsPath is the path for the static assets for the UI (https://github.com/uber/jaeger-ui). + AssetsPath string `mapstructure:"assets_path" valid:"optional" ` + // LogAccess tells static handler to log access to static assets, useful in debugging. + LogAccess bool `mapstructure:"log_access" valid:"optional"` } -// QueryOptionsBase holds configuration for query service shared with jaeger(v2) +// QueryOptionsBase holds configuration for query service shared with jaeger-v2 type QueryOptionsBase struct { - // BasePath is the base path for all HTTP routes - BasePath string - - StaticAssets QueryOptionsStaticAssets `valid:"optional" mapstructure:"static_assets"` - - // UIConfig is the path to a configuration file for the UI - UIConfig string `valid:"optional" mapstructure:"ui_config"` - // BearerTokenPropagation activate/deactivate bearer token propagation to storage - BearerTokenPropagation bool - // AdditionalHeaders - AdditionalHeaders http.Header - // MaxClockSkewAdjust is the maximum duration by which jaeger-query will adjust a span - MaxClockSkewAdjust time.Duration - // Tenancy configures tenancy for query - Tenancy tenancy.Options + // BasePath is the base path for all HTTP routes. + BasePath string `mapstructure:"base_path"` + // UIConfig contains configuration related to the Jaeger UIConfig. + UIConfig UIConfig `mapstructure:"ui"` + // BearerTokenPropagation activate/deactivate bearer token propagation to storage. + BearerTokenPropagation bool `mapstructure:"bearer_token_propagation"` + // Tenancy holds the multi-tenancy configuration. + Tenancy tenancy.Options `mapstructure:"multi_tenancy"` + // MaxClockSkewAdjust is the maximum duration by which jaeger-query will adjust a span. + MaxClockSkewAdjust time.Duration `mapstructure:"max_clock_skew_adjust" valid:"optional"` // EnableTracing determines whether traces will be emitted by jaeger-query. - EnableTracing bool + EnableTracing bool `mapstructure:"enable_tracing"` } // QueryOptions holds configuration for query service type QueryOptions struct { QueryOptionsBase + // AdditionalHeaders + AdditionalHeaders http.Header // HTTPHostPort is the host:port address that the query service listens in on for http requests HTTPHostPort string // GRPCHostPort is the host:port address that the query service listens in on for gRPC requests @@ -122,9 +120,9 @@ func (qOpts *QueryOptions) InitFromViper(v *viper.Viper, logger *zap.Logger) (*Q } qOpts.TLSHTTP = tlsHTTP qOpts.BasePath = v.GetString(queryBasePath) - qOpts.StaticAssets.Path = v.GetString(queryStaticFiles) - qOpts.StaticAssets.LogAccess = v.GetBool(queryLogStaticAssetsAccess) - qOpts.UIConfig = v.GetString(queryUIConfig) + qOpts.UIConfig.AssetsPath = v.GetString(queryStaticFiles) + qOpts.UIConfig.LogAccess = v.GetBool(queryLogStaticAssetsAccess) + qOpts.UIConfig.ConfigFile = v.GetString(queryUIConfig) qOpts.BearerTokenPropagation = v.GetBool(queryTokenPropagation) qOpts.MaxClockSkewAdjust = v.GetDuration(queryMaxClockSkewAdjust) diff --git a/cmd/query/app/flags_test.go b/cmd/query/app/flags_test.go index 2322b9534db..c5d9ae8b0ec 100644 --- a/cmd/query/app/flags_test.go +++ b/cmd/query/app/flags_test.go @@ -35,9 +35,9 @@ func TestQueryBuilderFlags(t *testing.T) { }) qOpts, err := new(QueryOptions).InitFromViper(v, zap.NewNop()) require.NoError(t, err) - assert.Equal(t, "/dev/null", qOpts.StaticAssets.Path) - assert.True(t, qOpts.StaticAssets.LogAccess) - assert.Equal(t, "some.json", qOpts.UIConfig) + assert.Equal(t, "/dev/null", qOpts.UIConfig.AssetsPath) + assert.True(t, qOpts.UIConfig.LogAccess) + assert.Equal(t, "some.json", qOpts.UIConfig.ConfigFile) assert.Equal(t, "/jaeger", qOpts.BasePath) assert.Equal(t, "127.0.0.1:8080", qOpts.HTTPHostPort) assert.Equal(t, "127.0.0.1:8081", qOpts.GRPCHostPort) diff --git a/cmd/query/app/static_handler.go b/cmd/query/app/static_handler.go index 02faad69dce..2fde0eebe3f 100644 --- a/cmd/query/app/static_handler.go +++ b/cmd/query/app/static_handler.go @@ -36,12 +36,11 @@ var ( // RegisterStaticHandler adds handler for static assets to the router. func RegisterStaticHandler(r *mux.Router, logger *zap.Logger, qOpts *QueryOptions, qCapabilities querysvc.StorageCapabilities) io.Closer { - staticHandler, err := NewStaticAssetsHandler(qOpts.StaticAssets.Path, StaticAssetsHandlerOptions{ + staticHandler, err := NewStaticAssetsHandler(qOpts.UIConfig.AssetsPath, StaticAssetsHandlerOptions{ + UIConfig: qOpts.UIConfig, BasePath: qOpts.BasePath, - UIConfigPath: qOpts.UIConfig, StorageCapabilities: qCapabilities, Logger: logger, - LogAccess: qOpts.StaticAssets.LogAccess, }) if err != nil { logger.Panic("Could not create static assets handler", zap.Error(err)) @@ -62,9 +61,8 @@ type StaticAssetsHandler struct { // StaticAssetsHandlerOptions defines options for NewStaticAssetsHandler type StaticAssetsHandlerOptions struct { + UIConfig BasePath string - UIConfigPath string - LogAccess bool StorageCapabilities querysvc.StorageCapabilities Logger *zap.Logger } @@ -91,8 +89,8 @@ func NewStaticAssetsHandler(staticAssetsRoot string, options StaticAssetsHandler return nil, err } - options.Logger.Info("Using UI configuration", zap.String("path", options.UIConfigPath)) - watcher, err := fswatcher.New([]string{options.UIConfigPath}, h.reloadUIConfig, h.options.Logger) + options.Logger.Info("Using UI configuration", zap.String("path", options.ConfigFile)) + watcher, err := fswatcher.New([]string{options.ConfigFile}, h.reloadUIConfig, h.options.Logger) if err != nil { return nil, err } @@ -109,7 +107,7 @@ func (sH *StaticAssetsHandler) loadAndEnrichIndexHTML(open func(string) (http.Fi return nil, fmt.Errorf("cannot load index.html: %w", err) } // replace UI config - if configObject, err := loadUIConfig(sH.options.UIConfigPath); err != nil { + if configObject, err := loadUIConfig(sH.options.ConfigFile); err != nil { return nil, err } else if configObject != nil { indexBytes = configObject.regexp.ReplaceAll(indexBytes, configObject.config) @@ -137,13 +135,13 @@ func (sH *StaticAssetsHandler) loadAndEnrichIndexHTML(open func(string) (http.Fi } func (sH *StaticAssetsHandler) reloadUIConfig() { - sH.options.Logger.Info("reloading UI config", zap.String("filename", sH.options.UIConfigPath)) + sH.options.Logger.Info("reloading UI config", zap.String("filename", sH.options.ConfigFile)) content, err := sH.loadAndEnrichIndexHTML(sH.assetsFS.Open) if err != nil { sH.options.Logger.Error("error while reloading the UI config", zap.Error(err)) } sH.indexHTML.Store(content) - sH.options.Logger.Info("reloaded UI config", zap.String("filename", sH.options.UIConfigPath)) + sH.options.Logger.Info("reloaded UI config", zap.String("filename", sH.options.ConfigFile)) } func loadIndexHTML(open func(string) (http.File, error)) ([]byte, error) { diff --git a/cmd/query/app/static_handler_test.go b/cmd/query/app/static_handler_test.go index f8ed15ce5a7..40446bdbfda 100644 --- a/cmd/query/app/static_handler_test.go +++ b/cmd/query/app/static_handler_test.go @@ -45,8 +45,8 @@ func TestRegisterStaticHandlerPanic(t *testing.T) { logger, &QueryOptions{ QueryOptionsBase: QueryOptionsBase{ - StaticAssets: QueryOptionsStaticAssets{ - Path: "/foo/bar", + UIConfig: UIConfig{ + AssetsPath: "/foo/bar", }, }, }, @@ -112,12 +112,12 @@ func TestRegisterStaticHandler(t *testing.T) { } closer := RegisterStaticHandler(r, logger, &QueryOptions{ QueryOptionsBase: QueryOptionsBase{ - StaticAssets: QueryOptionsStaticAssets{ - Path: "fixture", - LogAccess: testCase.logAccess, + UIConfig: UIConfig{ + ConfigFile: testCase.UIConfigPath, + AssetsPath: "fixture", + LogAccess: testCase.logAccess, }, BasePath: testCase.basePath, - UIConfig: testCase.UIConfigPath, }, }, querysvc.StorageCapabilities{ArchiveStorage: testCase.archiveStorage}, @@ -158,16 +158,20 @@ func TestRegisterStaticHandler(t *testing.T) { func TestNewStaticAssetsHandlerErrors(t *testing.T) { _, err := NewStaticAssetsHandler("fixture", StaticAssetsHandlerOptions{ - UIConfigPath: "fixture/invalid-config", - Logger: zap.NewNop(), + UIConfig: UIConfig{ + ConfigFile: "fixture/invalid-config", + }, + Logger: zap.NewNop(), }) require.Error(t, err) for _, base := range []string{"x", "x/", "/x/"} { _, err := NewStaticAssetsHandler("fixture", StaticAssetsHandlerOptions{ - UIConfigPath: "fixture/ui-config.json", - BasePath: base, - Logger: zap.NewNop(), + UIConfig: UIConfig{ + ConfigFile: "fixture/ui-config.json", + }, + BasePath: base, + Logger: zap.NewNop(), }) require.Errorf(t, err, "basePath=%s", base) assert.Contains(t, err.Error(), "invalid base path") @@ -195,8 +199,10 @@ func TestHotReloadUIConfig(t *testing.T) { zcore, logObserver := observer.New(zapcore.InfoLevel) logger := zap.New(zcore) h, err := NewStaticAssetsHandler("fixture", StaticAssetsHandlerOptions{ - UIConfigPath: cfgFileName, - Logger: logger, + UIConfig: UIConfig{ + ConfigFile: cfgFileName, + }, + Logger: logger, }) require.NoError(t, err) defer h.Close() diff --git a/docker-compose/monitor/jaeger-v2-config.yml b/docker-compose/monitor/jaeger-v2-config.yml index bc7160c5bb8..de1a4ac0616 100644 --- a/docker-compose/monitor/jaeger-v2-config.yml +++ b/docker-compose/monitor/jaeger-v2-config.yml @@ -14,8 +14,9 @@ service: extensions: jaeger_query: - trace_storage: some_storage - metric_storage: some_metrics_storage + storage: + traces: some_storage + metrics: some_metrics_storage jaeger_storage: backends: some_storage: diff --git a/docker-compose/tail-sampling/jaeger-v2-config.yml b/docker-compose/tail-sampling/jaeger-v2-config.yml index 545ecf4ea8b..c6f3dbd8838 100644 --- a/docker-compose/tail-sampling/jaeger-v2-config.yml +++ b/docker-compose/tail-sampling/jaeger-v2-config.yml @@ -14,7 +14,8 @@ extensions: use_v2: true http: jaeger_query: - trace_storage: some_storage + storage: + traces: some_storage jaeger_storage: backends: some_storage: