Skip to content

Commit 7a1cd7f

Browse files
authored
Merge branch 'prometheus:master' into fix-SkipResolvePhaseWithProxy
2 parents 9d42375 + 09dc5dd commit 7a1cd7f

File tree

9 files changed

+232
-103
lines changed

9 files changed

+232
-103
lines changed

.github/workflows/container_description.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
steps:
2020
- name: git checkout
2121
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
with:
23+
persist-credentials: false
2224
- name: Set docker hub repo name
2325
run: echo "DOCKER_REPO_NAME=$(make docker-repo-name)" >> $GITHUB_ENV
2426
- name: Push README to Dockerhub
@@ -41,6 +43,8 @@ jobs:
4143
steps:
4244
- name: git checkout
4345
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
with:
47+
persist-credentials: false
4448
- name: Set quay.io org name
4549
run: echo "DOCKER_REPO=$(echo quay.io/${GITHUB_REPOSITORY_OWNER} | tr -d '-')" >> $GITHUB_ENV
4650
- name: Set quay.io repo name

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
3737
with:
3838
args: --verbose
39-
version: v2.0.2
39+
version: v2.1.5

Makefile.common

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
6161
SKIP_GOLANGCI_LINT :=
6262
GOLANGCI_LINT :=
6363
GOLANGCI_LINT_OPTS ?=
64-
GOLANGCI_LINT_VERSION ?= v2.0.2
64+
GOLANGCI_LINT_VERSION ?= v2.1.5
65+
GOLANGCI_FMT_OPTS ?=
6566
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
6667
# windows isn't included here because of the path separator being different.
6768
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
@@ -156,9 +157,13 @@ $(GOTEST_DIR):
156157
@mkdir -p $@
157158

158159
.PHONY: common-format
159-
common-format:
160+
common-format: $(GOLANGCI_LINT)
160161
@echo ">> formatting code"
161162
$(GO) fmt $(pkgs)
163+
ifdef GOLANGCI_LINT
164+
@echo ">> formatting code with golangci-lint"
165+
$(GOLANGCI_LINT) fmt $(GOLANGCI_FMT_OPTS)
166+
endif
162167

163168
.PHONY: common-vet
164169
common-vet:
@@ -248,8 +253,8 @@ $(PROMU):
248253
cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu
249254
rm -r $(PROMU_TMP)
250255

251-
.PHONY: proto
252-
proto:
256+
.PHONY: common-proto
257+
common-proto:
253258
@echo ">> generating code from proto files"
254259
@./scripts/genproto.sh
255260

README.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,123 @@ using the `--web.config.file` parameter. The format of the file is described
5050
Note that the TLS and basic authentication settings affect all HTTP endpoints:
5151
/metrics for scraping, /probe for probing, and the web UI.
5252

