Skip to content
Companion repo for the linked 2020 CodeMash session
Java HCL Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
1-simple-e2e
10-remote-infra
2-dimensions
3-registries
4-counters
5-gauges
6-timers
7-distribution-summaries
8-binders
9-actuator
docker-compose
gradle/wrapper
utils
.gitignore
README.md
build.gradle
gradlew
gradlew.bat
settings.gradle

README.md

JVM Application Monitoring with Micrometer, Prometheus, and Grafana

Requirements

First of all, join the Codemash Slack if you haven't already, then join #2020-jvm-observability-precompiler.

You're going to want to install Docker and some version of java >= 8 (I recommend sdkman for managing JVM versions).

Finally, from the root of the repository run ./gradlew precompile and you should be all set. Under the covers this runs some initial gradle builds for all the java projects to ensure that all maven dependencies have been downloaded, and also does an initial pull of all required docker images.

There's a chance of some last minute updates, so you'll probably want to pull and re-run that command shortly before CodeMash.

Gradle

There are a lot of moving parts in this workshop, and we're using Gradle to orchestrate them. We're using The Gradle Wrapper, which means that you don't need to install Gradle on your machine. Instead calling invoking ./gradlew or ./gradlew.bat automatically downloads and uses the appropriate gradle version.

All Gradle tasks should be run from the root of your repository.

The primary tasks you'll be concerned with are the Docker Compose tasks and the Spring Boot tasks found in each numbered directory (side note: all example application are Spring Boot applications).

Docker Compose tasks

  • ./gradlew docker-compose:up: Starts the containers for Prometheus and Grafana and friends
  • ./gradlew docker-compose:down: Stops all the workshop containers
  • ./gradlew docker-compose:pull: Pulls the images for each of the containers we're going to use. You shouldn't need to run this manually, as it's called by the ./gradlew precompile task
  • ./gradlew docker-compose:restartPrometheus: Restarts the Prometheus container, clearing existing metrics and reloading the configuration file
  • ./gradlew docker-compose:reloadPrometheus: Sends a SIGHUP interrupt to the Prometheus container, reloading configuration without deleting existing data

Spring Boot tasks

  • ./gradlew <directory>:bootRun: Starts the Spring Boot app in <directory>. The bootRun tasks have a hook added to copy the directory's Prometheus config file to the docker-compose directory and reload.

Each spring boot app runs at port 8000 + the numeric prefix, so exercise 1 runs on port 8001, and exercise 5 runs on port 8005.

Remote Infra links

Resources

You can’t perform that action at this time.