n o t
o n l y
t e c h n o l o g y
blog image

Building and mon­i­tor­ing Flask Application with Prometheus and Grafana

Ivan Listeš, Senior Software Engineer

Software development

Software development

February 7, 2025

May 8, 2025

Introduction

Learn how to cre­ate a Flask ap­pli­ca­tion that dis­plays ran­dom quotes and tracks the health and performance of the application with var­i­ous in­ter­nal met­rics. By in­te­grat­ing Flask ap­pli­ca­tion with Prometheus and Grafana, we will demonstrate how to set up real-time ap­pli­ca­tion mon­i­tor­ing.

Flask ap­pli­ca­tion ex­pos­es sev­er­al met­rics that can be used to mon­i­tor var­i­ous as­pects of its per­for­mance, such as:

  • Re­quest Count: The to­tal num­ber of re­quests.
  • Er­ror Count: The num­ber of er­rors.
  • Health Sta­tus: Ap­pli­ca­tion health sta­tus.
  • Re­source Us­age: Met­rics cap­tur­ing CPU us­age, mem­o­ry con­sump­tion, and up­time.
  • Quote Count: Track­ing how of­ten each quote has been dis­played.

These met­rics will be ex­posed through a /met­rics end­point in the Flask ap­pli­ca­tion and Prometheus will pe­ri­od­i­cal­ly scrape this end­point and store the met­rics.

Once the data is col­lect­ed, Grafana will be used to vi­su­al­ize the met­rics and cre­ate cus­tom dash­boards pro­vid­ing a way to mon­i­tor the health of the ap­pli­ca­tion in real-time.

In oth­er words, this setup show­cas­es a real-world use case of end-to-end ap­pli­ca­tion mon­i­tor­ing us­ing open-source tools like Prometheus and Grafana.

1. Setting up the Quote Application

The start­ing point is building the web ap­pli­ca­tion that will dis­play quotes (along with au­thor’s name and im­age) and then ex­pose sev­er­al met­rics used to mon­i­tor over­all ap­pli­ca­tion health and per­for­mance.

Flask is a web ap­pli­ca­tion frame­work de­signed to sim­pli­fy the process of build­ing web ap­pli­ca­tions us­ing Python. Flask phi­los­o­phy re­volves around sim­plic­i­ty, flex­i­bil­i­ty, built-in de­vel­op­ment serv­er, etc. which makes it per­fect fit for this blog’s pur­pose. Ap­pli­ca­tion will serve as the centerpiece of mon­i­tor­ing so­lu­tion, al­low­ing users to in­ter­act with it by dis­play­ing quotes, han­dling er­rors and ex­pos­ing per­for­mance met­rics.

1.1. Project Structure

The pro­ject con­sists of mul­ti­ple com­po­nents, from ap­pli­ca­tion ex­e­cu­tion to vir­tu­al­i­sa­tion com­po­nents, and has the fol­low­ing struc­ture:

Project Structure

Note: Find the code in the GitHub Repository.

Files and fold­ers de­scrip­tion:

  • Dockerfile: Cre­ate ap­pli­ca­tion Dock­er im­age
  • README.md: Projects information and ex­pla­na­tions
  • app.py: Main func­tion­al­i­ty of ap­pli­ca­tion
  • docker-compose.yml: Cre­ate ap­pli­ca­tion con­tain­er (along with Prometheus and Grafana con­tain­ers)
  • prometheus/prometheus.yml: Prometheus con­fig­u­ra­tion file
  • requirements.txt: List of pack­ages and li­braries re­quired for running ap­pli­ca­tion
  • static/images: Di­rec­to­ry where im­ages re­quired for ap­pli­ca­tion are stored
  • templates/index.html: Home page for ap­pli­ca­tion’s web­site

1.2. Ap­pli­ca­tion Endpoints

Ap­pli­ca­tion de­fines mul­ti­ple spe­cif­ic URLs (API end­points), that can be used to ac­cess a par­tic­u­lar func­tion or data:

