Get up to speed with Prometheus, the metrics-based monitoring system used in production by tens of thousands of organizations. This updated second edition provides site reliability engineers, Kubernetes administrators, and software developers with a hands-on introduction to the most important aspects of Prometheus, including dashboarding and alerting, direct code instrumentation, and metric collection from third-party systems with exporters.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
# Prometheus: Up & Running
## 【One-Line Pitch】
A practical, hands-on guide to monitoring with Prometheus—covering everything from basic setup and query language to service discovery, Kubernetes integration, and alerting—written for SREs, Kubernetes administrators, and developers who need reliable operational metrics.
## 【Book Arc】
- **Opening (~0%–10%)**: Introduces monitoring concepts, explains why Prometheus uses a metrics-based approach over logs, and walks through a first working setup with scrape jobs, rules, and alerting configuration.
- **Early (~10%–23%)**: Dives into code instrumentation across Python, Java, and Go—covering counters, gauges, histograms, exposition formats, and the Pushgateway pattern for batch jobs.
- **Early (~23%–32%)**: Explores PromQL query language fundamentals, including rate calculations, label matching, many-to-one joins with group_left, and building dashboards in Grafana.
- **Middle (~32%–48%)**: Covers service discovery mechanisms (Consul, EC2, Kubernetes), target labeling hierarchies, and relabeling techniques to map metadata to useful labels.
- **Middle (~48%–end)**: Addresses advanced topics including cAdvisor for container metrics, Kubernetes monitoring patterns, metric relabeling for label management, and production considerations.
## 【Key Takeaways】
- **Metrics over logs for operational monitoring** (Opening): Prometheus tracks aggregations over time rather than individual events, keeping resource usage sane with a ~10,000 metrics-per-process guideline. This makes it unsuitable for event logs or high-cardinality data like email addresses.
- **Prometheus prioritizes availability over perfect accuracy** (Opening): The system accepts small inaccuracies from kernel scheduling and failed scrapes, preferring 99.9% correct data over breaking monitoring while waiting for perfect data—use caution in billing or money-related applications.
- **Instrumentation is decoupled from exposition** (Early): You define metrics with client libraries and expose them on /metrics (or any path) independently—transient dependencies with Prometheus instrumentation appear automatically on your metrics page.
- **Histograms enable average latency calculation** (Early): The _count and _sum time series from histogram metrics let you compute average latency with rate(sum[1m]) / rate(count[1m])—the per-second rates cancel out the time window.
- **Label changes are breaking changes** (Early): Adding or removing labels from instrumentation breaks existing queries and aggregations. Info metrics are the exception—they're designed so extra labels don't cause problems.
- **Service discovery replaces manual configuration** (Middle): Prometheus supports Consul, EC2, and Kubernetes out of the box, plus file-based and HTTP-based mechanisms for custom sources—essential for dynamic environments where instances change frequently.
- **Target labels should form a hierarchy** (Middle): Structure labels from broad to specific (region → datacenter → environment → service → job → instance) to enable meaningful aggregation and organization.
- **Relabeling serves two purposes** (Middle): Originally for mapping service discovery metadata to target labels, it's also used for metric relabeling—like dropping arbitrary container_label_* labels from cAdvisor that could break monitoring.
## 【Reading Tips】
- **Skim the opening monitoring theory** (~0%–10%) if you're already familiar with observability concepts—the practical setup example in Chapter 2 is where the real value begins.
- **Deep-read the instrumentation chapters** (~10%–23%) if you're a developer—the Python, Java, and Go examples show concrete patterns, but you can focus on your primary language.
- **Pay special attention to the PromQL examples** (~23%–32%)—the rate calculations and group_left joins are the most commonly misunderstood concepts; work through the arithmetic yourself.
- **The service discovery and relabeling sections** (~39%–48%) are dense but crucial for production deployments—the label hierarchy advice is worth internalizing even if you skip the specific cloud provider examples.
- **Watch for the "breaking changes" warnings** about labels—these are hard-won lessons that will save you from painful migrations later.
## 【Coverage Limits】
The excerpts cover roughly the first half of the book in detail (through service discovery and relabeling), with lighter coverage of later chapters on Kubernetes monitoring, alerting, and advanced production topics. Some specific exporter examples and advanced PromQL features may not be fully represented.
##
Page 20
being tracked needs to be limited: 10,000 per process is a reasonable upper bound for you to keep in mind. Examples of the sort of metrics you might have wou...
out a quarter of a millisecond on our machine, for example. majority will be online-serving subsystems, which is to say, synchronous function calls, and bene...
old at 80 to remove the threshold. Finally, click Apply and you should see something like Figure 6-10. Figure 6-10. Dashboard with a graph and Stat panel Dis...
can expose them using info metrics, as discussed in “Info”. If you find that you want every target in a Prometheus to share some labels such as region, you s...
n include URL parameters, if they are appropriately encoded. 12 The http_2xx module is incidentally the default module name if you don’t provide one as a URL...
eing used here due to the limited number of histograms that Prometheus and the Node Exporter offer for us to use as examples. 5 Such as process_cpu_seconds_t...
nstant vector output of functions as the input of functions that require range vectors is covered in the next chapter on recording rules. 1 A 99% success rat...
ation files in advance, you can use the amtool check-config command to check your alertmanager.yml.2 For example, a minimal configuration that sends everythi...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Prometheus Up Running (Julien Pivotto, Brian Brazil) (Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Prometheus Up Running (Julien Pivotto, Brian Brazil) (Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment