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

Function modifyOverrides

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

modifyOverrides sets compaction_disabled: true in the overrides defaults and any inline per-tenant overrides, and warns about external per-tenant files.

(m map[string]interface{}, warnings *[]string)

Source from the content-addressed store, hash-verified

216// modifyOverrides sets compaction_disabled: true in the overrides defaults and
217// any inline per-tenant overrides, and warns about external per-tenant files.
218func modifyOverrides(m map[string]interface{}, warnings *[]string) {
219 // Ensure overrides map exists
220 ovr := getOrCreateNestedMap(m, "overrides")
221
222 // Set defaults.compaction.compaction_disabled: true
223 defaults := getOrCreateNestedMap(ovr, "defaults")
224 compaction := getOrCreateNestedMap(defaults, "compaction")
225 compaction["compaction_disabled"] = true
226
227 // Walk any non-standard keys (potential inline per-tenant overrides)
228 knownKeys := yamlFieldNames(overrides.Config{})
229 for key, val := range ovr {
230 if knownKeys[key] {
231 continue
232 }
233 tenantMap, ok := asMap(val)
234 if !ok {
235 *warnings = append(*warnings, fmt.Sprintf("overrides entry %q is not a map, skipping", key))
236 continue
237 }
238 tenantCompaction := getOrCreateNestedMap(tenantMap, "compaction")
239 tenantCompaction["compaction_disabled"] = true
240 }
241
242 // Warn about external per-tenant override files
243 if perTenantPath, ok := ovr["per_tenant_override_config"]; ok {
244 if pathStr, ok := perTenantPath.(string); ok && pathStr != "" {
245 *warnings = append(*warnings, fmt.Sprintf(
246 "external per-tenant overrides file %q needs compaction_disabled: true added manually for each tenant", pathStr))
247 }
248 }
249}
250
251// cleanLocalBlocks removes the local_blocks processor config and the "local-blocks"
252// entry from processors lists at the top-level metrics_generator config, overrides

Callers 2

TestModifyOverridesFunction · 0.85
RunMethod · 0.85

Calls 3

getOrCreateNestedMapFunction · 0.85
yamlFieldNamesFunction · 0.85
asMapFunction · 0.85

Tested by 1

TestModifyOverridesFunction · 0.68