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 sessionized_metrics for refunds analytics #6419

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

maverox
Copy link

@maverox maverox commented Oct 23, 2024

Type of Change

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

Description

Add sessionized metrics module and implement backwards compatibility.

Fixes #6417

Additional Changes

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

Motivation and Context

Refund metrics didn't have a sessionized_metrics module and implementation as were there in payments and payment_intents metrics

How did you test it?

curl 'http://localhost:8080/analytics/v1/org/metrics/refunds' \
  -H 'Accept: */*' \
  -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json' \
  -H 'Origin: http://localhost:9000' \
  -H 'QueryType: SingleStat' \
  -H 'Referer: http://localhost:9000/' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-site' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36' \
  -H 'api-key: hyperswitch' \
  -H 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDZlOGRmZWYtMzI0Zi00Yjc0LTg2MTItYzdkZjNhOGZmZTcyIiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzI3NDM0NTkzIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTcyOTgzNzUwNywib3JnX2lkIjoib3JnXzl3Y0kxQ2hTOGVEdnRRQmRXak9IIiwicHJvZmlsZV9pZCI6InByb19FNW5lek43YjZUbVB1WlUzbEU1VSJ9.KlBRpu8DpGZ43u9hsB4xE2oSXNM21HC0RadRdfMe2VI' \
  -H 'sec-ch-ua: "Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  --data-raw '[{"timeRange":{"startTime":"2024-10-15T18:30:00Z","endTime":"2024-10-23T18:06:00Z"},"mode":"ORDER","source":"BATCH","metrics":["refund_success_rate","refund_count","refund_success_count","refund_processed_amount","sessionized_refund_success_rate","sessionized_refund_count","sessionized_refund_success_count","sessionized_refund_processed_amount"],"delta":true}]'

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

- extend api_models/src/analytics/refunds.rs
- extend metrics to include these enum variants
@maverox maverox requested a review from a team as a code owner October 23, 2024 19:59
@maverox maverox self-assigned this Oct 23, 2024
@maverox maverox added C-feature Category: Feature request or enhancement C-refactor Category: Refactor A-Analytics Rust Pull requests that update Rust code labels Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Analytics C-feature Category: Feature request or enhancement C-refactor Category: Refactor Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(analytics): add sessionized_metrics for refunds (backwards compatibility)
1 participant