53+
### Controlling log level for probe logs
54+
55+
It is possible to control the level at which probe logs related to a scrape are output as.
56+
57+
Probe logs default to `debug` level, and can be controlled by the `--log.prober` flag.
58+
This means that probe scrape logs will not be output unless the level configured for the probe logger via `--log.prober` is >= the level configured for the blackbox_exporter via `--log.level`.
59+
60+
Sample output demonstrating the use and effect of these flags can be seen below.
61+
62+
> _Note_
63+
>
64+
> All log samples below used the following basic `blackbox.yml` configuration file and contain the probe logs of a single scrape generated by `curl`
65+
66+
```bash
67+
# blackbox.yml
68+
modules:
69+
http_2xx:
70+
prober: http
71+
72+
# generate probe
73+
curl "http://localhost:9115/probe?target=prometheus.io&module=http_2xx"
74+
```
75+
76+
<details>
77+
<summary>Example output with `--log.level=info` and `--log.prober=debug` (default)</summary>
78+
79+
```bash
80+
./blackbox_exporter --config.file ./blackbox.yml --log.level=info --log.prober=debug
81+
time=2025-05-21T04:10:54.131Z level=INFO source=main.go:88 msg="Starting blackbox_exporter" version="(version=0.26.0, branch=fix/scrape-logger-spam, revision=7df3031feecba82f1a534336979b4e5920f79b72)"
82+
time=2025-05-21T04:10:54.131Z level=INFO source=main.go:89 msg="(go=go1.24.1, platform=linux/amd64, user=tjhop@contraband, date=20250521-04:00:25, tags=unknown)"
83+
time=2025-05-21T04:10:54.132Z level=INFO source=main.go:101 msg="Loaded config file"
84+
time=2025-05-21T04:10:54.133Z level=INFO source=tls_config.go:347 msg="Listening on" address=[::]:9115
85+
time=2025-05-21T04:10:54.133Z level=INFO source=tls_config.go:350 msg="TLS is disabled." http2=false address=[::]:9115
86+
^Ctime=2025-05-21T04:11:03.619Z level=INFO source=main.go:283 msg="Received SIGTERM, exiting gracefully..."
87+
```
88+
</details>
89+
90+
<details>
91+
<summary>Example output with `--log.level=info` and `--log.prober=info`</summary>
92+
93+
```bash
94+
./blackbox_exporter --config.file ./blackbox.yml --log.level=info --log.prober=info
95+
time=2025-05-21T04:12:09.884Z level=INFO source=main.go:88 msg="Starting blackbox_exporter" version="(version=0.26.0, branch=fix/scrape-logger-spam, revision=7df3031feecba82f1a534336979b4e5920f79b72)"
96+
time=2025-05-21T04:12:09.884Z level=INFO source=main.go:89 msg="(go=go1.24.1, platform=linux/amd64, user=tjhop@contraband, date=20250521-04:00:25, tags=unknown)"
97+
time=2025-05-21T04:12:09.884Z level=INFO source=main.go:101 msg="Loaded config file"
98+
time=2025-05-21T04:12:09.885Z level=INFO source=tls_config.go:347 msg="Listening on" address=[::]:9115
99+
time=2025-05-21T04:12:09.885Z level=INFO source=tls_config.go:350 msg="TLS is disabled." http2=false address=[::]:9115
100+
time=2025-05-21T04:12:13.827Z level=INFO source=handler.go:194 msg="Beginning probe" module=http_2xx target=prometheus.io probe=http timeout_seconds=119.5
101+
time=2025-05-21T04:12:13.827Z level=INFO source=handler.go:194 msg="Resolving target address" module=http_2xx target=prometheus.io target=prometheus.io ip_protocol=ip4
102+
time=2025-05-21T04:12:13.829Z level=INFO source=handler.go:194 msg="Resolved target address" module=http_2xx target=prometheus.io target=prometheus.io ip=172.67.201.240
103+
time=2025-05-21T04:12:13.829Z level=INFO source=handler.go:194 msg="Making HTTP request" module=http_2xx target=prometheus.io url=http://172.67.201.240 host=prometheus.io
104+
time=2025-05-21T04:12:13.860Z level=INFO source=handler.go:194 msg="Received redirect" module=http_2xx target=prometheus.io location=https://prometheus.io/
105+
time=2025-05-21T04:12:13.860Z level=INFO source=handler.go:194 msg="Making HTTP request" module=http_2xx target=prometheus.io url=https://prometheus.io/ host=""
106+
time=2025-05-21T04:12:13.860Z level=INFO source=handler.go:194 msg="Address does not match first address, not sending TLS ServerName" module=http_2xx target=prometheus.io first=172.67.201.240 address=prometheus.io
107+
time=2025-05-21T04:12:13.974Z level=INFO source=handler.go:194 msg="Received HTTP response" module=http_2xx target=prometheus.io status_code=200
108+
time=2025-05-21T04:12:13.974Z level=INFO source=handler.go:194 msg="Response timings for roundtrip" module=http_2xx target=prometheus.io roundtrip=0 start=2025-05-21T00:12:13.829-04:00 dnsDone=2025-05-21T00:12:13.829-04:00 connectDone=2025-05-21T00:12:13.839-04:00 gotConn=2025-05-21T00:12:13.839-04:00 responseStart=2025-05-21T00:12:13.860-04:00 tlsStart=0001-01-01T00:00:00.000Z tlsDone=0001-01-01T00:00:00.000Z end=0001-01-01T00:00:00.000Z
109+
time=2025-05-21T04:12:13.974Z level=INFO source=handler.go:194 msg="Response timings for roundtrip" module=http_2xx target=prometheus.io roundtrip=1 start=2025-05-21T00:12:13.860-04:00 dnsDone=2025-05-21T00:12:13.861-04:00 connectDone=2025-05-21T00:12:13.869-04:00 gotConn=2025-05-21T00:12:13.925-04:00 responseStart=2025-05-21T00:12:13.974-04:00 tlsStart=2025-05-21T00:12:13.869-04:00 tlsDone=2025-05-21T00:12:13.925-04:00 end=2025-05-21T00:12:13.974-04:00
110+
time=2025-05-21T04:12:13.974Z level=INFO source=handler.go:194 msg="Probe succeeded" module=http_2xx target=prometheus.io duration_seconds=0.14708839
111+
^Ctime=2025-05-21T04:12:17.818Z level=INFO source=main.go:283 msg="Received SIGTERM, exiting gracefully..."
112+
```
113+
</details>
114+
115+
<details>
116+
<summary>Example output with `--log.level=debug` and `--log.prober=info`</summary>
117+
118+
```bash
119+
./blackbox_exporter --config.file ./blackbox.yml --log.level=debug --log.prober=info
120+
time=2025-05-21T04:13:18.497Z level=INFO source=main.go:88 msg="Starting blackbox_exporter" version="(version=0.26.0, branch=fix/scrape-logger-spam, revision=7df3031feecba82f1a534336979b4e5920f79b72)"
121+
time=2025-05-21T04:13:18.497Z level=INFO source=main.go:89 msg="(go=go1.24.1, platform=linux/amd64, user=tjhop@contraband, date=20250521-04:00:25, tags=unknown)"
122+
time=2025-05-21T04:13:18.497Z level=INFO source=main.go:101 msg="Loaded config file"
123+
time=2025-05-21T04:13:18.498Z level=DEBUG source=main.go:116 msg=http://contraband:9115
124+
time=2025-05-21T04:13:18.498Z level=DEBUG source=main.go:130 msg=/
125+
time=2025-05-21T04:13:18.498Z level=INFO source=tls_config.go:347 msg="Listening on" address=[::]:9115
126+
time=2025-05-21T04:13:18.498Z level=INFO source=tls_config.go:350 msg="TLS is disabled." http2=false address=[::]:9115
127+
time=2025-05-21T04:13:23.169Z level=INFO source=handler.go:194 msg="Beginning probe" module=http_2xx target=prometheus.io probe=http timeout_seconds=119.5
128+
time=2025-05-21T04:13:23.169Z level=INFO source=handler.go:194 msg="Resolving target address" module=http_2xx target=prometheus.io target=prometheus.io ip_protocol=ip4
129+
time=2025-05-21T04:13:23.170Z level=INFO source=handler.go:194 msg="Resolved target address" module=http_2xx target=prometheus.io target=prometheus.io ip=104.21.60.220
130+
time=2025-05-21T04:13:23.170Z level=INFO source=handler.go:194 msg="Making HTTP request" module=http_2xx target=prometheus.io url=http://104.21.60.220 host=prometheus.io
131+
time=2025-05-21T04:13:23.202Z level=INFO source=handler.go:194 msg="Received redirect" module=http_2xx target=prometheus.io location=https://prometheus.io/
132+
time=2025-05-21T04:13:23.202Z level=INFO source=handler.go:194 msg="Making HTTP request" module=http_2xx target=prometheus.io url=https://prometheus.io/ host=""
133+
time=2025-05-21T04:13:23.202Z level=INFO source=handler.go:194 msg="Address does not match first address, not sending TLS ServerName" module=http_2xx target=prometheus.io first=104.21.60.220 address=prometheus.io
134+
time=2025-05-21T04:13:23.316Z level=INFO source=handler.go:194 msg="Received HTTP response" module=http_2xx target=prometheus.io status_code=200
135+
time=2025-05-21T04:13:23.319Z level=INFO source=handler.go:194 msg="Response timings for roundtrip" module=http_2xx target=prometheus.io roundtrip=0 start=2025-05-21T00:13:23.171-04:00 dnsDone=2025-05-21T00:13:23.171-04:00 connectDone=2025-05-21T00:13:23.181-04:00 gotConn=2025-05-21T00:13:23.181-04:00 responseStart=2025-05-21T00:13:23.201-04:00 tlsStart=0001-01-01T00:00:00.000Z tlsDone=0001-01-01T00:00:00.000Z end=0001-01-01T00:00:00.000Z
136+
time=2025-05-21T04:13:23.319Z level=INFO source=handler.go:194 msg="Response timings for roundtrip" module=http_2xx target=prometheus.io roundtrip=1 start=2025-05-21T00:13:23.202-04:00 dnsDone=2025-05-21T00:13:23.203-04:00 connectDone=2025-05-21T00:13:23.212-04:00 gotConn=2025-05-21T00:13:23.268-04:00 responseStart=2025-05-21T00:13:23.316-04:00 tlsStart=2025-05-21T00:13:23.212-04:00 tlsDone=2025-05-21T00:13:23.268-04:00 end=2025-05-21T00:13:23.319-04:00
137+
time=2025-05-21T04:13:23.319Z level=INFO source=handler.go:194 msg="Probe succeeded" module=http_2xx target=prometheus.io duration_seconds=0.150580389
138+
^Ctime=2025-05-21T04:13:27.945Z level=INFO source=main.go:283 msg="Received SIGTERM, exiting gracefully..."
139+
```
140+
</details>
141+
142+
143+
<details>
144+
<summary>Example output with `--log.level=debug` and `--log.prober=debug`</summary>
145+
146+
```bash
147+
./blackbox_exporter --config.file ./blackbox.yml --log.level=debug --log.prober=debug
148+
time=2025-05-21T04:14:55.621Z level=INFO source=main.go:88 msg="Starting blackbox_exporter" version="(version=0.26.0, branch=fix/scrape-logger-spam, revision=7df3031feecba82f1a534336979b4e5920f79b72)"
149+
time=2025-05-21T04:14:55.621Z level=INFO source=main.go:89 msg="(go=go1.24.1, platform=linux/amd64, user=tjhop@contraband, date=20250521-04:00:25, tags=unknown)"
150+
time=2025-05-21T04:14:55.622Z level=INFO source=main.go:101 msg="Loaded config file"
151+
time=2025-05-21T04:14:55.622Z level=DEBUG source=main.go:116 msg=http://contraband:9115
152+
time=2025-05-21T04:14:55.622Z level=DEBUG source=main.go:130 msg=/
153+
time=2025-05-21T04:14:55.623Z level=INFO source=tls_config.go:347 msg="Listening on" address=[::]:9115
154+
time=2025-05-21T04:14:55.623Z level=INFO source=tls_config.go:350 msg="TLS is disabled." http2=false address=[::]:9115
155+
time=2025-05-21T04:15:03.048Z level=DEBUG source=handler.go:194 msg="Beginning probe" module=http_2xx target=prometheus.io probe=http timeout_seconds=119.5
156+
time=2025-05-21T04:15:03.049Z level=DEBUG source=handler.go:194 msg="Resolving target address" module=http_2xx target=prometheus.io target=prometheus.io ip_protocol=ip4
157+
time=2025-05-21T04:15:03.050Z level=DEBUG source=handler.go:194 msg="Resolved target address" module=http_2xx target=prometheus.io target=prometheus.io ip=172.67.201.240
158+
time=2025-05-21T04:15:03.050Z level=DEBUG source=handler.go:194 msg="Making HTTP request" module=http_2xx target=prometheus.io url=http://172.67.201.240 host=prometheus.io
159+
time=2025-05-21T04:15:03.089Z level=DEBUG source=handler.go:194 msg="Received redirect" module=http_2xx target=prometheus.io location=https://prometheus.io/
160+
time=2025-05-21T04:15:03.089Z level=DEBUG source=handler.go:194 msg="Making HTTP request" module=http_2xx target=prometheus.io url=https://prometheus.io/ host=""
161+
time=2025-05-21T04:15:03.089Z level=DEBUG source=handler.go:194 msg="Address does not match first address, not sending TLS ServerName" module=http_2xx target=prometheus.io first=172.67.201.240 address=prometheus.io
162+
time=2025-05-21T04:15:03.211Z level=DEBUG source=handler.go:194 msg="Received HTTP response" module=http_2xx target=prometheus.io status_code=200
163+
time=2025-05-21T04:15:03.212Z level=DEBUG source=handler.go:194 msg="Response timings for roundtrip" module=http_2xx target=prometheus.io roundtrip=0 start=2025-05-21T00:15:03.050-04:00 dnsDone=2025-05-21T00:15:03.050-04:00 connectDone=2025-05-21T00:15:03.061-04:00 gotConn=2025-05-21T00:15:03.061-04:00 responseStart=2025-05-21T00:15:03.089-04:00 tlsStart=0001-01-01T00:00:00.000Z tlsDone=0001-01-01T00:00:00.000Z end=0001-01-01T00:00:00.000Z
164+
time=2025-05-21T04:15:03.212Z level=DEBUG source=handler.go:194 msg="Response timings for roundtrip" module=http_2xx target=prometheus.io roundtrip=1 start=2025-05-21T00:15:03.089-04:00 dnsDone=2025-05-21T00:15:03.090-04:00 connectDone=2025-05-21T00:15:03.102-04:00 gotConn=2025-05-21T00:15:03.163-04:00 responseStart=2025-05-21T00:15:03.211-04:00 tlsStart=2025-05-21T00:15:03.102-04:00 tlsDone=2025-05-21T00:15:03.163-04:00 end=2025-05-21T00:15:03.212-04:00
165+
time=2025-05-21T04:15:03.212Z level=DEBUG source=handler.go:194 msg="Probe succeeded" module=http_2xx target=prometheus.io duration_seconds=0.163695815
166+
^Ctime=2025-05-21T04:15:07.862Z level=INFO source=main.go:283 msg="Received SIGTERM, exiting gracefully..."
167+
```
168+
</details>
169+
53170
## Building the software
54171

55172
### Local Build

go.mod

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,41 @@ require (
66
github.com/alecthomas/kingpin/v2 v2.4.0
77
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9
88
github.com/andybalholm/brotli v1.1.1
9-
github.com/google/cel-go v0.24.1
10-
github.com/miekg/dns v1.1.65
11-
github.com/prometheus/client_golang v1.21.1
12-
github.com/prometheus/client_model v0.6.1
13-
github.com/prometheus/common v0.63.0
9+
github.com/google/cel-go v0.25.0
10+
github.com/miekg/dns v1.1.66
11+
github.com/prometheus/client_golang v1.22.0
12+
github.com/prometheus/client_model v0.6.2
13+
github.com/prometheus/common v0.64.0
1414
github.com/prometheus/exporter-toolkit v0.14.0
15-
golang.org/x/net v0.39.0
16-
google.golang.org/grpc v1.71.1
15+
golang.org/x/net v0.40.0
16+
google.golang.org/grpc v1.72.2
1717
gopkg.in/yaml.v2 v2.4.0
1818
gopkg.in/yaml.v3 v3.0.1
1919
)
2020

2121
require (
22-
cel.dev/expr v0.19.1 // indirect
22+
cel.dev/expr v0.23.1 // indirect
2323
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
2424
github.com/beorn7/perks v1.0.1 // indirect
2525
github.com/cespare/xxhash/v2 v2.3.0 // indirect
2626
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
2727
github.com/jpillora/backoff v1.0.0 // indirect
28-
github.com/klauspost/compress v1.17.11 // indirect
2928
github.com/mdlayher/socket v0.4.1 // indirect
3029
github.com/mdlayher/vsock v1.2.1 // indirect
3130
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
3231
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
3332
github.com/prometheus/procfs v0.15.1 // indirect
3433
github.com/stoewer/go-strcase v1.2.0 // indirect
3534
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
36-
golang.org/x/crypto v0.37.0 // indirect
35+
golang.org/x/crypto v0.38.0 // indirect
3736
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
38-
golang.org/x/mod v0.23.0 // indirect
39-
golang.org/x/oauth2 v0.25.0 // indirect
40-
golang.org/x/sync v0.13.0 // indirect
41-
golang.org/x/sys v0.32.0 // indirect
42-
golang.org/x/text v0.24.0 // indirect
43-
golang.org/x/tools v0.30.0 // indirect
44-
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 // indirect
45-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
46-
google.golang.org/protobuf v1.36.5 // indirect
37+
golang.org/x/mod v0.24.0 // indirect
38+
golang.org/x/oauth2 v0.30.0 // indirect
39+
golang.org/x/sync v0.14.0 // indirect
40+
golang.org/x/sys v0.33.0 // indirect
41+
golang.org/x/text v0.25.0 // indirect
42+
golang.org/x/tools v0.32.0 // indirect
43+
google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect
44+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
45+
google.golang.org/protobuf v1.36.6 // indirect
4746
)

0 commit comments

Comments
 (0)