Skip to content

Commit

Permalink
Merge pull request #19 from nicholaskuechler/adds_protocol_option-201…
Browse files Browse the repository at this point in the history
…60628-1442

Adds protocol class option to act as a full graphite replacement.
  • Loading branch information
VinnyQ committed Jun 28, 2016
2 parents b1f309f + d445e28 commit 81de0e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -39,6 +39,7 @@ It does very primitive _'caching'_: aggregates all metrics and flushes them in r
| --auth-url | Keystone token URL | |
| --config | Set options from a config file | |
| --overwrite_collection_timestamp | Replace metric collection timestamp with ingest timestamp | False |
| --protocol | Listening protocol class. MetricPickleReceiver for receiving metrics from graphite, or MetricLineReceiver to act as a graphite replacement. | MetricPickleReceiver |

In case you need no authentication leave `-u`/`--user` command line argument empty (default value).
It is recommended not to set the `key` option from the command line, as that can compromise api keys. Instead, set the key in a config file and set the `--config` option to the name of the file.'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -35,7 +35,7 @@ def run_tests(self):

setup(
name='blueflood-carbon-forwarder',
version="0.4.1",
version="0.4.2",
url='https://github.com/rackerlabs/blueflood-carbon-forwarder',
license='Apache Software License',
author='Rackspace Metrics',
Expand Down
10 changes: 9 additions & 1 deletion twisted/plugins/graphite_blueflood_plugin.py
Expand Up @@ -32,6 +32,7 @@ class Options(usage.Options):
['key', 'k', '', 'Rackspace authentication password. It is recommended not to set this option from the command line, as that can compromise api keys. Instead, set the key in a config file and use the \'--config\' option below.'],
['auth_url', '', AUTH_URL, 'Auth URL'],
['limit', '', 0, 'Blueflood json payload limit, bytes. 0 means no limit'],
['protocol', '', 'MetricPickleReceiver', 'Listening protocol class. MetricPickleReceiver for receiving metrics from graphite, or MetricLineReceiver to act as a graphite replacement.'],
['overwrite_collection_timestamp', '', False, 'Replace metric time with current blueflood carbon forwarder node time'],
['config', 'c', None,
'Path to a configuration file. The file must be in INI format, with '
Expand Down Expand Up @@ -137,8 +138,15 @@ def makeService(self, options):
value = int(value)
options[key] = value

if options['protocol'] == "MetricPickleReceiver":
protocol_cls = MetricPickleReceiver
elif options['protocol'] == "MetricLineReceiver":
protocol_cls = MetricLineReceiver
else:
protocol_cls = MetricPickleReceiver

return MetricService(
protocol_cls=MetricPickleReceiver,
protocol_cls=protocol_cls,
endpoint=options['endpoint'],
interval=float(options['interval']),
blueflood_url=options['blueflood'],
Expand Down

0 comments on commit 81de0e0

Please sign in to comment.