Skip to content

Instantly share code, notes, and snippets.

@boris-42
Created October 5, 2016 06:34
Show Gist options
  • Save boris-42/122993c8e707b08f811d12d541c2bb4f to your computer and use it in GitHub Desktop.
Save boris-42/122993c8e707b08f811d12d541c2bb4f to your computer and use it in GitHub Desktop.
graphite_transf.py
SLA = 5
FAILED = []
make_positive(ts):
return [t, 1 for t, v in ts]:
for v in time_series:
if v:
if len(FAILED) <= SLA:
send_to_graphite(make_positive(FAILED) + [v])
FAILED = []
else:
send_to_graphite(FAILED + [v])
FAILED = []
else:
if len(FAILED) > SLA:
send_to_graphite([FAILED.pop(0)])
FAILED.append(v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment