Merge lp:~hloeung/ubuntu-repository-cache/add-accept-encoding-headers into lp:ubuntu-repository-cache

Proposed by Haw Loeung
Status: Merged
Approved by: Haw Loeung
Approved revision: 331
Merged at revision: 330
Proposed branch: lp:~hloeung/ubuntu-repository-cache/add-accept-encoding-headers
Merge into: lp:ubuntu-repository-cache
Diff against target: 60 lines (+19/-6)
3 files modified
files/health_check.py (+1/-0)
lib/ubuntu_repository_cache/apache.py (+12/-5)
lib/ubuntu_repository_cache/squid.py (+6/-1)
To merge this branch: bzr merge lp:~hloeung/ubuntu-repository-cache/add-accept-encoding-headers
Reviewer Review Type Date Requested Status
Thomas Cuthbert (community) Approve
Canonical IS Reviewers Pending
Review via email: mp+399399@code.launchpad.net

Commit message

Add 'Accept-Encoding' in nrpe and health checks

Upstream archives use mod_deflate which sets 'Vary: Accept-Encoding' on responses, so check_http should set that header.

This also reduces the logging spam from squid:

| 2021/03/10 00:15:00 kid1| varyEvaluateMatch: Oops. Not a Vary match on second attempt, 'http://archive.ubuntu.com/ubuntu/pool/' 'accept-encoding="*"'
| 2021/03/10 00:15:00 kid1| clientProcessHit: Vary object loop!

We also hope to reduce squid memory usage (mem_node) as discovered by
tcuthbert.

To post a comment you must log in.
Revision history for this message
Thomas Cuthbert (tcuthbert) wrote :

LGTM +1

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 330

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'files/health_check.py'
--- files/health_check.py 2021-03-08 08:50:42 +0000
+++ files/health_check.py 2021-03-10 00:57:05 +0000
@@ -16,6 +16,7 @@
16CHECK_HEADERS = {16CHECK_HEADERS = {
17 'Host': 'archive.ubuntu.com',17 'Host': 'archive.ubuntu.com',
18 'User-agent': 'ubuntu-repository-cache/healthcheck',18 'User-agent': 'ubuntu-repository-cache/healthcheck',
19 'Accept-Encoding': '*',
19}20}
20CHECK_HOST = 'http://localhost/'21CHECK_HOST = 'http://localhost/'
21CHECK_TIMEOUT = 522CHECK_TIMEOUT = 5
2223
=== modified file 'lib/ubuntu_repository_cache/apache.py'
--- lib/ubuntu_repository_cache/apache.py 2021-03-07 22:00:26 +0000
+++ lib/ubuntu_repository_cache/apache.py 2021-03-10 00:57:05 +0000
@@ -355,15 +355,22 @@
355 check_cmd=(355 check_cmd=(
356 'check_http '356 'check_http '
357 '--hostname ubuntu-archive-asm.trafficmanager.net '357 '--hostname ubuntu-archive-asm.trafficmanager.net '
358 '--url "/{}/" --string "dists/" '358 '--url "/{}/" '
359 '--expect \"200\\ OK\"'359 '--string "dists/" '
360 '--expect \"200\\ OK\" '
361 '--header \"Accept-Encoding:\\ \\*\"'
360 ).format(path_base),362 ).format(path_base),
361 )363 )
362364
363 nrpe_config.add_check(365 nrpe_config.add_check(
364 shortname='apache',366 shortname='apache',
365 description='Apache2 serving archive metadata',367 description='Apache2 serving archive metadata',
366 check_cmd=('check_http --hostname localhost --url "/{}/" ' '--string "dists/" --expect \"200\\ OK\"').format(368 check_cmd=(
367 path_base369 'check_http '
368 ),370 '--hostname localhost '
371 '--url "/{}/" '
372 '--string "dists/" '
373 '--expect \"200\\ OK\" '
374 '--header \"Accept-Encoding:\\ \\*\"'
375 ).format(path_base),
369 )376 )
370377
=== modified file 'lib/ubuntu_repository_cache/squid.py'
--- lib/ubuntu_repository_cache/squid.py 2020-12-07 23:36:53 +0000
+++ lib/ubuntu_repository_cache/squid.py 2021-03-10 00:57:05 +0000
@@ -253,6 +253,11 @@
253 shortname='squid',253 shortname='squid',
254 description='squid serving archive pool',254 description='squid serving archive pool',
255 check_cmd=(255 check_cmd=(
256 'check_http --hostname localhost --url "/{}/pool/" ' '--string "main/" --expect \"200\\ OK\"'256 'check_http '
257 '--hostname localhost '
258 '--url "/{}/pool/" '
259 '--string "main/" '
260 '--expect \"200\\ OK\" '
261 '--header \"Accept-Encoding:\\ \\*\"'
257 ).format(path_base),262 ).format(path_base),
258 )263 )

Subscribers

People subscribed via source and target branches