Skip to content

Code to enable analytics to be gathered every 5 minutes and sent to RapidAPI via the Analytics API

Notifications You must be signed in to change notification settings

RapidAPI/azureGatewayAnalytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

azureGatewayAnalytics

Code to enable analytics to be gathered every 5 minutes and sent to RapidAPI via the Analytics API

This code utilizes a Timer Trigger function in Azure to gather reports on API traffic over the last 5 minutes and then posts them to an HTTP Trigger function in Azure that creates the analytics in RapidAPI.

GitHub Repo

https://github.com/RapidAPI/azureGatewayAnalytics

What You Will Need

  1. Access to the Azure Platform. You can try it for free here.
  2. Set up a Timer Trigger Azure Function
  3. Set up an HTTP Trigger Azure Function
  4. Install the dotnev npm using the command in VS Code terminal "npm i dotenv"
  5. Set the following environment values in your .env file to support the javascript code running in the Azure serverless function.

Environment Values:

  • From RapidAPI
// Rapid GQL PAPI Values\
GQL_HOST='{your-graphql-platform-api-host}'\
GQL_URL='{your-graphql-platform-api-url}'\
GQL_RAPID_KEY='{your-graphql-platform-api-key}'\

// Rapid REST PAPI Values\
ANL_HOST='{your-analytics-platform-api-host}'\
ANL_URL='{your-analytics-platform-api-url}'\
ANL_RAPID_KEY='{your-analytics-platform-api-key}'\
  • From Azure
// AZURE GATEWAY API Values\
AZURE_SERVICE_GATEWAY='your-azure-api-gateway-name'\
AZURE_RESOURCE_GROUP='your-resource-group'\
AZURE_PROVIDER_NAME='Microsoft.ApiManagement'\
AZURE_API_VERSION='2021-12-01-preview'\
AZURE_SUBSCRIPTION='your 36-digit-azure subscription'\
AZURE_SHARED_ACCESS_KEY='your-shared-access-key-from-apim-service'\
AZURE_ANALYTICS_API='you-http-trigger-url'\

Future Enhancements

The functionality is split into 2 Azure functions; a timer trigger to get the reports and an HTTP trigger to create the analytics. Although this shows the flexibility of the Azure functions and the platform, these two can be combined into a single Timer trigger function.

About

Code to enable analytics to be gathered every 5 minutes and sent to RapidAPI via the Analytics API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published