Add support for Prometheus pushgateway basic auth (#16230)

Co-authored-by: Joe Clarke <jclarke@cisco.com>
This commit is contained in:
Joe Clarke
2024-07-21 14:03:32 -04:00
committed by GitHub
parent 1f01d7e627
commit e6f02ea7ff
3 changed files with 28 additions and 0 deletions

View File

@@ -51,6 +51,12 @@ class Prometheus extends BaseDatastore
$this->client = Http::client()->baseUrl($this->base_uri);
$user = Config::get('prometheus.user', '');
$passwd = Config::get('prometheus.password', '');
if ($user && $passwd) {
$this->client = $this->client->withBasicAuth($user, $passwd);
}
$this->prefix = Config::get('prometheus.prefix', '');
if ($this->prefix) {
$this->prefix = "$this->prefix" . '_';