Skip to content

samiwelthomasHO/sre-demo-java-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sre-demo-java-app

This project is for use testing custom metrics from a Java application againt the Monitoring-as-code framework.

How to build

The demo Java application can be run using Docker.

There is a Dockerfile in the root of this repository, which can be built simply by running:

docker build -t sre-demo-java-app .

How to run

Once built, the application can be run using the following command:

docker run -ti -p 8081:8080 sre-demo-java-app

Navigate to http://localhost:8081 and the application should serve a simple HTML page for testing purposes.

How to integrate with MaC

  1. Add a new target file definition into prometheus/file_sd_configs/<your-app-name>_target.json. See here for more information.

    The file should contain a target definition of the format:

    [
    {
        "labels": {
        "job": "custom-java-app",
        "__metrics_path__": "/actuator/prometheus",
        "namespace": "localhost"
        },
        "targets": [
            "host.docker.internal:8081"
        ]
    }
    ]
    
  2. Ensure that the custom java application is reachable from the prometheus container.

    If running a local environment using Docker compose, both containers should be on the same network and have the ability to communicate.

  3. Interact with the exposed HTML page to generate some custom metrics.

  4. Define the custom metric types configuration based on the metrics exported from this demo application and configure appropriate SLI config in the mixin files.

  5. Modify the deploy.sh file within the MaC framework, or run the MaC docker image to generate the recording and alerting rules for the custom metric type.

  6. The metrics should then be visible from within the Prometheus web client and available to see within Grafana dashboards.

About

No description, website, or topics provided.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published