MCPcopy
hub / github.com/grafana/tempo / detectLegacyOverrides

Function detectLegacyOverrides

cmd/tempo-cli/cmd-migrate-config.go:166–186  ·  view source on GitHub ↗

detectLegacyOverrides checks if the config uses the legacy flat overrides format and returns an error directing the user to migrate overrides first.

(m map[string]interface{})

Source from the content-addressed store, hash-verified

164// detectLegacyOverrides checks if the config uses the legacy flat overrides format
165// and returns an error directing the user to migrate overrides first.
166func detectLegacyOverrides(m map[string]interface{}) error {
167 ovrMap, ok := extractNestedMap(m, "overrides")
168 if !ok {
169 return nil
170 }
171
172 // If "defaults" key exists, this is the new format (or already migrated)
173 if _, hasDefaults := ovrMap["defaults"]; hasDefaults {
174 return nil
175 }
176
177 // Check for known legacy flat keys
178 legacyFields := yamlFieldNames(overrides.LegacyOverrides{})
179 for key := range ovrMap {
180 if legacyFields[key] {
181 return fmt.Errorf("legacy overrides format detected (found key %q); run 'tempo-cli migrate overrides-config' first", key)
182 }
183 }
184
185 return nil
186}
187
188// deleteRemovedBlocks removes top-level config keys that are not recognized by the
189// Tempo 3.0 Config struct. This catches 2.x-only sections like ingester, ingester_client,

Callers 2

RunMethod · 0.85

Calls 2

extractNestedMapFunction · 0.85
yamlFieldNamesFunction · 0.85

Tested by 1