Giter VIP home page Giter VIP logo

java-metric-agent's Introduction

java-metric-agent

Build Status License Language grade: Java

The java metric agent is a metric-gathering extension for a web application. It gathers metrics about requests and responses served by the application.

  • Uniquely identify every Http Request/Response pair by Response Header 'X-Metric-Trace-Id'.
  • Embedded http server to display gathered metrics on the fly and to look up historical request time/response size by the unique identifier.
  • Support Request Time Metric to measure time spent between when the application starts to process the request, and the time when the application sends the response to the client.
  • Support Response Sizes to measure the size of the HTTP response body in bytes.

How to use

  1. Build the agent jar, see section Building.
  2. Copy jar file on the path: /agent/build/libs/agent-all.jar
  3. To install the Java agent you need to configure your JVM to load the agent by passing the -javaagent:/full/path/to/agent-all.jar command-line argument.

Building

The Java agent requires JDK 1.8.0_265 to build; your JAVA_HOME must be set to this JDK version.

To build the agent jar, run the following command from the project root directory:
./gradlew clean agent:shadowJar

To build and run all checks:
./gradlew clean build

After building, Java agent artifacts folder:

  • Agent: agent/build/shadowJar/agent.jar

Testing

To run unit tests: ./gradlew test

To run integration tests: ./gradlew integrationTest

Local Sample application

To run the application: ./gradlew bootRun

Open in Chrome with dev tools: http:\\localhost:3030\

Screenshot-2020-09-26-at-18-44-01.png

Each response has header 'X-Metric-Trace-Id' with UUID to fetch request/response metrics on page: http:\\localhost:8081\

Screenshot-2020-09-26-at-18-55-28.png

  • requestOperationTime is Request Time Metric to measure time spent between when the application starts to process the request, and the time when the application sends the response to the client;
  • responseBodyLength is Response Size Metric to measure the size of the HTTP response body in bytes.

Future features:

  • support Java 8+ runtimes;
  • make configurable agent initialization. I.e. embedded server port, etc;
  • provide the agent api jar to record custom metrics in user application;
  • add more build-in metrics. I.e. JVM GC, servlet containers stats.

License

MIT

java-metric-agent's People

Contributors

arlabunakty avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.