Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metricd: remove janitor process #704

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions gnocchi/cli/metricd.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ def __init__(self, worker_id, conf):
self._get_sacks_to_process = cachetools.func.ttl_cache(
ttl=conf.metricd.metric_processing_delay
)(self._get_sacks_to_process)
if worker_id == 0:
self.name = "processing+janitor"
self._last_expunge = utils.StopWatch().start()

@tenacity.retry(
wait=utils.wait_exponential,
Expand Down Expand Up @@ -217,6 +220,12 @@ def _get_sacks_to_process(self):
return self._tasks or self.fallback_tasks

def _run_job(self):
if (self.worker_id == 0 and
self._last_expunge.elapsed()
>= self.conf.metric.metric_cleanup_delay):
self.store.expunge_metrics(self.incoming, self.index)
self._last_expunge.reset()

m_count = 0
s_count = 0
# We are going to process the sacks we got notified for, and if we got
Expand Down Expand Up @@ -258,18 +267,6 @@ def close_services(self):
self.coord.stop()


class MetricJanitor(MetricProcessBase):
name = "janitor"

def __init__(self, worker_id, conf):
super(MetricJanitor, self).__init__(
worker_id, conf, conf.metricd.metric_cleanup_delay)

def _run_job(self):
self.store.expunge_metrics(self.incoming, self.index)
LOG.debug("Metrics marked for deletion removed from backend")


class MetricdServiceManager(cotyledon.ServiceManager):
def __init__(self, conf):
super(MetricdServiceManager, self).__init__()
Expand All @@ -281,7 +278,6 @@ def __init__(self, conf):
workers=conf.metricd.workers)
if self.conf.metricd.metric_reporting_delay >= 0:
self.add(MetricReporting, args=(self.conf,))
self.add(MetricJanitor, args=(self.conf,))

self.register_hooks(on_reload=self.on_reload)

Expand Down
2 changes: 1 addition & 1 deletion gnocchi/opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def list_opts():
deprecated_group='storage',
default=300,
required=True,
help="How many seconds to wait between "
help="How many seconds to wait (at least) between "
"cleaning of expired data"),
cfg.IntOpt('processing_replicas',
default=3,
Expand Down