-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this is a squash commit of all couchbase commits from minodes/newrelic-plugin-agent: - 33c9162 fix JSON access - 4e06957 read basicStats from all couchbase buckets - eb58aa6 basicStats now per bucket sent to newrelic - ede17dc add couchbase support the original branch used in pull request #404 had a bunch of garbage commits related to other plugins (nagiorelic). i cleaned the unrelated stuff and squashed everything to a single commit
- Loading branch information
Showing
5 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
""" | ||
couchbase | ||
""" | ||
|
||
from newrelic_plugin_agent.plugins import base | ||
|
||
|
||
class Couchbase(base.JSONStatsPlugin): | ||
|
||
GUID = 'com.meetme.couchbase' | ||
|
||
def add_datapoints(self, stats): | ||
for bucket_data in stats: | ||
bucket_name = bucket_data['name'] | ||
bucket_stats = bucket_data['basicStats'] | ||
if bucket_stats: | ||
""" Example JSON | ||
"basicStats":{ | ||
"quotaPercentUsed":7.548735046386719, | ||
"opsPerSec":0, | ||
"diskFetches":0, | ||
"itemCount":2222, | ||
"diskUsed":229366539, | ||
"dataUsed":203511808, | ||
"memUsed":79154224 | ||
} | ||
""" | ||
self.add_gauge_bucket_metric( | ||
bucket_name, 'quotaPercentUsed', 'percent', bucket_stats['quotaPercentUsed'] | ||
) | ||
self.add_gauge_bucket_metric( | ||
bucket_name, 'opsPerSec', 'ops', bucket_stats['opsPerSec'] | ||
) | ||
self.add_gauge_bucket_metric( | ||
bucket_name, 'diskFetches', 'count', bucket_stats['diskFetches'] | ||
) | ||
self.add_gauge_bucket_metric( | ||
bucket_name, 'itemCount', 'count', bucket_stats['itemCount'] | ||
) | ||
self.add_gauge_bucket_metric( | ||
bucket_name, 'diskUsed', 'Byte', bucket_stats['diskUsed'] | ||
) | ||
self.add_gauge_bucket_metric( | ||
bucket_name, 'dataUsed', 'Byte', bucket_stats['dataUsed'] | ||
) | ||
self.add_gauge_bucket_metric( | ||
bucket_name, 'memUsed', 'Byte', bucket_stats['memUsed'] | ||
) | ||
|
||
# Summary metrics | ||
self.add_gauge_value('Summary/%s/quotaPercentUsed' % bucket_name, 'percent', | ||
bucket_stats['quotaPercentUsed'], | ||
min_val=0, max_val=0) | ||
self.add_gauge_value('Summary/%s/diskUsed' % bucket_name, 'byte', | ||
bucket_stats['diskUsed']) | ||
|
||
def add_gauge_bucket_metric(self, bucket_name, metric_name, units, metric_value): | ||
if metric_value: | ||
self.add_gauge_value('%s/%s' % (bucket_name, metric_name), units, metric_value) |