spring-boot-execution-metric-aspectj

Annotation-based execution metrics with AspectJ for spring boot 2.x applications. Prepared for Graphite.

License

License

Categories

Categories

Spring Boot Container Microservices AspectJ Development Tools Development Libraries
GroupId

GroupId

com.github.kuljaninemir
ArtifactId

ArtifactId

spring-boot-execution-metric-aspectj
Last Version

Last Version

1.0.12
Release Date

Release Date

Type

Type

jar
Description

Description

spring-boot-execution-metric-aspectj
Annotation-based execution metrics with AspectJ for spring boot 2.x applications. Prepared for Graphite.
Project URL

Project URL

https://github.com/kuljaninemir/spring-boot-execution-metric-aspectj
Source Code Management

Source Code Management

https://github.com/kuljaninemir/spring-boot-execution-metric-aspectj

Download spring-boot-execution-metric-aspectj

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.kuljaninemir/spring-boot-execution-metric-aspectj/ -->
<dependency>
    <groupId>com.github.kuljaninemir</groupId>
    <artifactId>spring-boot-execution-metric-aspectj</artifactId>
    <version>1.0.12</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.kuljaninemir/spring-boot-execution-metric-aspectj/
implementation 'com.github.kuljaninemir:spring-boot-execution-metric-aspectj:1.0.12'
// https://jarcasting.com/artifacts/com.github.kuljaninemir/spring-boot-execution-metric-aspectj/
implementation ("com.github.kuljaninemir:spring-boot-execution-metric-aspectj:1.0.12")
'com.github.kuljaninemir:spring-boot-execution-metric-aspectj:jar:1.0.12'
<dependency org="com.github.kuljaninemir" name="spring-boot-execution-metric-aspectj" rev="1.0.12">
  <artifact name="spring-boot-execution-metric-aspectj" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.kuljaninemir', module='spring-boot-execution-metric-aspectj', version='1.0.12')
)
libraryDependencies += "com.github.kuljaninemir" % "spring-boot-execution-metric-aspectj" % "1.0.12"
[com.github.kuljaninemir/spring-boot-execution-metric-aspectj "1.0.12"]

Dependencies

compile (4)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-web jar 2.0.4.RELEASE
org.springframework.boot : spring-boot-starter-actuator jar 2.0.4.RELEASE
io.micrometer : micrometer-registry-graphite jar 1.0.6
org.aspectj : aspectjrt jar 1.8.13

test (1)

Group / Artifact Type Version
com.jayway.jsonpath : json-path jar 0.9.1

Project Modules

There are no modules declared in this project.

Build Status HitCount contributions welcome

Spring boot execution metric aspectj for graphite

This dependency lets you:

  • Use Spring Boot 2.x metrics with AspectJ.
  • Use one annotation to measure counter, gauge and timed data.
  • Annotate any objects, not just spring components.
  • Minimal config to export data to Graphite.
  • Configure environment and app-name on the data.

Usage

Add the following dependencies:

<dependency>
  <groupId>com.github.kuljaninemir</groupId>
  <artifactId>spring-boot-execution-metric-aspectj</artifactId>
  <version>1.0.12</version>
</dependency>
<dependency>
  <groupId>org.aspectj</groupId>
  <artifactId>aspectjweaver</artifactId>
  <version>1.8.13</version>
</dependency>

Configure aspectj-maven-plugin and set it to weave this jar:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>aspectj-maven-plugin</artifactId>
  <version>1.11</version>
  <configuration>
    <complianceLevel>1.8</complianceLevel>
    <source>1.8</source>
    <target>1.8</target>
    <showWeaveInfo>true</showWeaveInfo>
    <verbose>true</verbose>
    <Xlint>ignore</Xlint>
    <encoding>UTF-8</encoding>
    <XnoInline>true</XnoInline>
    <proc>none</proc>
    <weaveDependencies>
      <weaveDependency>
        <groupId>com.github.kuljaninemir</groupId>
        <artifactId>spring-boot-execution-metric-aspectj</artifactId>
      </weaveDependency>
    </weaveDependencies>
  </configuration>
  <executions>
    <execution>
      <goals>
        <!-- use this goal to weave all your main classes -->
        <goal>compile</goal>
        <!-- use this goal to weave all your test classes -->
        <goal>test-compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Configure the properties as you like, for example:

management.metrics.export.graphite.host=localhost
management.metrics.export.graphite.port=8097
management.metrics.export.graphite.step=10s
management.metrics.export.graphite.tags-as-prefix=graphite-prefix-env,graphite-prefix-app
management.metrics.export.graphite.prefix-tag-env=dev
management.metrics.export.graphite.prefix-tag-app=myapp1
management.metrics.export.graphite.enabled=true
management.metrics.export.graphite.protocol=plaintext
management.metrics.web.server.auto-time-requests=true

Make sure you have a Configuration that scans this package:

@Configuration
@ComponentScan("com.github.kuljaninemir.springbootexecutionmetricaspectj")
public class MyConfig {
}

Compile with maven

mvn clean
mvn compile

Built With

  • Maven - Dependency Management

Versioning

I use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Versions

Version
1.0.12
0.0.3
0.0.1