Home End­point (/)

Main en­try point of the ap­pli­ca­tion. When ac­cessed, it serves an HTML page that dis­plays a ran­dom quote (with au­thor’s name and im­age) from a pre­de­fined list. The user can click on the dis­played quote to view the next one in the se­quence. Each time a quote is dis­played, a met­rics that stores the num­ber of times that par­tic­u­lar quote has been dis­played is up­dat­ed.

Quote Application Home Endpoint

Met­rics End­point(/metrics)

This end­point ex­pos­es all col­lect­ed met­rics in a for­mat com­pat­i­ble with Prometheus. Met­rics in­clude re­quest counts, er­ror counts, CPU and mem­o­ry us­age, up­time, and var­i­ous oth­ers re­lat­ed to the ap­pli­ca­tion’s per­for­mance and re­source con­sump­tion.

It is cre­at­ed to pro­vide a cen­tral­ized end­point for col­lect­ing and ex­port­ing met­rics (Prometheus scrapes this end­point to gath­er data for analy­sis, alert­ing and visualization).

Quote Application Metrics Endpoint

Health Check End­point (/health)

This end­point re­turns the cur­rent health sta­tus of the ap­pli­ca­tion. It al­ways re­sponds with a cus­tom sta­tus of “Sys­tem is healthy”, along with a met­ric HEALTH_STATUS set to 1, in­di­cat­ing that the ap­pli­ca­tion is run­ning as ex­pect­ed.

Quote Application Health Endpoint

Quote End­point (/quote/<int:index>)

This end­point re­turns the next quote in the se­quence based on the pro­vid­ed in­dex. If the next quote exists, endpoint returns a custom message “Quote counter incremented”. Each time a quote is re­trieved, the cor­re­spond­ing counter for that quote is in­cre­ment­ed.

Quote Application Quote Endpoint

1.3. Application Metrics

Met­rics are key in or­der to make im­prove­ments to the sys­tem (ap­pli­ca­tion) and user ex­pe­ri­ence as well as for main­tain­ing ex­pect­ed up­time and per­for­mance. Met­rics are used to mea­sure and track the per­for­mance and over­all health of Quote ap­pli­ca­tion:

1.4. Running the Application

Ap­pli­ca­tion is con­tainer­ized and de­pend­ing on im­age cre­ation, it can be cre­at­ed in two ways.

How to create the application:

Now that the Quote ap­pli­ca­tion is set up (serves quotes) and met­rics for mon­i­tor­ing per­for­mance and health are ex­posed, ap­pli­ca­tion should be con­nect­ed to Prometheus so that met­rics can be scraped.

 

2. Setting up Prometheus

Prometheus is an open-source system mon­i­tor­ing and alert­ing tool. It col­lects and stores its met­rics as time se­ries data, i.e., met­rics in­for­ma­tion is stored with the time­stamp at which it was record­ed, along­side op­tion­al key-val­ue pairs called la­bels. It uses PromQL, a pow­er­ful query lan­guage for query­ing time se­ries data.

Tip: More in­for­ma­tion on Prometheus can be found here.

2.1. In­stalling Prometheus in a Dock­er Net­work

Quote ap­pli­ca­tion is in­stalled as Dock­er con­tain­er, and lo­cat­ed in Dock­er net­work called mon­i­tor­ing-net­work, so Prometheus will also be in­stalled and used as Dock­er con­tain­er:

Setting up Prometheus

Prometheus con­tain­er uses last of­fi­cial Prometheus Dock­er im­age, and is ex­posed on stan­dard Prometheus port (9090). To spec­i­fy the scrape con­fig­u­ra­tion the prometheus.yml file is cre­at­ed and bind mount­ed to de­fault con­fig­u­ra­tion file lo­cat­ed in /etc/prometheus di­rec­to­ry.

