Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

multiple_skylines_graphite_namespace #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 8 additions & 4 deletions src/analyzer/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

logger = logging.getLogger("AnalyzerLog")

try:
SERVER_METRIC_PATH = settings.SERVER_METRICS_NAME + '.'
except:
SERVER_METRIC_PATH = ''

class Analyzer(Thread):
def __init__(self, parent_pid):
Expand Down Expand Up @@ -219,8 +223,8 @@ def run(self):
logger.info('anomaly breakdown :: %s' % anomaly_breakdown)

# Log to Graphite
self.send_graphite_metric('skyline.analyzer.run_time', '%.2f' % (time() - now))
self.send_graphite_metric('skyline.analyzer.total_analyzed', '%.2f' % (len(unique_metrics) - sum(exceptions.values())))
self.send_graphite_metric('skyline.analyzer.' + SERVER_METRIC_PATH + 'run_time', '%.2f' % (time() - now))
self.send_graphite_metric('skyline.analyzer.' + SERVER_METRIC_PATH + 'total_analyzed', '%.2f' % (len(unique_metrics) - sum(exceptions.values())))

# Check canary metric
raw_series = self.redis_conn.get(settings.FULL_NAMESPACE + settings.CANARY_METRIC)
Expand All @@ -232,8 +236,8 @@ def run(self):
projected = 24 * (time() - now) / time_human

logger.info('canary duration :: %.2f' % time_human)
self.send_graphite_metric('skyline.analyzer.duration', '%.2f' % time_human)
self.send_graphite_metric('skyline.analyzer.projected', '%.2f' % projected)
self.send_graphite_metric('skyline.analyzer.' + SERVER_METRIC_PATH + 'duration', '%.2f' % time_human)
self.send_graphite_metric('skyline.analyzer.' + SERVER_METRIC_PATH + 'projected', '%.2f' % projected)

# Reset counters
self.anomalous_metrics[:] = []
Expand Down
6 changes: 5 additions & 1 deletion src/horizon/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

logger = logging.getLogger("HorizonLog")

try:
SERVER_METRIC_PATH = settings.SERVER_METRICS_NAME + '.'
except:
SERVER_METRIC_PATH = ''

class Worker(Process):
"""
Expand Down Expand Up @@ -111,7 +115,7 @@ def run(self):
# Log progress
if self.canary:
logger.info('queue size at %d' % self.q.qsize())
self.send_graphite_metric('skyline.horizon.queue_size', self.q.qsize())
self.send_graphite_metric('skyline.horizon.' + SERVER_METRIC_PATH + 'queue_size', self.q.qsize())

except Empty:
logger.info('worker queue is empty and timed out')
Expand Down
7 changes: 7 additions & 0 deletions src/settings.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ CARBON_PORT = 2003
# will occur when Oculus support is disabled.
OCULUS_HOST = 'http://your_oculus_host.com'

# This is to allow for multiple skyline nodes to send metrics to a graphite
# instance on the skyline namespace sharded by this setting, like carbon.relays.
# If you want multiple skyline hosts, set the hostname of the skyline here e.g.
# skyline.analyzer.run_time
# skyline.analyzer.skyline-01.run_time
SERVER_METRICS_NAME = ''

"""
Analyzer settings
"""
Expand Down