{"record":{"id":"8206cb7dd8accad7","repo":"jaegertracing/jaeger","slug":"no-metric-backend-configuration-provided-for-s","errorCode":null,"errorMessage":"no metric backend configuration provided for '%s'","messagePattern":"no metric backend configuration provided for '(.+?)'","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/jaegerstorage/extension.go","lineNumber":284,"sourceCode":"\t\t}\n\t\tmetricStoreFactory, err = esmetrics.NewFactory(\n\t\t\tcontext.Background(),\n\t\t\t*cfg.Opensearch,\n\t\t\tosTelset,\n\t\t\thttpAuth,\n\t\t)\n\n\tcase cfg.ClickHouse != nil:\n\t\tchTelset := telset\n\t\tchTelset.Metrics = scopedMetricsFactory(name, \"clickhouse\", \"metricstore\")\n\t\tmetricStoreFactory, err = clickhouse.NewFactory(\n\t\t\tcontext.Background(),\n\t\t\t*cfg.ClickHouse,\n\t\t\tchTelset,\n\t\t)\n\n\tdefault:\n\t\terr = fmt.Errorf(\"no metric backend configuration provided for '%s'\", name)\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to initialize metrics storage '%s': %w\", name, err)\n\t}\n\n\treturn metricStoreFactory, nil\n}\n\nfunc (s *storageExt) MetricStorageFactory(name string) (storage.MetricStoreFactory, error) {\n\ts.factoryMu.Lock()\n\tdefer s.factoryMu.Unlock()\n\n\t// Return cached factory if already created\n\tif mf, ok := s.metricsFactories[name]; ok {\n\t\treturn mf, nil\n\t}\n","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/jaegerstorage/extension.go#L266-L302","documentation":"createMetricStorageFactory switches on which backend field is set in the MetricBackend config (Prometheus, Elasticsearch, Opensearch, ClickHouse). If the config exists under MetricBackends but none of the known backend fields is populated, the default branch sets this error, which is then wrapped as 'failed to initialize metrics storage'.","triggerScenarios":"MetricStorageFactory(name) finds the name in s.config.MetricBackends (so the not-declared check passes) but the MetricBackend struct has all backend pointers nil — the switch falls to default.","commonSituations":"A metric backend entry declared with an empty body or only unrecognized/typo'd keys (e.g. `prometeus:` instead of `prometheus:`) so no backend field is populated after unmarshalling.","solutions":["Populate exactly one supported backend (prometheus, elasticsearch, opensearch, or clickhouse) in the named metric backend entry","Check for key typos in the metric backend YAML that silently leave all fields nil","Ensure the config is being unmarshalled with mapstructure tags matching your YAML keys"],"exampleFix":"// before: typo'd key leaves all fields nil\nmetric_backends:\n  metrics-store:\n    prometeus:\n      endpoint: http://prom:9090\n// after\nmetric_backends:\n  metrics-store:\n    prometheus:\n      endpoint: http://prom:9090","handlingStrategy":"validation","validationCode":"// pre-check that a backend is selected\nfunc hasMetricBackend(cfg jaegerstorage.MetricBackend) bool {\n    return cfg.Prometheus != nil || cfg.Elasticsearch != nil ||\n        cfg.Opensearch != nil || cfg.ClickHouse != nil\n}","typeGuard":"func metricBackendSelected(cfg jaegerstorage.MetricBackend) bool {\n    return cfg.Prometheus != nil || cfg.Elasticsearch != nil ||\n        cfg.Opensearch != nil || cfg.ClickHouse != nil\n}","tryCatchPattern":"mf, err := ext.MetricStorageFactory(name)\nif err != nil {\n    if strings.Contains(err.Error(), \"no metric backend configuration provided\") {\n        return fmt.Errorf(\"metric backend '%s' has no backend type set (prometheus/elasticsearch/opensearch/clickhouse)\", name)\n    }\n    return err\n}","preventionTips":["Never declare an empty metric backend entry; set exactly one backend key","Watch for YAML key typos that unmarshal to no known field","Add a config linter that fails when a MetricBackend has all fields nil"],"tags":["go","jaeger","config","metrics"],"backgroundTag":"no-backend-configured","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}