Skip to content

Commit e445af8

Browse files
author
Terry Hardie
committed
Adding an option to turn of derivatives of values. This
means you can use graphite derivative or perSecond functions to get more accurate values over time
1 parent f946865 commit e445af8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

docs/collectors/BindCollector.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ data_format | xml_v2 | Bind stats version:<br>
3737
- xml_v3 (New xml version)<br>
3838
- json_v1 (JSON replacement for XML)<br>
3939
| str
40+
derivative | True | Report derived stats or raw (always incrementing | bool
4041

4142
#### Example Output
4243

src/collectors/bind/bind.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import diamond.collector
1414
import sys
1515
import urllib2
16+
from diamond.collector import str_to_bool
1617

1718
if sys.version_info >= (2, 5):
1819
import xml.etree.cElementTree as ElementTree
@@ -39,6 +40,7 @@ def get_default_config_help(self):
3940
" - xml_v2 (Original bind stats version from 9.5)\n" +
4041
" - xml_v3 (New xml version)\n" +
4142
" - json_v1 (JSON replacement for XML)\n",
43+
'derivative': "",
4244
})
4345
return config_help
4446

@@ -68,13 +70,15 @@ def get_default_config(self):
6870
'publish_view_bind': False,
6971
'publish_view_meta': False,
7072
'data_format': 'xml_v2',
73+
'derivative': True,
7174
})
7275
return config
7376

7477
def clean_counter(self, name, value):
75-
value = self.derivative(name, value)
76-
if value < 0:
77-
value = 0
78+
if str_to_bool(self.config['derivative']):
79+
value = self.derivative(name, value)
80+
if value < 0:
81+
value = 0
7882
self.publish(name, value)
7983

8084
def collect(self):

0 commit comments

Comments
 (0)