feat(metrics): tag cryptify uploads with X-Cryptify-Source: thunderbird#121
Merged
Conversation
Adds X-Cryptify-Source: thunderbird to PG_CLIENT_HEADER so cryptify's per-channel upload metrics (encryption4all/cryptify#102) classify this add-in deterministically rather than via the User-Agent substring fallback. Thunderbird WebExtensions don't always present a stable Origin (can be `moz-extension://<uuid>` or null), and the User-Agent fallback is the last layer of cryptify's detect_channel. Setting the explicit header at the source removes any environment-dependent ambiguity and is symmetric with parallel PRs in postguard-website and postguard-outlook-addon.
Contributor
Author
|
/dobby review |
Contributor
There was a problem hiding this comment.
Reviewing post-merge — change looks correct.
- Single new entry on
PG_CLIENT_HEADER; header value matches the channel string consumed bydetect_channelper the linked cryptify#102. PG_CLIENT_HEADERis reused for bothpgClientHeader(passed to the popup) andheaderson the cryptify upload call (background.ts:399, :616), so the new header rides along on the upload path without any further plumbing.- Code comment justifying the explicit header (vs. the Origin/User-Agent fallback) is on the right side of the WHY-not-WHAT line — keeps it.
- Symmetric with the website and Outlook PRs as described, which is what makes the metric meaningful.
Test plan boxes 2 and 3 are manual (live Thunderbird + Grafana) — fine for a header-only change; no realistic unit-test surface here.
Contributor
|
Dobby sees the review request! This agent will take a quick look at the changes, even though the PR is already merged — better late than never. |
Contributor
Post-merge reviewAlready merged and approved, but the bot took a look anyway:
LGTM. No follow-up needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
X-Cryptify-Source: thunderbirdtoPG_CLIENT_HEADERso cryptify's per-channel upload metrics (encryption4all/cryptify#102) classify this add-in deterministically rather than via the User-Agent substring fallback.Why
cryptify's
detect_channelwalks: explicitX-Cryptify-Source→ API auth →Originsubstring →User-Agentsubstring. Thunderbird WebExtensions don't always present a stableOriginheader (it can bemoz-extension://<uuid>or null depending on the call site), so the existing path relied on the last-resort User-Agent substring. Setting the header explicitly here removes any environment-dependent ambiguity and is symmetric with parallel PRs in postguard-website and postguard-outlook-addon.Test plan
npx tsc --noEmitclean.cryptify_uploads_total{channel="thunderbird"}should increment by 1.