Skip to content

feat(metrics): Add missing metrics for recovery phone#18383

Merged
vbudhram merged 1 commit intomainfrom
fxa-11067
Feb 20, 2025
Merged

feat(metrics): Add missing metrics for recovery phone#18383
vbudhram merged 1 commit intomainfrom
fxa-11067

Conversation

@vbudhram
Copy link
Copy Markdown
Contributor

@vbudhram vbudhram commented Feb 14, 2025

Because

  • We wanted additional statsd metrics for sms

This pull request

  • Adds statsd metrics
    • Graph for Lookup Phone Number error
    • Graph for Lookup Phone Number success
      • Potential sim swap
      • Potential sim pumping risk
    • Graph for Recovery Phone Added
    • Graph for Recovery Phone Setup Confirmed
    • Graph for Recovery Phone SignIn Confirmed
    • Graph for Recovery Phone Removed
  • Updates our routes to also replace this.log.info with statsd

Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-11128
Closes: https://mozilla-hub.atlassian.net/browse/FXA-11067

Checklist

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Other information (Optional)

Dashboards have been started here https://yardstick.mozilla.org/d/eed2dadjju48wc/fxa-sms?orgId=1&from=now-6h&to=now&timezone=browser

@vbudhram vbudhram self-assigned this Feb 14, 2025
@vbudhram vbudhram force-pushed the fxa-11067 branch 2 times, most recently from b30ac39 to c27b250 Compare February 18, 2025 21:00
@vbudhram vbudhram marked this pull request as ready for review February 18, 2025 21:02
@vbudhram vbudhram requested a review from a team as a code owner February 18, 2025 21:02
this.metrics.histogram(
'sms.phoneNumberLookup.success.smsPumpingRisk',
smsPumpingRisk
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think I understand this metric.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was hoping that we could see the sms pumping risk over time. Histogram seems right?

https://www.twilio.com/docs/glossary/what-is-sms-pumping-fraud

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think histogram is a right StatsD metric type for it. But I'm trying to think how I'd interpret something like average sms pumping risk over time. Maybe just a lack of imagination on my part.

Copy link
Copy Markdown
Contributor

@dschom dschom Feb 19, 2025

Choose a reason for hiding this comment

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

A gauge might also be useful, see comment above. That should give us a plot of points over time. Basically I'd just like to sere a line bouncing around. Histrogram works too though. Maybe we are more concerned with the trend of the max values than the averages?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I say we keep both?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sounds good to me.

this.metrics.histogram(
'sms.phoneNumberLookup.success.phoneNumberQualityScore',
phoneNumberQualityScore
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't understand this either.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Twillio says this

The Phone Number Quality Score uses a risk-based framework to assess potential risks. Higher scores indicate greater risk, helping identify numbers linked to issues like fraud.

Copy link
Copy Markdown
Contributor

@chenba chenba left a comment

Choose a reason for hiding this comment

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

LGTM although I don't understand the purpose of the two histogram metrics

}
const smsPumpingRisk = result?.smsPumpingRisk?.smsPumpingRiskScore;
if (smsPumpingRisk) {
this.metrics.histogram(
Copy link
Copy Markdown
Contributor

@dschom dschom Feb 19, 2025

Choose a reason for hiding this comment

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

Not sure it matters, but I already added something for this in the service. Search for this.metrics.gauge('sim_pumping_risk', smsPumpingRisk);

I think maybe the service is the better place to do this since we can control the stat for a lookup during phone number confirm, vs a lookup that might happen in the future during a sign in confirmation.

* the last sim swap period.
*/
const simSwapPeriod = result.simSwap?.lastSimSwap?.swappedPeriod;
if (simSwapPeriod) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note that simSwapping seems most useful on confirm code for signin, and we don't call phoneNumberLookup at this here at this point in time.

@dschom dschom self-requested a review February 20, 2025 00:23
@vbudhram vbudhram merged commit b81589b into main Feb 20, 2025
@vbudhram vbudhram deleted the fxa-11067 branch February 20, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants