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 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 Mergebot (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 Mergebot (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
1=== modified file 'files/health_check.py'
2--- files/health_check.py 2021-03-08 08:50:42 +0000
3+++ files/health_check.py 2021-03-10 00:57:05 +0000
4@@ -16,6 +16,7 @@
5 CHECK_HEADERS = {
6 'Host': 'archive.ubuntu.com',
7 'User-agent': 'ubuntu-repository-cache/healthcheck',
8+ 'Accept-Encoding': '*',
9 }
10 CHECK_HOST = 'http://localhost/'
11 CHECK_TIMEOUT = 5
12
13=== modified file 'lib/ubuntu_repository_cache/apache.py'
14--- lib/ubuntu_repository_cache/apache.py 2021-03-07 22:00:26 +0000
15+++ lib/ubuntu_repository_cache/apache.py 2021-03-10 00:57:05 +0000
16@@ -355,15 +355,22 @@
17 check_cmd=(
18 'check_http '
19 '--hostname ubuntu-archive-asm.trafficmanager.net '
20- '--url "/{}/" --string "dists/" '
21- '--expect \"200\\ OK\"'
22+ '--url "/{}/" '
23+ '--string "dists/" '
24+ '--expect \"200\\ OK\" '
25+ '--header \"Accept-Encoding:\\ \\*\"'
26 ).format(path_base),
27 )
28
29 nrpe_config.add_check(
30 shortname='apache',
31 description='Apache2 serving archive metadata',
32- check_cmd=('check_http --hostname localhost --url "/{}/" ' '--string "dists/" --expect \"200\\ OK\"').format(
33- path_base
34- ),
35+ check_cmd=(
36+ 'check_http '
37+ '--hostname localhost '
38+ '--url "/{}/" '
39+ '--string "dists/" '
40+ '--expect \"200\\ OK\" '
41+ '--header \"Accept-Encoding:\\ \\*\"'
42+ ).format(path_base),
43 )
44
45=== modified file 'lib/ubuntu_repository_cache/squid.py'
46--- lib/ubuntu_repository_cache/squid.py 2020-12-07 23:36:53 +0000
47+++ lib/ubuntu_repository_cache/squid.py 2021-03-10 00:57:05 +0000
48@@ -253,6 +253,11 @@
49 shortname='squid',
50 description='squid serving archive pool',
51 check_cmd=(
52- 'check_http --hostname localhost --url "/{}/pool/" ' '--string "main/" --expect \"200\\ OK\"'
53+ 'check_http '
54+ '--hostname localhost '
55+ '--url "/{}/pool/" '
56+ '--string "main/" '
57+ '--expect \"200\\ OK\" '
58+ '--header \"Accept-Encoding:\\ \\*\"'
59 ).format(path_base),
60 )

Subscribers

People subscribed via source and target branches