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

Function cleanLocalBlocks

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

cleanLocalBlocks removes the local_blocks processor config and the "local-blocks" entry from processors lists at the top-level metrics_generator config, overrides defaults, and any inline per-tenant overrides.

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

Source from the content-addressed store, hash-verified

252// entry from processors lists at the top-level metrics_generator config, overrides
253// defaults, and any inline per-tenant overrides.
254func cleanLocalBlocks(m map[string]interface{}, warnings *[]string) {
255 // Clean top-level metrics_generator
256 removeLocalBlocksProcessorConfig(m, warnings)
257
258 ovrMap, ok := extractNestedMap(m, "overrides")
259 if !ok {
260 return
261 }
262
263 // Clean defaults
264 if defaults, ok := extractNestedMap(ovrMap, "defaults"); ok {
265 removeLocalBlocksProcessorConfig(defaults, warnings)
266 removeLocalBlocksFromProcessorList(defaults, warnings)
267 }
268
269 // Clean any inline per-tenant overrides
270 knownKeys := yamlFieldNames(overrides.Config{})
271 for key, val := range ovrMap {
272 if knownKeys[key] {
273 continue
274 }
275 tenantMap, ok := asMap(val)
276 if !ok {
277 continue // already warned in modifyOverrides
278 }
279 removeLocalBlocksProcessorConfig(tenantMap, warnings)
280 removeLocalBlocksFromProcessorList(tenantMap, warnings)
281 }
282}
283
284// removeLocalBlocksProcessorConfig removes metrics_generator.processor.local_blocks
285// from the given map (which should be either the top-level config or an overrides entry).

Callers 2

TestCleanLocalBlocksFunction · 0.85
RunMethod · 0.85

Calls 5

extractNestedMapFunction · 0.85
yamlFieldNamesFunction · 0.85
asMapFunction · 0.85

Tested by 1

TestCleanLocalBlocksFunction · 0.68