Skip to content

Commit

Permalink
Merge pull request #34 from Academic-Weapons/monitor
Browse files Browse the repository at this point in the history
Monitor
  • Loading branch information
Magmose authored Mar 14, 2023
2 parents 68eddb6 + 5854e5e commit b01fd9d
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 59 deletions.
5 changes: 2 additions & 3 deletions MiniTwit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ FROM openjdk:17-oracle



COPY --from=maven-builder app/target/MiniTwit-0.0.4.war /app-service/MiniTwit-0.0.4.war
COPY --from=maven-builder app/target/MiniTwit-0.0.5.war /app-service/MiniTwit-0.0.5.war
COPY minitwit.db /app-service/minitwit.db
WORKDIR /app-service


EXPOSE 8080
ENTRYPOINT ["java","-jar","MiniTwit-0.0.4.war"]

ENTRYPOINT ["java","-jar","MiniTwit-0.0.5.war"]
19 changes: 0 additions & 19 deletions MiniTwit/application.yml

This file was deleted.

2 changes: 1 addition & 1 deletion MiniTwit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>dk.itu</groupId>
<artifactId>MiniTwit</artifactId>
<version>0.0.4</version>
<version>0.0.5</version>
<packaging>war</packaging>
<name>MiniTwit</name>
<description>MiniTwit</description>
Expand Down
24 changes: 24 additions & 0 deletions MiniTwit/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#management:
# endpoints:
# web:
# base-path: /actuator
# exposure:
# include: '*'
# endpoint:
# health:
# show-details: always
# metrics:
# enabled: true
# prometheus:
# enabled: true
spring:
application:
name: spring-prometheus-demo
management:
endpoints:
web:
exposure:
include: health, metrics, prometheus
metrics:
tags:
application: ${spring.application.name}
38 changes: 23 additions & 15 deletions Scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
prometheus:
image: prom/prometheus
container_name: prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
networks:
- main
version: '3.5'

grafana:
image: grafana/grafana:4.5.2
ports:
- "3000:3000"
networks:
- main
services:
prometheus:
image: prom/prometheus
container_name: prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
networks:
- main

grafana:
image: grafana/grafana:4.5.2
container_name: grafana
ports:
- "3000:3000"
networks:
- main

networks:
main:
name: itu-minitwit-network
50 changes: 29 additions & 21 deletions Scripts/prometheus.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_interval: 15s # Evaluate rules every 15 seconds.
scrape_configs:
- job_name: 'minitwit'
metrics_path: '/actuator/prometheus'
scrape_interval: 30s
static_configs:
- targets: ['host.docker.internal:8081']
labels:
application: 'minitwit'
# global:
# scrape_interval: 15s # By default, scrape targets every 15 seconds.
# evaluation_interval: 15s # Evaluate rules every 15 seconds.

# Attach these extra labels to all timeseries collected by this Prometheus instance.
external_labels:
monitor: 'codelab-monitor'
# # Attach these extra labels to all timeseries collected by this Prometheus instance.
# external_labels:
# monitor: 'codelab-monitor'

rule_files:
- 'prometheus.rules.yml'
# rule_files:
# - 'prometheus.rules.yml'

scrape_configs:
- job_name: 'prometheus'
# scrape_configs:
# - job_name: 'prometheus'

# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 60s
# # Override the global default and scrape targets from this job every 5 seconds.
# scrape_interval: 5s

static_configs:
- targets: ['prometheus:9090']
# static_configs:
# - targets: ['prometheus:9090']

- job_name: 'itu-minittwit-app'
# - job_name: 'itu-minittwit-app'

# Override the global default and scrape targets from this job every 5 seconds.
scrape_interval: 60s
# # Override the global default and scrape targets from this job every 5 seconds.
# scrape_interval: 5s

static_configs:
- targets: ['minitwit:8081']
labels:
group: 'production'
# static_configs:
# - targets: ['host.docker.internal:8081']
# labels:
# group: 'production'

0 comments on commit b01fd9d

Please sign in to comment.