hyperswitch
hyperswitch copied to clipboard
feat(analytics): authentication analytics
Type of Change
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD
Description
Authentication Analytics - with the following metrics:
- AuthenticationAttemptCount
- AuthenticationSuccessCount
- ChallengeAttemptCount
- ChallengeFlowCount
- ChallengeSuccessCount
- FrictionlessFlowCount
- ThreeDsSdkCount
Additional Changes
- [ ] This PR modifies the API contract
- [ ] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
curl --location 'localhost:8080/analytics/v1/metrics/auth_events' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer {token}' \ --data '[ { "timeRange": { "startTime": "2024-01-13T18:30:00Z", "endTime": "2024-04-30T18:30:00Z" }, "metrics": [ "three_ds_sdk_count", "authentication_attempt_count", "authentication_success_count", "challenge_flow_count", "frictionless_flow_count", "challenge_attempt_count", "challenge_success_count" ] } ]'
{
"queryData": [
{
"three_ds_sdk_count": 3,
"authentication_attempt_count": 3,
"authentication_success_count": 3,
"challenge_flow_count": 2,
"frictionless_flow_count": 1,
"challenge_attempt_count": 2,
"challenge_success_count": 2,
"time_bucket": "2024-01-09T00:00:00Z"
}
],
"metaData": [
{
"current_time_range": {
"start_time": "2024-01-13T18:30:00.000Z",
"end_time": "2024-04-30T18:30:00.000Z"
}
}
]
}
Checklist
- [x] I formatted the code
cargo +nightly fmt --all
- [x] I addressed lints thrown by
cargo clippy
- [x] I reviewed the submitted code
- [x] I added unit tests for my changes where possible
- [ ] I added a CHANGELOG entry if applicable
@vsrivatsa-juspay Is there going to be a new clickhouse table for this? can you add a script of the clickhouse table creation if exists?
@vsrivatsa-juspay Is there going to be a new clickhouse table for this? can you add a script of the clickhouse table creation if exists?
In a future version. Will add the table scripts as well as refactor the queries as well