Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lab 08 — Metrics & Monitoring with Prometheus
What was done:
loggingnetwork with 15-day / 10GB TSDB retention and persistent named volumeapp-python:8000,loki:3100,grafana:3000,localhost:9090— all confirmed UPprometheus_client==0.23.1— addedhttp_requests_total(Counter),http_request_duration_seconds(Histogram),http_requests_in_progress(Gauge), anddevops_info_endpoint_calls_total(Counter) withmethod,endpoint,status_codelabels/metricsendpoint in FastAPI app; metrics recorded automatically via HTTP middleware withfinallyblock ensuring gauge always decrementshttp://prometheus:9090) and built "Prometheus Dashboard" with 6 panels covering the RED method: Request Rate, Error Rate, p95 Latency, Active Requests, Status Code Distribution, and Uptimedocker compose down/up/metricsBonus:
roles/monitoringAnsible role with Prometheus config template (prometheus-config.yml.j2) using Jinja2 loop overprometheus_scrape_targetsvariable listgrafana-datasources.yml.j2template — both Loki and Prometheus sources provisioned on deployapp-dashboard.jsoncopied via Ansiblefiles/and mounted into Grafana provisioning directorydefaults/main.yml: version, port, retention, scrape interval, resource limits, and scrape targetschanged=0