Stackify Metrics AspectJ AOP Extension

AspectJ AOP Extension for the Stackify Metrics API

License

License

Categories

Categories

AspectJ Development Tools Development Libraries Metrics Application Testing & Monitoring Monitoring
GroupId

GroupId

com.stackify
ArtifactId

ArtifactId

stackify-metrics-aspectj
Last Version

Last Version

2.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Stackify Metrics AspectJ AOP Extension
AspectJ AOP Extension for the Stackify Metrics API
Project URL

Project URL

https://github.com/stackify/stackify-metrics-aspectj
Project Organization

Project Organization

Stackify, LLC
Source Code Management

Source Code Management

https://github.com/stackify/stackify-metrics-aspectj

Download stackify-metrics-aspectj

How to add to project

<!-- https://jarcasting.com/artifacts/com.stackify/stackify-metrics-aspectj/ -->
<dependency>
    <groupId>com.stackify</groupId>
    <artifactId>stackify-metrics-aspectj</artifactId>
    <version>2.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.stackify/stackify-metrics-aspectj/
implementation 'com.stackify:stackify-metrics-aspectj:2.1.0'
// https://jarcasting.com/artifacts/com.stackify/stackify-metrics-aspectj/
implementation ("com.stackify:stackify-metrics-aspectj:2.1.0")
'com.stackify:stackify-metrics-aspectj:jar:2.1.0'
<dependency org="com.stackify" name="stackify-metrics-aspectj" rev="2.1.0">
  <artifact name="stackify-metrics-aspectj" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.stackify', module='stackify-metrics-aspectj', version='2.1.0')
)
libraryDependencies += "com.stackify" % "stackify-metrics-aspectj" % "2.1.0"
[com.stackify/stackify-metrics-aspectj "2.1.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.stackify : stackify-metrics jar 2.1.0
org.aspectj : aspectjrt jar 1.8.1

test (6)

Group / Artifact Type Version
org.slf4j : slf4j-log4j12 jar 1.7.5
junit : junit jar 4.11
org.mockito : mockito-core jar 1.9.5
org.powermock : powermock-core jar 1.5.6
org.powermock : powermock-module-junit4 jar 1.5.6
org.powermock : powermock-api-mockito jar 1.5.6

Project Modules

There are no modules declared in this project.

stackify-metrics-aspectj

Maven Central Build Status Coverage Status

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:

<dependency>
    <groupId>com.stackify</groupId>
    <artifactId>stackify-metrics-aspectj</artifactId>
    <version>INSERT_LATEST_MAVEN_CENTRAL_VERSION</version>
</dependency>

Configure the aspectj-maven-plugin to compile-time weave the stackify-metrics-aspectj aspects into your project:

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <configuration>
                <aspectLibraries>
                    <aspectLibrary>
                        <groupId>com.stackify</groupId>
                        <artifactId>stackify-metrics-aspectj</artifactId>
                    </aspectLibrary>
                </aspectLibraries>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

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.

@Gauge(category = "MyCategory", name = "MyGauge")
...

Be sure to properly shutdown to flush any queued metrics and shutdown the background thread:

MetricManager.shutdown();

Configuration

See https://github.com/stackify/stackify-metrics#configuration

Gauge Metric

// 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

// Equivalent to
//     MetricFactory.getCounter("MyCategory", "MyCounter").increment()
@Counter(category = "MyCategory", name = "MyCounter")
...

Average Metric

// 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

// 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

// 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.

com.stackify

Stackify

Stackify helps developers manage and troubleshoot application problems with integrated monitoring, metrics, errors & logs.

Versions

Version
2.1.0
1.1.0
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0