Skip to content

Commit

Permalink
injector: cleanup
Browse files Browse the repository at this point in the history
This removes unused method. And fixup the logging issue
due to the shallowed "metrics" variable.
  • Loading branch information
sileht authored and mergify[bot] committed May 21, 2018
1 parent 4461385 commit 2a76e73
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions gnocchi/cli/injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@
from oslo_config import cfg

from gnocchi import chef
from gnocchi.cli import metricd
from gnocchi import incoming
from gnocchi import indexer
from gnocchi import service
from gnocchi import storage
from gnocchi import utils

LOG = daiquiri.getLogger(__name__)
Expand Down Expand Up @@ -56,24 +53,12 @@ def injector():
interval=conf.interval)


def _inject_from_conf(conf,
metrics, measures, archive_policy_name="low",
process=False, interval=None):
inc = incoming.get_driver(conf)
coord = metricd.get_coordinator_and_start(str(uuid.uuid4()),
conf.coordination_url)
store = storage.get_driver(conf)
idx = indexer.get_driver(conf)
return _inject(inc, coord, store, idx,
metrics, measures, archive_policy_name, process, interval)


def _inject(inc, coord, store, idx,
metrics, measures, archive_policy_name="low", process=False,
interval=None):
LOG.info("Creating %d metrics", metrics)
with utils.StopWatch() as sw:
metrics = [
metric_ids = [
idx.create_metric(uuid.uuid4(), "admin",
archive_policy_name).id
for _ in range(metrics)
Expand All @@ -88,7 +73,7 @@ def _inject(inc, coord, store, idx,
m_id: [incoming.Measure(
now + numpy.timedelta64(seconds=s),
random.randint(-999999, 999999)) for s in range(measures)]
for m_id in metrics
for m_id in metric_ids
}
LOG.info("… done in %.2fs", sw.elapsed())

Expand Down

0 comments on commit 2a76e73

Please sign in to comment.