forked from inno-devops-labs/S24-core-course-labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from kolayne-IU-assignments/lab8
Lab8
- Loading branch information
Showing
17 changed files
with
245 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
module catfact_webapp | ||
|
||
go 1.21.6 | ||
|
||
require github.com/prometheus/client_golang v1.19.0 | ||
|
||
require ( | ||
github.com/beorn7/perks v1.0.1 // indirect | ||
github.com/cespare/xxhash/v2 v2.2.0 // indirect | ||
github.com/prometheus/client_model v0.5.0 // indirect | ||
github.com/prometheus/common v0.48.0 // indirect | ||
github.com/prometheus/procfs v0.12.0 // indirect | ||
golang.org/x/sys v0.16.0 // indirect | ||
google.golang.org/protobuf v1.32.0 // indirect | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= | ||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= | ||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= | ||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= | ||
github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= | ||
github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= | ||
github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= | ||
github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= | ||
github.com/prometheus/common v0.48.0 h1:QO8U2CdOzSn1BBsmXJXduaaW+dY/5QLjfB8svtSzKKE= | ||
github.com/prometheus/common v0.48.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= | ||
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= | ||
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= | ||
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= | ||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= | ||
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
Flask~=3.0.0 | ||
requests~=2.31.0 | ||
prometheus_client~=0.20.0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Prometheus metrics | ||
|
||
## Screenshots | ||
|
||
![Prometheus targets](pics/prometheus_targets.png) | ||
|
||
![Grafana promtail dashboard](pics/grafana_promtail_dashboard.png) | ||
|
||
![Grafana prometheus dashboard (impoarted)](pics/grafana_prometheus_dashboard_(imported).png) | ||
|
||
## Enhancements | ||
|
||
Grafana, Loki, and Promtail each have the RAM limit of 100MiB, Prometheus's memory is limited | ||
to 50MiB, limits for app_py and app_go are 30MiB and 20MiB respectively. | ||
|
||
## Metrics from web apps | ||
|
||
The Python app exports metrics corresponding to the web app (requests count, request handle | ||
time), as well as metrics related to python runtime exposed by the `promteheus_client`, for instance: | ||
|
||
![Prometheus, python web_app](pics/prometheus_app_py_sample.png) | ||
|
||
The Go app exports metrics corresponding to the web app (requests count, request handle time), | ||
as well as metrics related to go runtime exposed by the prometheus client, for instance: | ||
|
||
![Prometheus, go web_app](pics/prometheus_app_go_sample.png) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,35 @@ | ||
apiVersion: 1 | ||
|
||
datasources: | ||
- name: Loki | ||
type: loki | ||
access: proxy | ||
orgId: 1 | ||
url: http://loki:3100 | ||
basicAuth: false | ||
isDefault: true | ||
version: 1 | ||
editable: false | ||
- name: Loki | ||
type: loki | ||
access: proxy | ||
orgId: 1 | ||
url: http://loki:3100 | ||
basicAuth: false | ||
isDefault: true | ||
version: 1 | ||
editable: false | ||
|
||
- name: Prometheus | ||
type: prometheus | ||
access: proxy | ||
url: http://prometheus:9090 | ||
jsonData: | ||
httpMethod: POST | ||
manageAlerts: true | ||
prometheusType: Prometheus | ||
prometheusVersion: 2.51.0 | ||
cacheLevel: 'High' | ||
disableRecordingRules: false | ||
incrementalQueryOverlapWindow: 10m | ||
examplarTraceIdDestinations: | ||
# Field with internal link pointing to data source in Grafana. | ||
# datasourceUid value can be anything, but it should be unique across all defined data source uids. | ||
- datasourceUid: my_jaeger_uid | ||
name: traceID | ||
|
||
# Field with external link. | ||
- name: traceID | ||
url: 'http://grafana:3000/explore?orgId=1&left=%5B%22now-1h%22,%22now%22,%22Jaeger%22,%7B%22query%22:%22$${__value.raw}%22%7D%5D' | ||
editable: true |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
global: | ||
scrape_interval: 15s | ||
evaluation_interval: 15s | ||
|
||
rule_files: | ||
|
||
scrape_configs: | ||
- job_name: prometheus | ||
static_configs: | ||
- targets: ['localhost:9090'] | ||
|
||
- job_name: loki | ||
static_configs: | ||
- targets: ['loki:3100'] | ||
|
||
- job_name: grafana | ||
static_configs: | ||
- targets: ['grafana:3000'] | ||
|
||
- job_name: app_py | ||
static_configs: | ||
- targets: ['app_py:5000'] | ||
|
||
- job_name: app_go | ||
static_configs: | ||
- targets: ['app_go:5000'] |
This file contains 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