Since both ser­vices are con­nect­ed to the same net­work (mon­i­tor­ing-net­work), the Prometheus con­tain­er can com­mu­ni­cate with the Quote ap­pli­ca­tion con­tain­er and scrape its met­rics.

Cre­ate the Prometheus con­tain­er, by run­ning the fol­low­ing com­mand:

Creating the Prometheus container

If every­thing is set­up cor­rect­ly, and there were no er­rors while cre­at­ing a con­tain­er, Prometheus UI will be avail­able on http://localhost:9090.

 

2.2. Con­fig­ur­ing Prometheus to Scrape Met­rics

As men­tioned above, a cus­tom prometheus.yml file is cre­at­ed and bind mount­ed to de­fault con­fig­u­ra­tion file lo­cat­ed in /etc/prometheus di­rec­to­ry. Prometheus uses this file to determine where to scrape met­rics from and how fre­quent­ly to scrape them.

The con­tent of prometheus.yml file:

The content of Prometheus YML file

Con­fig­u­ra­tion file de­scrip­tion:

  • Con­fig­u­ra­tion file tells Prometheus to scrape the Quote ap­pli­ca­tion met­rics every 15 sec­onds.
  • job_name: Spec­i­fies the name of the scrap­ing job, which can be used in queries to fil­ter met­rics (re­lat­ed to this spe­cif­ic job).
  • metrics_path: De­fines the end­point Prometheus will use to scrape met­rics (in this case /metrics).
  • targets: A list of tar­gets from which Prometheus will col­lect met­rics (in this case dc-quote-app; name of Quote ap­pli­ca­tion con­tain­er).

Prometheus

2.3. Exploring Prometheus Metrics

Once the Prometheus is con­fig­ured, queries can be used to check if Prometheus is scrap­ing met­rics cor­rect­ly.

Check out these examples:

Exploring Prometheus

Exploring Prometheus Metrics

Exploring Prometheus Metrics 2

Exploring Prometheus Metrics 3

Now, when Prometheus is con­fig­ured to scrape the Quote ap­pli­ca­tion met­rics, the next step is to set up Grafana to vi­su­al­ize the met­rics col­lect­ed by Prometheus.

3. Setting up Grafana

Grafana is an open-source an­a­lyt­ics andin­ter­ac­tive vi­su­al­iza­tion web ap­pli­ca­tion that al­lows users to in­gest data from various sourcesquery this data, and dis­play it. Grafana comes with va­ri­ety of vi­su­al­iza­tion op­tions, which are split into pan­els that are then used to build the Grafana dash­board.

Tip: More in­for­ma­tion on Grafana can be found here.

3.1. In­stalling Grafana in a Dock­er Net­work

Since Quote ap­pli­ca­tion and Prometheus are in­stalled as Dock­er con­tain­ers and placed in the same net­work to en­sure prop­er com­mu­ni­ca­tion, Grafana will also be in­stalled as Dock­er con­tain­er.

Grafana Docker Containers

Grafana con­tain­er uses last of­fi­cial Grafana Dock­er im­age, and is ex­posed on stan­dard Grafana port (3000). A vol­ume (/grafana) is used to store Grafana dash­boards and data­sources, en­sur­ing that they per­sist when the con­tain­er is restart­ed. Grafana will pull data from Prometheus and then cre­ate dash­board to vi­su­al­ize met­rics.

Cre­ate the Grafana con­tain­er, by run­ning the fol­low­ing com­mand:

Creating the Grafana Containers

If every­thing is set­up cor­rect­ly, and there were no er­rors while cre­at­ing a con­tain­er, Grafana UI will be avail­able on http://localhost:3000.

Grafana UI

Note: Grafana uses default credentials admin/admin, which can be changed on the first login.

3.2. Con­nect­ing Grafana to Prometheus

Grafana uses con­cept of data­source, which is ba­si­cal­ly any place from which Grafana can pull datae.g. Prometheus, Post­greSQL, Elas­tic­search, Data­dog, etc.. In oth­er words, there is no need to load the data into Grafana to an­a­lyze it.

