{"id":15921930,"url":"https://github.com/mloning/minimal-python-app-monitoring","last_synced_at":"2026-04-18T01:31:37.432Z","repository":{"id":130571805,"uuid":"524719844","full_name":"mloning/minimal-python-app-monitoring","owner":"mloning","description":"Minimal Python app monitoring on k8s with Grafana Loki","archived":false,"fork":false,"pushed_at":"2022-08-28T12:47:28.000Z","size":6,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-03T15:54:19.302Z","etag":null,"topics":["grafana","grafana-loki","k8s","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mloning.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-14T16:13:28.000Z","updated_at":"2024-07-02T00:17:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"a44384eb-093f-406f-adfc-9c2b92264fa0","html_url":"https://github.com/mloning/minimal-python-app-monitoring","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mloning/minimal-python-app-monitoring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mloning%2Fminimal-python-app-monitoring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mloning%2Fminimal-python-app-monitoring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mloning%2Fminimal-python-app-monitoring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mloning%2Fminimal-python-app-monitoring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mloning","download_url":"https://codeload.github.com/mloning/minimal-python-app-monitoring/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mloning%2Fminimal-python-app-monitoring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31953509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"ssl_error","status_checked_at":"2026-04-18T00:39:20.671Z","response_time":62,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grafana","grafana-loki","k8s","python"],"created_at":"2024-10-06T20:02:57.503Z","updated_at":"2026-04-18T01:31:37.385Z","avatar_url":"https://github.com/mloning.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minimal Python app monitoring on k8s with Grafana Loki\n\n## Requirements\n\n* [Docker](http://docker.com)\n* [minikube](https://github.com/kubernetes/minikube) (or some other Kubernetes cluster)\n* [kubectl](https://kubernetes.io/docs/tasks/tools/)\n* [helm](http://helm.sh)\n\n## Start minikube\n\n```bash\nminikube start\n```\n\n##  Install monitoring stack\n\n```bash\nhelm repo add grafana https://grafana.github.io/helm-charts\nhelm repo update\nhelm upgrade loki-stack grafana/loki-stack \\\n    --install \\\n    --namespace=monitoring \\\n    --create-namespace \\\n    --values ./helm/loki-stack-values.yaml\n```\n\nWait for all resource to be available: `kubectl get pods -n monitoring -w`.\n\nFor details, see the [loki-stack](https://github.com/grafana/helm-charts/tree/main/charts/loki-stack) Helm chart.\n\n## Connect to Grafana dashboard\n\n```bash\nkubectl port-forward service/loki-stack-grafana 3000:80 -n monitoring\n```\n\nwhere `80` is the Grafana service port. To look up the port, run: `kubectl get service -n monitoring | grep grafana`.\n\nYou can now log in to dashboard at [http://localhost:3000/](http://localhost:3000/).\n\nTo get the login credentials, run:\n\n```bash\nkubectl get secret loki-stack-grafana -n monitoring -o jsonpath='{.data.admin-user}' | base64 --decode; echo\nkubectl get secret loki-stack-grafana -n monitoring -o jsonpath='{.data.admin-password}' | base64 --decode; echo\n```\n\nwhere `loki-stack-grafana` is the name of the config map.\n\n## Install minimal Python app\n\nThe application is based on an [example](https://github.com/JasonHaley/hello-python) from the [Kubernetes blog](https://kubernetes.io/blog/2019/07/23/get-started-with-kubernetes-using-python/).\n\n### Test app in Docker (optional)\n\n```bash\ndocker build . -t minimal-app:latest\ndocker run --rm -p 5001:5000 minimal-app:latest\n```\n\nTo check the app in Docker, open [http://localhost:5001/](http://localhost:5001/).\n\n### Build image\n\n```bash\neval $(minikube docker-env)\ndocker build . -t minimal-app:latest\n```\n\nThe first line enables us to [use local images in minikube](https://minikube.sigs.k8s.io/docs/commands/docker-env/), when we set the image pull policy to \"Never\" in the k8s manifest files. This works by pointing your terminal's Docker client to the Docker client used inside minikube.\n\n### Run app in Kubernetes\n\n```bash\nkubectl apply -f ./k8s/\nkubectl port-forward service/minimal-app-service 5001:6000 \n```\n\nTo check the app, open [http://localhost:5001/](http://localhost:5001/) (or [http://localhost:5001/docs](http://localhost:5001/docs) for API docs).\n\n## View logs\n\nTo view logs on the Grafana dashboard, go to the [Explore](https://grafana.com/docs/grafana/latest/explore/) page and select Loki as the data source.\n\nTo filter out the application logs, run this [LogQL](https://grafana.com/docs/loki/latest/logql/) query:\n\n```bash\n{app=\"minimal-app\"} |= `` \n```\n\nTo view logs in k8s, run:\n\n```bash\nkubectl logs -f -l app=minimal-app\n```\n\n##  Clean up\n\n```bash\nminikube stop\nminikube delete\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmloning%2Fminimal-python-app-monitoring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmloning%2Fminimal-python-app-monitoring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmloning%2Fminimal-python-app-monitoring/lists"}