28 Commits

Author SHA1 Message Date
Joseph Davis
f2e1f03fc8 Improve metric error handling
flush() should not produce a metric if value is None (causes
exception in monasca-api).
Fix the exception message in flush() to use the correct data
structure.

Change-Id: I62d31270db9e70f16d2a38a73856009c52c098e6
Story: 2004276
Task: 27825
2018-11-06 12:49:18 -08:00
Jui Chandwaskar
c983708637 Add Apache License
Added Apache 2.0 License for missed files

Change-Id: I72217d3cf0089434a9bbe1e5dfd57224a803704e
Signed-off-by: Jui Chandwaskar <jchandwaskar@op5.com>
2018-04-14 11:50:07 +00:00
Jui Chandwaskar
f837eee559 Update pep8 checks
* set the maximum line length to 100
* cleaned up the codes for pep8

Depends-On: https://review.openstack.org/560844
Change-Id: Id548b78b673cce869ef8291bdb6b4f1367b383ed
Signed-off-by: Jui Chandwaskar <jchandwaskar@op5.com>
2018-04-12 11:05:01 +00:00
Joachim Barheine
170c3e45e8 Partial support for DogStatsd extensions
* Support tags
* Support timer (provisional by mapping metric type 'ms' to 'gauge')
* Support histograms (same)
* Support service-checks (by mapping status to gauge)
* Fix calculation of counters for sporadic metrics and sample-rates < 1

Story: 2000951
Task: 4079
Task: 3944
Change-Id: Ib4996b88a2845bceda9c803a386b76b2e0ae125a
2017-03-28 08:40:00 +00:00
Jenkins
984f3b37fb Merge "Adding unit tests" 2016-08-11 15:15:58 +00:00
Joe Keen
b80f070c57 Adding unit tests
Adding unit tests for metric types.

Fixing bug in log message.

Change-Id: I66e4279dfaad2f67d80b46a7eaf594f93c35d62f
Depends-On: Ibcf73b5ac661f4c0575f2dfb7d2d973d3c006fe2
2016-08-09 15:13:20 -06:00
Kaiyan Sheng
8c9d236835 Duplicate code in rate metrics
Rate metrics are no longer being output by the Monasca Agent because
of the duplicate code.

Change-Id: Ibcf73b5ac661f4c0575f2dfb7d2d973d3c006fe2
2016-08-09 11:55:36 -06:00
Craig Bryant
585c7e86d9 Need to send 0 values for Gauges
Old code was using if not self.value: which does not work correctly
for a value of 0 which is a valid value for a Gauge

Change-Id: I4a39eaa156676ced5a0c07db781e5292d69a2e60
Closes-Bug: #1610719
2016-08-07 12:14:11 -06:00
Jenkins
8369fffc18 Merge "Changing conditional if we should send a rate metric or not." 2016-08-03 15:14:17 +00:00
Kaiyan Sheng
9dc0e21205 self.name doesn't exist in Rate and Counter object
Saw error message in collector log showing:
AttributeError: 'Rate' object has no attribute 'name'

In the new base metric class init function, variable name
got passed into self.metric. That's why self.name doesn't
exist anymore.

Change-Id: Idfd2fe5d257332327449e2766544dd36d8a003c1
2016-08-02 14:27:41 -06:00
Michael James Hoppal
8349f47279 Changing conditional if we should send a rate metric or not.
Right now if the rate is zero we will not send a metric changing
to check for None

Change-Id: Idfc888929955855057aaedea13f487e0a8ec2dd5
2016-08-02 12:21:44 -06:00
Joe Keen
c0393c46f9 Remove measurement transformation from forwarder
The forwarder modified the timestamp and possibly the tenant_id of every
measurement sent to it.  This modification does the processing on those
attributes in the collector and sends the forwarder the final set of data.

Value meta can't be part of the context used to determine if we have a new
metric.  Value meta can change while the metric itself remains the same which
means that we construct a new metric object each time we get a new value meta
value.  This doesn't have any effect on Gauge metrics but Counter and Rate
metrics return invalid data as value meta changes.  To fix this value meta is
now applied to each sample instead of being assigned during __init__.

Change-Id: I1d6a52266755b2e20149ef7ec6eb76fe2459b2a8
Closes-Bug: #1596686
2016-07-22 16:20:49 -06:00
Kaiyan Sheng
5c821716a2 Add log.exception to get more info
Also report the actual value in the log message to
help debugging later on.
Removed 'raise e' because we don't want to raise an
exception in sample() and lose the metrics after it