In or­der for Grafana to pull data from Prometheus, a data­source must be cre­at­ed. Data­source can be cre­at­ed man­u­al­ly or us­ing .yaml tem­plate.

Steps to man­u­al­ly cre­ate Prometheus data­source:

1. Lo­gin to the Grafana, us­ing de­fault cre­den­tials at http://localhost:3000.
2. In the sidebar se­lect “Data Sources”, and click “Add data source”.
3. From the list of avail­able data sources, se­lect “Prometheus”.
4. In the HTTP sec­tion, set the URL to http://localhost:9090.
5. Click “Save & Test”to ver­i­fy the con­nec­tion.

An­oth­er way to cre­ate a data­source in Grafana is to use the .json tem­plate:

datasource Grafana

Once the data­source con­nec­tion is ver­i­fied, Grafana will be able to pull data from Prometheus.

4. Visualizing Quote Application Metrics in Grafana

Once the Prometheus is set as a data source, the next step is to cre­ate a dash­board to vi­su­al­ize the Quote ap­pli­ca­tion met­rics.

Steps to cre­ate a dash­board (com­mon steps for all pan­els):

1. In the Grafana side­bar, click “+” icon and se­lect “Dash­board”
2. Click “Add new pan­el”
3. In the Query sec­tion, se­lect “Prometheus” as the data­source.

Pan­els are grouped into rows, and vi­su­al­ized based on the com­mon cri­te­ria (e.g. ap­pli­ca­tion sta­tus met­rics, re­quests sta­tus met­rics and quote re­lat­ed met­rics).

4.1. Mon­i­tor­ing Ap­pli­ca­tion Health, Up­time and Re­source Us­age

All vi­su­al­iza­tions are cre­at­ed us­ing Gauge or Time Se­ries pan­els. Met­rics used in ap­pli­ca­tion health sta­tus, up­time and re­source us­age vi­su­al­iza­tions:

  • HEALTH_STATUS
  • APP_TIME
  • CPU_USAGE
  • MEMORY_USAGE
  • MEMORY_USAGE_MB

Application Statistics Visualization

 

4.2. Vi­su­al­iz­ing Re­quest and Er­ror Met­rics

All vi­su­al­iza­tions are cre­at­ed us­ing Stat or Time Se­ries pan­els. Met­rics used in re­quests vi­su­al­iza­tions:

  • REQUEST_COUNT
  • ERROR_COUNT
  • SUCCESSFUL_REQUESTS

Requests Statistics Visualization

 

All vi­su­al­iza­tions are cre­at­ed us­ing StatTime Se­ries, and Bar Gauge pan­els. Met­rics used in quotes vi­su­al­iza­tions:

  • TO­TAL_QUOTES_DIS­PLAYED
  • quote_<in­dex>_count

Quote Statistics Visualization

 

5. Scaling and Enhancing Application Monitoring

5.1. Scal­ing the Quote Ap­pli­ca­tion

Quote ap­pli­ca­tion cur­rent­ly has one func­tion, which is to dis­play ran­dom quote (with au­thors name and im­age), which makes it a pret­ty light­weight in terms of ap­pli­ca­tion. But if the func­tion­al­i­ty of Quote ap­pli­ca­tions in­creas­es, ap­pli­ca­tion scal­ing could come in handy.

There are cou­ple of ways to achieve ap­pli­ca­tion scal­ing, but since Quote ap­pli­ca­tion is al­ready con­tainer­izedadding more in­stances it the sim­plest ap­proach.

The first step is to en­sure that Quote ap­pli­ca­tions is state­lesswhich means that no persistent state should be held with­in the ap­pli­ca­tion it­self.

To scale the ex­ist­ing Quote ap­pli­ca­tion, sim­ply spec­i­fy the num­ber of repli­cas:

Quote Application Specify the Number of Replica

