Skip to content

Commit

Permalink
Revert "opsviewreporter instantiated when necessary to retrieve logs"
Browse files Browse the repository at this point in the history
This reverts commit 4089bc2.
  • Loading branch information
sametd committed Dec 20, 2023
1 parent 4089bc2 commit 637b5d4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ def __init__(self, *args, **kwargs):
self.critical_t = kwargs["critical_t"]
self.req_timeout = kwargs["req_timeout"]
self.metric_server_url = kwargs["metric_server_url"]
self.opsview_reporter = OpsviewReporter()
super().__init__(*args, **kwargs)

def metric(self):
Expand All @@ -210,13 +209,13 @@ def metric(self):

# fetch the cluster metrics
if self.metric_server_url:
metrics = self.opsview_reporter.retrieve_metrics([self.metric_server_url], self.req_timeout)[
metrics = OpsviewReporter.retrieve_metrics([self.metric_server_url], self.req_timeout)[
self.metric_server_url
]
if metrics:
logger.debug(f"Processing tlm {self.metric_name}...")

av_pod = self.opsview_reporter.read_from_metrics(metrics, pattern)
av_pod = OpsviewReporter.read_from_metrics(metrics, pattern)
if av_pod:
av_pod = int(av_pod)
if av_pod <= self.critical_t:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ def __init__(self, *args, **kwargs):
self.critical_t = kwargs["critical_t"]
self.req_timeout = kwargs["req_timeout"]
self.metric_server_url = kwargs["metric_server_url"]
self.opsview_reporter = OpsviewReporter()
super().__init__(*args, **kwargs)

def metric(self):
Expand All @@ -191,13 +190,13 @@ def metric(self):

# fetch the cluster metrics
if self.metric_server_url:
metrics = self.opsview_reporter.retrieve_metrics([self.metric_server_url], self.req_timeout)[
metrics = OpsviewReporter.retrieve_metrics([self.metric_server_url], self.req_timeout)[
self.metric_server_url
]
if metrics:
logger.debug(f"Processing tlm {self.metric_name}...")

av_pod = self.opsview_reporter.read_from_metrics(metrics, pattern)
av_pod = OpsviewReporter.read_from_metrics(metrics, pattern)
if av_pod:
av_pod = int(av_pod)
if av_pod <= self.critical_t:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def __init__(self, config, *args, **kwargs):
self.req_timeout = self.etcd_config["req_timeout"]
self.member_urls = self.etcd_config["member_urls"]
self.tlms = self.etcd_config["tlms"]
self.opsview_reporter = OpsviewReporter()
super().__init__(config, *args, **kwargs)

def process_messages(self):
Expand All @@ -34,7 +33,7 @@ def process_messages(self):
logger.debug("Etcd processing metrics...")

# fetch the raw tlms provided by etcd
raw_tlms = self.opsview_reporter.retrieve_metrics(self.member_urls, self.req_timeout) # noqa: F841
raw_tlms = OpsviewReporter.retrieve_metrics(self.member_urls, self.req_timeout) # noqa: F841

# array of metric to return
metrics = []
Expand Down

0 comments on commit 637b5d4

Please sign in to comment.