Change-Id: I9f9cbc492ef17a484cfefca1188d295c490d8578
2016-07-19 16:27:02 -06:00
Michael James Hoppal
b2211aa0eb Add HPE copyright
Change-Id: I46efbc9be90a8415e60f3db76656e7db3d7bcb54
2016-02-02 10:34:10 -07:00
Joe Keen
1ded0b7b1c Fixing flake8 errors now that tox is working again
Change-Id: Id34991711c57f20922f003928008143032723af3
2015-07-30 14:47:02 -06:00
Ryan Brandt
ef6d405492 Fix histogram list construction
Change-Id: I513f281d60f56f647888f01bc92bd544e01aeac7
2015-05-11 11:43:04 -06:00
Jenkins
68b0c4b0f8 Merge "Exception wrapper to handle type errors" 2015-04-08 22:35:32 +00:00
David Schroeder
6273c0586d Fix in-place operation on reset values
If a value is reset on flush(), it will subsequently fail
on sample().  This seems to affect a subset of statsd metrics,
filling the log with "Error receiving datagram" messages.

This patch also fixes a couple very minor PEP8 issues.

Change-Id: I7dfb3b62fcf110ba7dd0ef2d3e6f40ee7c1891ef
2015-04-08 15:38:41 -06:00
Dexter Fryar
08828a7f8f Exception wrapper to handle type errors
If an invalid metric type makes it through StatsD we can handle
it more gracefully by logging the type error instead of producing
a stack dump.

Change-Id: I05c0042d9132efc2a856db43923873f1f6bcb3d2
2015-04-07 21:13:00 -05:00
Gary Hessler
b9a55a00a1 Adding value_meta to certain metrics
The value_meta parameter was recently added to the
monasca-api.  This allows the addition of meta-information
to be sent with any metrics that are sent from the agent.
value_meta was added for the http_status, nagios_wrapper,
and host_alive checks in the agent.  Also, consolidated
some of the duplicate exception handling and reformatted
some code blocks.

Change-Id: I3d9e9a8e54cd2582bde47c7c128a3788b821c156
2015-03-30 20:27:12 -06:00
Gary Hessler
9233bd557d Fixing issue with disk metrics
Some disk partitions do not have associated I/O metrics.  This
was causing an exception when trying to retrieve them. If the
partition doesn't have I/O metrics, just skip it. Also, fixed
an issue where the dimensions were not getting updated correctly.

Change-Id: Ie984e1fe589f9356b4009d613fe7d1e0f4e18439
2015-03-17 11:19:33 -06:00
Gary Hessler
10ad9ae17a Removed the monasca_statsd_agregator_interval. This was related
to the normalize functionality that was removed in the past and
was causing errors in the Histogram and Counter calculations in
statsd metrics.

Change-Id: I36ac2d2d7598c00b1b33dbb2cfa81c56145e398b
2015-02-23 09:12:10 -07:00
gary-hessler
f37150d0a8 Fixing rate metrics
Fixed issue with flushing of metrics.  Also cleaned up the code
some and rearranged code to avoid a double try block in the Rate
class.

Change-Id: I51148f8b73009dc2ec1f616ef68614e05bbda84d
2015-02-03 16:53:49 -07:00
gary-hessler
42f7c5ac16 Adding apache web server monitoring for OpenStack
Change-Id: I0c50e1d2825dd6324ef8ebd4b3a1bc32e1b2a3d5
2015-02-03 10:07:58 -07:00
gary-hessler
a2a8fc01a2 Removed the BucketGauge class as it is not used anymore.
Recently changed the statsd aggregator to use the Gauge instead
of the BucketGauge.  BucketGauge class not used anymore.

Change-Id: I60faad0299a533f3beb383f4f0bf0ceb9bd32c90
2015-01-22 19:42:59 -07:00
Tim Kuhlman
ae7ee7d840 Remove functionality that sends 0 values when counters don't report
Also I removed the expiry check on flushing metrics, there is already a
check on submission to see if a submitted metric is old. This would only
catch metrics that were submitted correctly but took to long to be
processed by the collector.

Lastly I removed the MetricsBucketAggregator and combined all things
into a single aggregator. Only statsd was using the bucket aggregator
and there is no advantage over the other.

Change-Id: I1a2a0c9941a95558036233e61ac3f5f395ed54d5
2015-01-13 15:01:32 -07:00
Tim Kuhlman
82a870928b Various fixes and code cleanup related to monasca statsd
Fixed duplicate metrics being created for each statsd counter.
Fixed accidental setting of device_name for statsd counters.
Standardized to 20 second report times.

Change-Id: I55db0d59d783da19cffa53e7c34eff91f55db840
2015-01-06 09:07:11 -07:00
gary-hessler
34d82d455e Renaming agent packages to reflect monasca
Renamed monagent package to monasca_agent and monsetup package to monasca_setup.
Also, renamed the monstatsd agent package to statsd to more closely match the internal
collector and forwarder packages.

Change-Id: I0649ae4341fe325007e2a8d37161d330e4c95d72
2014-12-19 09:22:03 -07:00