The deploy.replicas op­tion un­der quote-app in­di­cates that two in­stances of the Quote ap­pli­ca­tion should be cre­at­ed.

Two instances of the Quote Application

5.2. Scal­ing the Prometheus

As the num­ber of Quote in­stances in­creas­es, a sin­gle Prometheus in­stance may not be able to han­dle the in­creased load. Sim­i­lar for Quote ap­pli­ca­tion, there are sev­er­al strate­gies for scal­ing Prometheus, and sim­plest ap­proach is to use fed­er­a­tion.

Fed­er­a­tion al­lows a Prometheus serv­er to scrape se­lect­ed time se­ries from an­oth­er Prometheus in­stance. Ba­si­cal­ly, it al­lows scal­ing by de­ploy­ing mul­ti­ple Prometheus in­stances, each scrap­ing a sub­set of Quote ap­pli­ca­tion met­rics, and then ag­gre­gat­ing the data into a sin­gle glob­al in­stance.

First, update the docker-compose.yml file to deploy three instances of Prometheus (two instances that will monitor Quote applications, and a federate instance that will be used to aggregate the data):

Update the Docker Compose

 

Scaling the Prometheus

Scaling the Prometheus

Scaling the Prometheus

Scaling the Prometheus

The /federate end­point al­lows re­triev­ing the cur­rent val­ue for a se­lect­ed set of time se­ries in that serv­er. At least one match[] URL pa­ra­me­ter must be spec­i­fied to se­lect the se­ries to ex­pose. To fed­er­ate met­rics from one serv­er to an­oth­er, con­fig­ure des­ti­na­tion Prometheus serv­er to scrape from the /federate end­point of a source serv­er while also en­abling the honor_labels scrape op­tion (to not over­write any la­bels ex­posed by the source serv­er).

Fed­er­a­tion en­ables the sys­tem to scale hor­i­zon­tal­ly while en­sur­ing high avail­abil­i­ty and per­for­mance. Ad­di­tion­al­ly, each lo­cal in­stance is op­ti­mized for spe­cif­ic ser­vice.

Prometheus federate Instance targets

5.3. Con­fig­ur­ing Alerts and No­ti­fi­ca­tions in Prometheus

Alert­ing with Prometheus is sep­a­rat­ed into two parts. Alert­ing rules in Prometheus servers send alerts to an Alert­man­ag­er. The Alert­man­ag­er then man­ages those alerts, in­clud­ing send­ing out no­ti­fi­ca­tions via mul­ti­ple meth­ods (e.g. email, chat plat­form, etc.).

The main steps to set­ting up alert­ing and no­ti­fi­ca­tions are:

  • Set­up and con­fig­ure the Alert­man­ag­er
  • Con­fig­ure Prometheus to talk to the Alert­man­ag­er
  • Cre­ate alert­ing rules in Prometheus

Add the fol­low­ing code snip­pet in docker-compose.yml file to add the Alert­man­ag­er into ex­ist­ing con­fig­u­ra­tion:

Alertmanager

New ser­vice for Alert­man­ag­er ex­pos­es its UI on port 9093 and over­writes the de­fault con­fig­u­ra­tion file in /etc/alertmanager di­rec­to­ry. The cus­tom alermanager.yml file con­tains con­fig­u­ra­tions for rout­ing alerts and han­dling no­ti­fi­ca­tions:

Routing alerts and handling notifications

Note: Email configuration uses arbitrary values since email notifications were not tested!

Cre­ate the Prometheus con­tain­er, by run­ning the fol­low­ing com­mand:

Prometheus container

If every­thing is set­up cor­rect­ly, and there were no er­rors while cre­at­ing a con­tain­er, Alert­man­ag­er UI will be avail­able on http://localhost:9093.

Alertmanager UI

5.3.2. Con­fig­ure Prometheus to talk to the Alert­man­ag­er

