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

feat(analytics): add first_attempt as a filter for PaymentFilters #6604

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tsdk02
Copy link
Contributor

@tsdk02 tsdk02 commented Nov 19, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Added first_attempt as a filter in PaymentFilters.

This is required for the new Analytics v2 Smart Retries Metrics, specifically Smart Retries Successful Distribution and Smart Retries Failure Distribution, for calculations only involving smart retries (ignoring first attempts).

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

Helps in calculating certain metrics seamlessly.

How did you test it?

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@tsdk02 tsdk02 self-assigned this Nov 19, 2024
@tsdk02 tsdk02 requested a review from a team as a code owner November 19, 2024 08:32
Copy link

semanticdiff-com bot commented Nov 19, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  crates/analytics/src/payments/filters.rs  0% smaller
  crates/analytics/src/payments/types.rs  0% smaller
  crates/analytics/src/query.rs  0% smaller
  crates/analytics/src/sqlx.rs  0% smaller
  crates/api_models/src/analytics/payments.rs  0% smaller

@tsdk02 tsdk02 changed the title feat(analytics): add first_attempt as a filter for PaymentFilters feat(analytics): add first_attempt as a filter for PaymentFilters Nov 19, 2024
@tsdk02 tsdk02 linked an issue Nov 19, 2024 that may be closed by this pull request
@@ -104,6 +104,11 @@ where
.add_filter_in_range_clause(PaymentDimensions::ErrorReason, &self.error_reason)
.attach_printable("Error adding error reason filter")?;
}
if !self.first_attempt.is_empty() {
builder
.add_filter_in_range_clause("first_attempt", &self.first_attempt)
Copy link
Member

Choose a reason for hiding this comment

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

Why aren't we using a PaymentDimensions enum variant as the first param here?

Copy link
Contributor Author

@tsdk02 tsdk02 Nov 20, 2024

Choose a reason for hiding this comment

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

This is because, first_attempt is added only as a filter in PaymentFilters and not as a dimension in PaymentDimensions. Basically, this field can only be added as a filter and not as a group_by.

Copy link
Contributor

Choose a reason for hiding this comment

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

We are also planning to segregate these structs based on the type of sources we have , but for now this is needed.

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Nov 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 21, 2024
@SanchithHegde SanchithHegde added this pull request to the merge queue Nov 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 21, 2024
@SanchithHegde SanchithHegde added this pull request to the merge queue Nov 21, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 21, 2024
@SanchithHegde SanchithHegde added this pull request to the merge queue Nov 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 22, 2024
@SanchithHegde SanchithHegde added this pull request to the merge queue Nov 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 22, 2024
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.

feat(analytics): add first_attempt as a filter for PaymentFilters
3 participants