-
Notifications
You must be signed in to change notification settings - Fork 600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding an option to turn off derivatives of values for bind collector #563
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ publish | resolver, server, zonemgmt, sockets, memory, | Available stats:<br> | |
| list | ||
publish_view_bind | False | | bool | ||
publish_view_meta | False | | bool | ||
derivative | True | Report derived stats or raw (always incrementing) | bool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be auto-generated from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, not familiar with this - Can you give me a pointer? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 ways you can fix it:
|
||
|
||
#### Example Output | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
import diamond.collector | ||
import sys | ||
import urllib2 | ||
from diamond.collector import str_to_bool | ||
|
||
if sys.version_info >= (2, 5): | ||
import xml.etree.cElementTree as ElementTree | ||
|
@@ -35,6 +36,7 @@ def get_default_config_help(self): | |
" - memory (Global memory usage)\n", | ||
'publish_view_bind': "", | ||
'publish_view_meta': "", | ||
'derivative': "", | ||
}) | ||
return config_help | ||
|
||
|
@@ -63,13 +65,15 @@ def get_default_config(self): | |
# By default we don't publish these special views | ||
'publish_view_bind': False, | ||
'publish_view_meta': False, | ||
'derivative': True, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to add this to |
||
}) | ||
return config | ||
|
||
def clean_counter(self, name, value): | ||
value = self.derivative(name, value) | ||
if value < 0: | ||
value = 0 | ||
if str_to_bool(self.config['derivative']): | ||
value = self.derivative(name, value) | ||
if value < 0: | ||
value = 0 | ||
self.publish(name, value) | ||
|
||
def collect(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mode change???
100644 → 100755