Once the Alert­man­ag­er is up and run­ning, it needs to be con­nect­ed with the Prometheus, which can be done by adding the alerting sec­tion to the ex­ist­ing Prometheus con­fig­u­ra­tion file (prometheus.yml):

Configure prometheus to talk to the Alert Manager

The alerting sec­tion de­fines where Prometheus sends alerts.

Once Alert­man­ag­er is up and run­ning and con­nect­ed to Prometheus, the last thing is to de­fine the alert­ing rules. Cre­ate new file (e.g. alert_rules.yml) and de­fine the rule to trig­ger an alert based on ap­pli­ca­tion re­source us­age (e.g. Memory Us­age):

Create Alerting Rules in Prometheus

Ex­pla­na­tion:

  • NameCom­mon name for all alerts re­lated to Quote ap­pli­ca­tion
  • AlertName of the alert that will be trig­gered based on the de­fined pa­ra­me­ters
  • ExprEx­pres­sion that will be checked in Prometheus, which is ba­si­cal­ly used as a trigger for alert
  • ForTime that Prometheus will wait un­til the alerts is trig­gered (ex­pres­sion must per­sist for 1 minute)
  • LabelsUsed for fil­ter­ing and group­ing
  • AnnotationsDe­tailed in­for­ma­tion about alert
Alert firing in Prometheus

Up­date the Prometheus vol­umes sec­tion in ex­ist­ing docker-compose.yml file to bind mount the cus­tom rules file to rules file in the /etc/prometheus di­rec­to­ry:

Update the Prometheus volumes

Up­date the de­fault Prometheus con­fig­u­ra­tion file (prometheus.yml) with the alert file, by defin­ing rule_files sec­tion:

Defining rule files section

Once the alert is trig­gered, it will ap­pear in Alert­man­ag­er on http://localhost:9093, in  ad­di­tion, pend­ing or fir­ing alerts can also be checked in Prometheus at http://localhost:9090/alerts.

Alertmanager Alerts

Above con­fig­u­ra­tion en­sures that Quote ap­pli­ca­tion is con­tin­u­ous­ly mon­i­tored, and alerts are gen­er­at­ed for crit­i­cal is­sues, pro­vid­ing no­ti­fi­ca­tions to take cor­rec­tive ac­tions.

5.4. Adding Ad­vanced Met­rics and Vi­su­al­iza­tions

So far, we talked about high-lev­el met­rics, like re­source (CPU and Mem­o­ry) us­age, ap­pli­ca­tion up­time, etc., but cap­tur­ing more gran­u­lar met­rics, such as la­ten­cyHTTP er­ror rates, etc., pro­vides deep­er in­sights into the sys­tem’s be­hav­ior.

La­ten­cy Met­ric

La­ten­cy met­ric can be used to pro­vide in­sight into how long it takes for Quote ap­pli­ca­tion to process re­quest. To track the la­ten­cy met­ric, up­date the app.py file with the fol­low­ing:

Latency Metric

This adds a His­togram met­ric app_request_latency_seconds, which records the time it takes for each re­quest to be processed. To vi­su­al­ize la­ten­cy met­ric in Grafana, REQUEST_LATENCY met­rics is used.

 

 

Re­quests La­ten­cy [sec]

  • Query: avg(app_re­quest_la­ten­cy_sec­onds_count{in­stance=”dc-quote-app:5000″})
  • Pan­el Spec­i­fi­ca­tions: Time Se­ries, Unit (Sec­onds), Value (Mean)
  • De­scrip­tion: Pan­el dis­plays av­er­age re­quest la­ten­cy in sec­onds

HTTP Er­ror Rate Met­ric

Er­ror Rate met­rics can be used to track the rate of er­rors (e.g. 404 HTTP re­spons­es), which en­ables to check the re­li­a­bil­i­ty of the Quote ap­pli­ca­tion. To track the er­ror rate met­ric, up­date the app.py file with the fol­low­ing:

HTTP Error Metric

