| 91 | } |
| 92 | |
| 93 | func (p *Prometheus) SetConfigEncoded(config []byte) error { |
| 94 | if p.BuildErr() != nil { |
| 95 | return p.BuildErr() |
| 96 | } |
| 97 | |
| 98 | if err := os.WriteFile(filepath.Join(p.Dir(), "prometheus.yml"), config, 0600); err != nil { |
| 99 | return errors.Wrap(err, "creating prom config failed") |
| 100 | } |
| 101 | |
| 102 | if p.IsRunning() { |
| 103 | // Reload configuration. |
| 104 | return p.Exec(e2e.NewCommand("kill", "-SIGHUP", "1")) |
| 105 | } |
| 106 | return nil |
| 107 | } |
| 108 | |
| 109 | func (p *Prometheus) SetConfig(config promconfig.Config) error { |
| 110 | b, err := yaml.Marshal(config) |