Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VPN enabled duration metric #28020

Merged
merged 1 commit into from
Mar 25, 2025
Merged

Add VPN enabled duration metric #28020

merged 1 commit into from
Mar 25, 2025

Conversation

DJAndries
Copy link
Collaborator

Resolves brave/brave-browser#44492

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

@DJAndries DJAndries requested review from a team as code owners March 7, 2025 02:31
@iefremov
Copy link
Contributor

we need someone owning vpn to review this one

@DJAndries DJAndries requested a review from deeppandya March 11, 2025 23:15
@DJAndries DJAndries force-pushed the vpn-enabled-duration-p3a branch from e1be9fa to 6370320 Compare March 12, 2025 00:20
@deeppandya deeppandya requested a review from simonhong March 12, 2025 01:37
@@ -79,16 +86,14 @@ class BraveVpnService :
#endif // BUILDFLAG(IS_ANDROID)

std::string GetCurrentEnvironment() const;
bool is_purchased_user() const {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to leave is_purchased_user() and IsConnected() as BraveVpnService's own api because both are part of vpn service's functionality.
IMO, we can simply call it via delegate's interface (ex, Delegate::GetIsPurchasedUser() or Delegate::GetIsConnected()) w/o name collision. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did something very similar for Leo, where I included existing methods in the delegate:

class ConversationHandlerForMetrics {
public:
virtual ~ConversationHandlerForMetrics() = default;
virtual size_t GetConversationHistorySize() = 0;
virtual bool should_send_page_contents() const = 0;
virtual mojom::APIError current_error() const = 0;
};

imho, it seems odd to have duplicated methods (i.e. having IsConnected and GetIsConnected side-by-side), especially for these getters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not block merging with this but still it seems strange to me to get vpn service's core state from metrics interface.

@DJAndries DJAndries force-pushed the vpn-enabled-duration-p3a branch from 6370320 to 5c06237 Compare March 14, 2025 00:47
Copy link
Contributor

Chromium major version is behind target branch (134.0.6998.95 vs 135.0.7049.17). Please rebase.

@github-actions github-actions bot added the chromium-version-mismatch The Chromium version on the PR branch does not match the version on the target branch label Mar 19, 2025
@DJAndries DJAndries force-pushed the vpn-enabled-duration-p3a branch from 5c06237 to 1615e17 Compare March 19, 2025 20:21
@github-actions github-actions bot removed the chromium-version-mismatch The Chromium version on the PR branch does not match the version on the target branch label Mar 19, 2025
@DJAndries DJAndries force-pushed the vpn-enabled-duration-p3a branch from 1615e17 to 8a72daa Compare March 19, 2025 20:22
Copy link
Contributor

@deeppandya deeppandya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DJAndries DJAndries merged commit d25f87d into master Mar 25, 2025
18 checks passed
@DJAndries DJAndries deleted the vpn-enabled-duration-p3a branch March 25, 2025 02:48
@github-actions github-actions bot added this to the 1.78.x - Nightly milestone Mar 25, 2025
@brave-builds
Copy link
Collaborator

Released in v1.78.64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add VPN enabled duration metric
7 participants