Page MenuHomePhabricator

Annotate X-Analytics header with any matching actions
Closed, ResolvedPublic

Description

When we 'trip' an action in requestctl-generated VCL, it would be nice if we also made this visible to request logging.

AIUI the X-Analytics field is a freeform map, so we can simply append an extra field like requestctl_rule=foo where foo is the name of the action.

We should do this annotation even if a corresponding ratelimiting or synthesis of a 4xx/5xx code *didn't* happen -- this way we can use it to review actions over time.

Event Timeline

CDanis triaged this task as High priority.Apr 21 2022, 1:27 PM

Change 787437 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/software/conftool@master] requestctl: set an X-Requestctl header for matching rules

https://gerrit.wikimedia.org/r/787437

Change 787438 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/software/conftool@master] requestctl: Allow detecting matching rules that are disabled

https://gerrit.wikimedia.org/r/787438

The idea with the above patches is that the vcl fragment from requestctl will be able to add an HTTP header X-Requestctl with a comma-separated list of rules that match.

Then in the actual varnish VCL we can do something like

if (req.http.X-Requestctl != "") {
    set req.http.X-Analytics = req.http.X-Analytics + ";requestctl=' + req.http.X-Requestctl;
}
unset req.http.X-Requestctl

Change 787437 merged by jenkins-bot:

[operations/software/conftool@master] requestctl: set an X-Requestctl header for matching rules

https://gerrit.wikimedia.org/r/787437

Change 787438 merged by jenkins-bot:

[operations/software/conftool@master] requestctl: Allow detecting matching rules that are disabled

https://gerrit.wikimedia.org/r/787438

Change 791372 had a related patch set uploaded (by Giuseppe Lavagetto; author: Giuseppe Lavagetto):

[operations/puppet@production] varnish: annotate X-Analytics header with matching requestctl actions

https://gerrit.wikimedia.org/r/791372

Change 791372 merged by Giuseppe Lavagetto:

[operations/puppet@production] varnish: annotate X-Analytics header with matching requestctl actions

https://gerrit.wikimedia.org/r/791372

Change 830677 had a related patch set uploaded (by CDanis; author: CDanis):

[operations/puppet@production] Fix minor requestctl reporting bug

https://gerrit.wikimedia.org/r/830677

Change 830678 had a related patch set uploaded (by CDanis; author: CDanis):

[operations/software/conftool@master] Remove buggy comma filter footer

https://gerrit.wikimedia.org/r/830678

Change 830677 merged by CDanis:

[operations/puppet@production] Fix minor requestctl reporting bug

https://gerrit.wikimedia.org/r/830677

Change 830678 merged by jenkins-bot:

[operations/software/conftool@master] Remove buggy comma filter footer

https://gerrit.wikimedia.org/r/830678

Mentioned in SAL (#wikimedia-operations) [2023-08-09T10:44:29Z] <_joe_> ran requestctl commit, which removed the comma removal from the requestctl output as per T305582