Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding prometheus metrics and tracing #81

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .prometheus/prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"

scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: "prometheus"
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ["localhost:9090"]

- job_name: veryrezsi_server
static_configs:
- targets: ["veryrezsi_server:3001"]
4 changes: 2 additions & 2 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG client_url=http://localhost:3000
ARG client_url=http://localhost:4000
ARG backend_url=http://veryrezsi_server:8000/api

# Stage BUILD
Expand Down Expand Up @@ -29,5 +29,5 @@ COPY --from=builder /app/build ./
# clean install dependencies, no devDependencies, no prepare script
RUN npm ci --omit=dev --ignore-scripts --no-audit

EXPOSE 3000
EXPOSE 4000
CMD ["node", "./index.js"]
12 changes: 11 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,23 @@ services:
- 1025:1025 # smtp server
- 8025:8025 # web ui

prometheus:
container_name: veryrezsi_prometheus
image: prom/prometheus
volumes:
- ./.prometheus:/etc/prometheus
command: --config.file=/etc/prometheus/prometheus.yml
ports:
- 9090:9090

server:
container_name: veryrezsi_server
build:
context: ./server
dockerfile: Dockerfile
ports:
- "8000:8000"
- "3001:3001"
depends_on:
smtp:
condition: service_started
Expand All @@ -45,4 +55,4 @@ services:
context: ./client
dockerfile: Dockerfile
ports:
- "3000:3000"
- "4000:3000"
139 changes: 134 additions & 5 deletions server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ members = [
[workspace.package]
authors = [
"Attila Szőke <[email protected]>",
# TODO dönisz was here
"Dénes Javorek <[email protected]>"
]
edition = "2021"
license = "MIT"
Expand All @@ -28,7 +28,7 @@ chrono = "0.4.26"
sea-orm = "0.11.3"
serde = "1.0.163"
serde_json = "1.0.96"
tokio = "1.28.2"
tokio = "1.28.2"
tracing = "0.1.37"
tracing-subscriber = "0.3.17"
pwhash = "1.0.0"
Expand Down
3 changes: 3 additions & 0 deletions server/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ validator = { workspace = true }
axum = "0.6.18"
axum-extra = { version = "0.7.4", features = ["cookie-private"] }
axum-macros = "0.3.7"
metrics = "0.21.1"
metrics-exporter-prometheus = "0.12.1"
tower = "0.4.13"
tower-http = { version = "0.3.4", features = ["trace"] }
Loading
Loading