Errata

Prometheus: Up & Running

Errata for Prometheus: Up & Running, Second Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Other Digital Version Chapter 10, 10-7
When you visit http://localhost:9144, among its output you will find the following metrics:

Isn't the sum value incorrect? Why would it be 0.57?

GET /foo 1.23
GET /bar 3.2
POST /foo 4.6

# HELP log_http_request_latency_seconds_total HTTP request latency
# TYPE log_http_request_latency_seconds_total histogram
log_http_request_latency_seconds_total_bucket{le="0.005"} 0
log_http_request_latency_seconds_total_bucket{le="0.01"} 0
log_http_request_latency_seconds_total_bucket{le="0.025"} 0
log_http_request_latency_seconds_total_bucket{le="0.05"} 0
log_http_request_latency_seconds_total_bucket{le="0.1"} 1
log_http_request_latency_seconds_total_bucket{le="0.25"} 2
log_http_request_latency_seconds_total_bucket{le="0.5"} 3
log_http_request_latency_seconds_total_bucket{le="1"} 3
log_http_request_latency_seconds_total_bucket{le="2.5"} 3
log_http_request_latency_seconds_total_bucket{le="5"} 3
log_http_request_latency_seconds_total_bucket{le="10"} 3
log_http_request_latency_seconds_total_bucket{le="+Inf"} 3
log_http_request_latency_seconds_total_sum 0.57
log_http_request_latency_seconds_total_count 3
# HELP log_http_requests_total HTTP requests
# TYPE log_http_requests_total counter
log_http_requests_total{path="/bar"} 1
log_http_requests_total{path="/foo"} 2

Anonymous  Sep 28, 2023 
O'Reilly learning platform Page Chapter 16 - Changing Type - Scalar
https://learning.oreilly.com/library/view/prometheus-up/9781098131135/ch16.html#:-:text=_cpu_seconds_total%7Bmode!%3D%22idle%22%2Cinstance%3D%22localhost%3A9090%22%7D%5B5m%5D)),%20%20scalar(count(node_cpu_seconds_total%7Bmode%3D%22idle%22%2Cinstance%3D%22

I believe that the port in below expression should be 9100 (node_exporter) and that there is a typo in the second last character (should be a ```}``` )

sum(rate(node_cpu_seconds_total{mode!="idle",instance="localhost:9090"}[5m]))
/
scalar(count(node_cpu_seconds_total{mode="idle",instance="localhost:9090"))

Tony  Mar 10, 2024 
Printed Page In Chapter 12 - writing exporters
Example 12.2

I am posting for the customer, and have replaced https with hXXps so that they are no longer real links and can be posted here. (Jim Gleaves)

============
In Chapter 12 - writing exporters, example 12.2, the steps described seem no longer be valid with current versions of Go.

The steps documented doesn't seem to be valid for current versions of Go, however a workflow similar to this worked better (Go v1.21.8):
curl -LO hXXps://raw.githubusercontent.com/prometheus-up-and-running-2e/examples/main/12/12-2-consul_metrics.go
mv -i {12-2-,}consul_metrics.go
go mod init consul_metrics.go
go mod tidy
go get github.com/hashicorp/consul/api github.com/prometheus/client_golang/prometheus github.com/prometheus/client_golang/prometheus/promhttp
go run consul_metrics.go

Anonymous  Mar 11, 2024