Skip to content

Commit ed8e3cd

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 f4a523f commit ed8e3cd

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
@@ -32,6 +32,7 @@ publish | resolver, server, zonemgmt, sockets, memory, | Available stats:<br>
3232
| list
3333
publish_view_bind | False | | bool
3434
publish_view_meta | False | | bool
35+
derivative | True | Report derived stats or raw (always incrementing) | bool
3536

3637
#### Example Output
3738

src/collectors/bind/bind.py

100644100755
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
@@ -35,6 +36,7 @@ def get_default_config_help(self):
3536
" - memory (Global memory usage)\n",
3637
'publish_view_bind': "",
3738
'publish_view_meta': "",
39+
'derivative': "",
3840
})
3941
return config_help
4042

@@ -63,13 +65,15 @@ def get_default_config(self):
6365
# By default we don't publish these special views
6466
'publish_view_bind': False,
6567
'publish_view_meta': False,
68+
'derivative': True,
6669
})
6770
return config
6871

6972
def clean_counter(self, name, value):
70-
value = self.derivative(name, value)
71-
if value < 0:
72-
value = 0
73+
if str_to_bool(self.config['derivative']):
74+
value = self.derivative(name, value)
75+
if value < 0:
76+
value = 0
7377
self.publish(name, value)
7478

7579
def collect(self):

0 commit comments

Comments
 (0)