This in­cre­ments a app_http_error_count counter every time an er­ror re­sponse (sta­tus code 404) is re­turned by the Quote ap­pli­ca­tion.

To vi­su­al­ize er­ror rate met­ric in Grafana, HTTP_ERROR_COUNT met­rics is used.

HTTP Er­ror Rate

  • Query: sum(app_http_er­ror_count_to­tal{in­stance=”dc-quote-app:5000″})
  • Pan­el Spec­i­fi­ca­tions: Bar Gauge, Unit (Num­ber), Cal­cu­la­tion (Last*)
  • De­scrip­tion: Pan­el dis­plays sum of er­rors, grouped by the status_code

 

  • HTTP Error Rate

Ad­di­tion­al Im­prove­ments

Here is the list of ad­di­tion­al im­prove­ments that can be made on the pro­ject:

Conclusion

In this blog, a Quote ap­pli­ca­tion that dis­plays quotes and ex­pos­es op­er­a­tional met­rics was cre­at­ed. Met­rics like re­sources us­age, ap­pli­ca­tion health sta­tus, up­time, num­ber of suc­cess­ful and er­ror re­quests, and the num­ber of quotes dis­played, were cru­cial for gain­ing vis­i­bil­i­ty into the ap­pli­ca­tion’s health. Ap­pli­ca­tion stack was ex­pand­ed with Prometheus, which was used for scrap­ing ap­pli­ca­tion met­rics and Grafana for vi­su­al­iz­ing the data.

In Grafana, sev­er­al types of pan­els (Gauge, Stat, Time se­ries, etc.) were used to mon­i­tor the met­rics. Each vi­su­al­iza­tion pro­vid­ed in­sights into the ap­pli­ca­tion’s real-time state, en­abling to mea­sure re­source uti­liza­tion, and eval­u­ate the over­all per­for­mance.

Ap­pli­ca­tion func­tion­al­i­ty in­crease is han­dled by im­ple­ment­ing scal­ing op­er­a­tions on ap­pli­ca­tion it­self as well as oth­er com­po­nents like scal­ing Prometheus through fed­er­a­tion. Ad­di­tion­al­ly, an Alert­man­ag­er was in­tro­duced to han­dle alerts. To iden­ti­fy slow re­spons­es and fail­ure rates from ap­pli­ca­tion, ad­vanced met­rics like re­quest la­ten­cy and HTTP Er­ror rates were im­ple­ment­ed. These met­rics are im­por­tant in de­tect­ing per­for­mance bot­tle­necks, en­hanc­ing the ap­pli­ca­tion’s over­all re­li­a­bil­i­ty.

Mon­i­tor­ing met­rics is crit­i­cal for build­ing re­li­able and scal­able ap­pli­ca­tions. With the Prometheus and Grafana stack, users gain real-time vis­i­bil­i­ty into the ap­pli­ca­tion’s per­for­mance and are able to re­spond quick­ly to in­ci­dents and op­ti­mize re­source us­age.

Fu­ture im­prove­ments like in­te­grat­ing dis­trib­uted trac­ing with tools like Jaegerlog ag­gre­ga­tion with tools like Loki, and man­ag­ing de­ploy­ments with Helm charts will fur­ther en­hance this ob­serv­abil­i­ty stack.
In con­clu­sion, this blog pin­point­ed the pow­er of com­bin­ing ap­pli­ca­tion met­rics with mon­i­tor­ing tools to build a strong foun­da­tion for un­der­stand­ing ba­sic mon­i­tor­ing prin­ci­ples. Con­tin­u­ous­ly track­ing met­rics, set­ting up ef­fec­tive alert­ing, and plan­ning for scal­ing un­der­scored the im­por­tance of hav­ing a mon­i­tor­ing and alert­ing sys­tem in place to en­sure the re­li­a­bil­i­typer­for­mance, and scal­a­bil­i­ty of ap­pli­ca­tion.