detectMode determines whether the config is for monolithic or microservices deployment. It also rewrites targets that would produce an invalid 3.0 config: - missing or empty target: deleted so Tempo applies its default ("all") - scalable-single-binary: rewritten to "all" (SSB was removed in 3.0)
(m map[string]interface{}, flagOverride string, warnings *[]string)
| 136 | // - missing or empty target: deleted so Tempo applies its default ("all") |
| 137 | // - scalable-single-binary: rewritten to "all" (SSB was removed in 3.0) |
| 138 | func detectMode(m map[string]interface{}, flagOverride string, warnings *[]string) string { |
| 139 | if flagOverride != "" { |
| 140 | return flagOverride |
| 141 | } |
| 142 | target, ok := m["target"] |
| 143 | if !ok { |
| 144 | return modeMonolithic |
| 145 | } |
| 146 | targetStr, _ := target.(string) |
| 147 | if targetStr == "" { |
| 148 | // An explicit empty string overrides the default. Remove it so Tempo applies "all". |
| 149 | delete(m, "target") |
| 150 | return modeMonolithic |
| 151 | } |
| 152 | if app.IsSingleBinary(targetStr) { |
| 153 | return modeMonolithic |
| 154 | } |
| 155 | if targetStr == "scalable-single-binary" { |
| 156 | *warnings = append(*warnings, fmt.Sprintf("target %q is removed in Tempo 3.0; rewriting to %q and treating config as monolithic", targetStr, app.SingleBinary)) |
| 157 | m["target"] = app.SingleBinary |
| 158 | return modeMonolithic |
| 159 | } |
| 160 | |
| 161 | return modeMicroservices |
| 162 | } |
| 163 | |
| 164 | // detectLegacyOverrides checks if the config uses the legacy flat overrides format |
| 165 | // and returns an error directing the user to migrate overrides first. |