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(sdk): add endpoints for api request statistics #70

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

jaroslawmalekcodete
Copy link
Contributor

Description

Add 3 new endpoints:

1.

GET /products/{productId}/envs/{envId}/statistics/api-activity-requests?requestStartTime={startTime}&requestEndTime={endTime}
Example of the response:

    "code": 200,
    "message": "OK",
    "data": {
        "requestStatistics": [
            {
                "date": "2024-10-17",
                "success": 388,
                "error": 620
            },
            {
                "date": "2024-10-18",
                "success": 357,
                "error": 651
            },
            {
                "date": "2024-10-19",
                "success": 393,
                "error": 615
            }
        ]
    }
}

2

GET /products/{productId}/envs/{envId}/statistics/error-requests?requestStartTime={startTime}&requestEndTime={endTime}
Example of the response:

{
    "code": 200,
    "message": "OK",
    "data": {
        "errorBreakdowns": [
            {
                "date": "2024-10-17",
                "errors": {
                    "400": 237,
                    "401": 229,
                    "404": 24,
                    "500": 130
                }
            },
            {
                "date": "2024-10-18",
                "errors": {
                    "400": 228,
                    "401": 229,
                    "404": 24,
                    "500": 170
                }
            }
        ]
    }
}

3

GET /products/{productId}/envs/{envId}/statistics/most-popular-endpoint?requestStartTime={startTime}&requestEndTime={endTime}
Example of the response:

{
  "code": 200,
  "message": "OK",
  "data": {
    "endpointUsages": [
      {
        "method": "GET",
        "endpoint": "/mefApi/sonata/order/789",
        "usage": 117,
        "popularity": 11.6
      },
      {
        "method": "GET",
        "endpoint": "/mefApi/sonata/product/825",
        "usage": 78,
        "popularity": 7.73
      },
      {
        "method": "GET",
        "endpoint": "/mefApi/sonata/product/789",
        "usage": 78,
        "popularity": 7.73
      },
      {
        "method": "POST",
        "endpoint": "/mefApi/sonata/order/789",
        "usage": 72,
        "popularity": 7.14
      },
      {
        "method": "GET",
        "endpoint": "/mefApi/sonata/geographicAddressManagement/v7/geographicAddress/825",
        "usage": 65,
        "popularity": 6.44
      },
      {
        "method": "GET",
        "endpoint": "/mefApi/sonata/order/825",
        "usage": 52,
        "popularity": 5.15
      },
      {
        "method": "POST",
        "endpoint": "/mefApi/sonata/product/789",
        "usage": 48,
        "popularity": 4.76
      }
    ]
  }
} 

Related Issue

#19

Motivation and Context

How This Has Been Tested

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring or add test (improvements in base code or adds test coverage to functionality)
  • CI/CD or documentation update (changes to CI/CD pipeline or documentation)

Checklist

  • I ensured that the documentation is up to date
  • I explained why this PR updates in detail with reasoning why it's required
  • I would like a code coverage CI quality gate exception and have explained why

@jaroslawmalekcodete jaroslawmalekcodete requested a review from a team as a code owner November 5, 2024 08:41
Copy link
Contributor

github-actions bot commented Nov 5, 2024

Library Vulnerability scan results

The following vulnerabilities have been found in libraries included in the repository (some might be dependencies of dependencies).

Critical 🔴 and High 🟡 severity vulnerabilities must be fixed before the PR can be merged, even if they are dependencies of dependencies.

Library Vulnerable version Severity Fix version Vulnerability ID

Copy link

sonarqubecloud bot commented Nov 5, 2024

Copy link

sonarqubecloud bot commented Nov 5, 2024

Copy link
Contributor

@zhiyaoPCCW zhiyaoPCCW left a comment

Choose a reason for hiding this comment

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

LGTM

@jaroslawmalekcodete jaroslawmalekcodete merged commit 6d96c28 into main Nov 5, 2024
6 checks passed
@jaroslawmalekcodete jaroslawmalekcodete deleted the jarek/kraken-19 branch November 5, 2024 10:58
Copy link
Contributor

@kuangxiang20240501 kuangxiang20240501 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhiyaoPCCW zhiyaoPCCW changed the title feat(sdk): kraken-19 - add endpoints for api request statistics feat(sdk): add endpoints for api request statistics Nov 6, 2024
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