UpdateOverrides updates the tenant overrides file with the provided configuration. The overrides parameter should be a map where keys are tenant IDs and values are override configurations for that tenant. Example usage: h.UpdateOverrides(map[string]*overrides.Overrides{ "tenant-1": { Ingesti
(tenantOverrides map[string]*overrides.Overrides)
| 298 | // Tempo will automatically reload the overrides based on the per_tenant_override_period |
| 299 | // configured in config-base.yaml. |
| 300 | func (h *TempoHarness) UpdateOverrides(tenantOverrides map[string]*overrides.Overrides) error { |
| 301 | overridesConfig := struct { |
| 302 | Overrides map[string]*overrides.Overrides `yaml:"overrides"` |
| 303 | }{ |
| 304 | Overrides: tenantOverrides, |
| 305 | } |
| 306 | |
| 307 | data, err := yaml.Marshal(overridesConfig) |
| 308 | if err != nil { |
| 309 | return fmt.Errorf("failed to marshal overrides: %w", err) |
| 310 | } |
| 311 | |
| 312 | err = os.WriteFile(h.overridesPath, data, 0o644) // nolint:gosec // G306: Expect WriteFile permissions to be 0600 or less |
| 313 | if err != nil { |
| 314 | return fmt.Errorf("failed to write overrides file: %w", err) |
| 315 | } |
| 316 | |
| 317 | // overrides reload every 1 second. wait 5 to make sure it gets loaded |
| 318 | time.Sleep(5 * time.Second) |
| 319 | |
| 320 | return nil |
| 321 | } |
| 322 | |
| 323 | // GetConfig reads and parses the Tempo configuration file that was set up by the harness. |
| 324 | // Returns the parsed app.Config or an error if reading/parsing fails. |