Skip to content

Commit

Permalink
metric token support added for retrieve metrics function
Browse files Browse the repository at this point in the history
  • Loading branch information
sametd committed Dec 20, 2023
1 parent 637b5d4 commit 3a202f7
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ def aggregate_unique_counter_tlms(tlms):
}
return agg_tlm

def retrieve_metrics(self, metric_servers, req_timeout):
@classmethod
def retrieve_metrics(cls, metric_servers, req_timeout):
"""
This methods retrieves the metrics provided by specific metric servers using a Prometheus interface.
"""
Expand All @@ -212,8 +213,8 @@ def retrieve_metrics(self, metric_servers, req_timeout):
logger.debug(f"Retrieving metrics from {url}...")
headers = {}
try:
if self.metric_ssl_enabled:
headers["Authorization"] = f"Bearer {self.metric_token}"
if cls.metric_ssl_enabled:
headers["Authorization"] = f"Bearer {cls.metric_token}"
resp = requests.get(url, verify=False, timeout=req_timeout, headers=headers)
except Exception as e:
logger.exception(f"Not able to get metrics from {url}, error {e}")
Expand Down

0 comments on commit 3a202f7

Please sign in to comment.