This project shows an example of a metric gathering extension for a web application based on these requirements. The “extension” is loosely coupled with the app to gathers metrics on requests and responses handled by the web application.
In the code you'll see the following two projects:
meme-app
, a sample web application that serves memes.
metrics-collection-agent
, an aspectJ based project that is an external dependency to the meme-app
. The agent collects metrics on the web application's request and response by weaving aspects during compile time.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Java8
Maven
These instructions applies for *nix based systems.
git clone [email protected]:trouseredApe/metrics-agent.git - to get the source code for both projects
cd metrics-agent/metrics-collection-agent
mvn install
Import and build `meme-app` as a maven project in IntellJ
Run `Application.java` class
If everything worked correctly you should see the web-app running at localhost:8080
. Click the More
link on the page to load a few memes and access the request and response metrics at localhost:8080/metrics
page
The in-memory database can be accessed at localhost:8080/h2-console
. Make sure to use jdbc:h2:mem:testdb
as datasource url.
You can run the unit tests inside your ide or run mvn test
from the project's root folder
- spring-boot - Opinionated spring based framework with embedded web-server
- AspectJ - Cross cutting concern
- Maven - Dependency Management
- Travis CI - CI / CD