🎓 A1Learner
🔍
0 of 50 lessons completed

Prometheus: Meet ShopSentry

ShopSentry is a small demo shop that the whole course monitors. It sells four products and reports its own numbers.

Visit the shop

The home page names the shop and lists its four products.

curl -s http://localhost:18102/

List the products and prices

The products page shows each product with its price in dollars.

curl -s http://localhost:18102/api/products

Break the shop on purpose

One address switches the shop into errors mode, and /heal switches it back.

curl -s "http://localhost:18102/break?mode=errors"
curl -s http://localhost:18102/heal

Example

curl -s "http://localhost:18102/break?mode=down"; curl -s -o /dev/null -w "%{http_code}\n" http://localhost:18102/; curl -s http://localhost:18102/heal

Key points

  • ShopSentry is a tiny shop service written in Python with no extra parts.
  • Its home page lists four products: a tote bag, a notebook, a mug, and a pen.
  • Its /api/products page lists the same four products with their prices.
  • Its /api/orders page places an order and returns a short confirmation.
  • Its /metrics page lists every number Prometheus collects from the shop.
  • A break switch at /break can make the shop slow, failing, or fully down.

In this example, the break switch stops the shop on purpose. The home page answers 503 while the shop is down, and /heal brings it back. The same switch drives the alerting lessons later, where a real alert fires while the shop is broken.

Note

The shop is a demo, so breaking it harms nobody and teaches the alerting lessons later.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

Where does ShopSentry publish the numbers Prometheus collects?