hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(analytics): authentication analytics

Open vsrivatsa-edinburgh opened this issue 10 months ago • 2 comments

Type of Change

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

Description

Authentication Analytics - with the following metrics:

  1. AuthenticationAttemptCount
  2. AuthenticationSuccessCount
  3. ChallengeAttemptCount
  4. ChallengeFlowCount
  5. ChallengeSuccessCount
  6. FrictionlessFlowCount
  7. 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-edinburgh avatar Apr 22 '24 14:04 vsrivatsa-edinburgh

@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?

lsampras avatar Apr 25 '24 10:04 lsampras

@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

vsrivatsa-edinburgh avatar Apr 26 '24 08:04 vsrivatsa-edinburgh