https://github.com/stackify/stackify-metrics-aspectj
AspectJ AOP Extension for the Stackify Metrics API
https://github.com/stackify/stackify-metrics-aspectj
Last synced: 8 months ago
JSON representation
AspectJ AOP Extension for the Stackify Metrics API
- Host: GitHub
- URL: https://github.com/stackify/stackify-metrics-aspectj
- Owner: stackify
- License: apache-2.0
- Created: 2014-08-28T19:11:13.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-10-31T19:55:19.000Z (over 7 years ago)
- Last Synced: 2025-07-20T22:24:31.978Z (11 months ago)
- Language: Java
- Size: 24.4 KB
- Stars: 2
- Watchers: 13
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
stackify-metrics-aspectj
========================
[](http://mvnrepository.com/artifact/com.stackify/stackify-metrics-aspectj)
[](https://travis-ci.org/stackify/stackify-metrics-aspectj)
[](https://coveralls.io/r/stackify/stackify-metrics-aspectj?branch=master)
AspectJ AOP Extension for the Stackify Metrics API (https://github.com/stackify/stackify-metrics)
Custom Metrics Overview:
http://support.stackify.com/custom-metrics-overview/
Sign Up for a Trial:
http://www.stackify.com/sign-up/
## Installation
Add it as a maven dependency:
```xml
com.stackify
stackify-metrics-aspectj
INSERT_LATEST_MAVEN_CENTRAL_VERSION
```
Configure the aspectj-maven-plugin to compile-time weave the stackify-metrics-aspectj aspects into your project:
```xml
org.codehaus.mojo
aspectj-maven-plugin
com.stackify
stackify-metrics-aspectj
compile
```
## Usage
There are four different types of metrics:
* Gauge: Keeps track of the last value that was set in the current minute
* Counter: Calculates the rate per minute
* Average: Calculates the average of all values in the current minute
* Timer: Calculates the average elapsed time for an operation in the current minute
* CounterAndTimer: Composite of the Counter and Timer metrics for convenience
All metrics are identified with a category and name. We will group metrics with the same category when they are displayed in Stackify. See below for more details on the operations available for each type of metric.
```java
@Gauge(category = "MyCategory", name = "MyGauge")
...
```
Be sure to properly shutdown to flush any queued metrics and shutdown the background thread:
```java
MetricManager.shutdown();
```
#### Configuration
See https://github.com/stackify/stackify-metrics#configuration
#### Gauge Metric
```java
// Equivalent to
// MetricFactory.getGauge("MyCategory", "MyGauge").set(v)
// where v is the return value of the method annotated
@Gauge(category = "MyCategory", name = "MyGauge")
...
```
#### Counter Metric
```java
// Equivalent to
// MetricFactory.getCounter("MyCategory", "MyCounter").increment()
@Counter(category = "MyCategory", name = "MyCounter")
...
```
#### Average Metric
```java
// Equivalent to
// MetricFactory.getAverage("MyCategory", "MyAverage").addValue(v)
// where v is the return value of the method annotated
@Average(category = "MyCategory", name = "MyAverage")
...
```
#### Timer Metric
```java
// Equivalent to
// MetricFactory.getTimer("MyCategory", "MyTimer").startMs(v)
// where v is the start time of the method annotated
@Timer(category = "MyCategory", name = "MyTimer")
...
```
#### CounterAndTimer Metric
```java
// Equivalent to
// MetricFactory.getCounterAndTimer("MyCategory", "MyCounterAndTimer").startMs(v)
// where v is the start time of the method annotated
@CounterAndTimer(category = "MyCategory", name = "MyCounterAndTimer")
...
```
## License
Copyright 2014 Stackify, LLC.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.