Skip to content
Snippets Groups Projects
Commit 2de1ed03 authored by Alžbeta Hajná's avatar Alžbeta Hajná
Browse files

feat: metrics can be listed in prometheus

parent 88e24009
No related branches found
No related tags found
2 merge requests!54Merge develop into main,!42Resolve "Actuator"
......@@ -161,3 +161,13 @@ To stop container run
```bash
docker-compose down
```
## Collecting Metrics
To collect the metrics in an automated way we use Prometheus.
First, make sure that every service you want to observe is running on predefined port.
Then run Prometheus in docker with respect to location of `prometheus.yml` file:
```bash
docker run --rm --name prometheus -p 9090:9090 -v ${PWD}/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus:v2.43.0 --config.file=/etc/prometheus/prometheus.yml
```
......@@ -165,6 +165,12 @@
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Prometheus dependency -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -13,7 +13,7 @@ spring.cache.type=NONE
spring.profiles.active=dev
appconfig.enablecache=false
management.endpoints.web.exposure.include=info,health,metrics,loggers,beans,env
management.endpoints.web.exposure.include=info,health,metrics,loggers,beans,env,prometheus
management.endpoint.health.show-details=always
management.endpoint.health.show-components=always
management.endpoint.health.probes.enabled=true
......
global:
scrape_interval: 1s
external_labels:
monitor: 'my-monitor'
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['127.0.0.1:9090']
- job_name: 'formula-core'
metrics_path: /actuator/prometheus
static_configs:
- targets: [host.docker.internal:8080]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment