/usr/lib/python2.7/dist-packages/carbon/management.py is in graphite-carbon 0.9.12-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import traceback
import whisper
from carbon import log
from carbon.storage import getFilesystemPath
def getMetadata(metric, key):
if key != 'aggregationMethod':
return dict(error="Unsupported metadata key \"%s\"" % key)
wsp_path = getFilesystemPath(metric)
try:
value = whisper.info(wsp_path)['aggregationMethod']
return dict(value=value)
except:
log.err()
return dict(error=traceback.format_exc())
def setMetadata(metric, key, value):
if key != 'aggregationMethod':
return dict(error="Unsupported metadata key \"%s\"" % key)
wsp_path = getFilesystemPath(metric)
try:
old_value = whisper.setAggregationMethod(wsp_path, value)
return dict(old_value=old_value, new_value=value)
except:
log.err()
return dict(error=traceback.format_exc())
|