Duration : 10 mins
Persona : API Team / Operations
After you launch your API program, the operations team is typically responsible for ensuring that the APIs are available and performing as expected to maintain a seamless experience for your consumers.
Proactive detection of API traffic and performance issues is a key component to the team's success. As API traffic increases, without access to in-depth data analysis and contextual alerting, the ability to meet customer service-level agreements (SLAs) may be put at risk.
Apigee API Monitoring helps operations teams increase API availability for application developers, customers, and partners. Apigee API Monitoring works in conjunction with Apigee Edge Cloud (SaaS) to provide real-time contextual insights into API performance, helps quickly diagnose issues, and facilitates remedial actions for business continuity.
By exposing an API through Apigee Edge, in addition to API lifecycle management, you gain the ability to monitor its behavior using the out-of-the-box API Monitoring feature. While Edge's out-of-the-box policies enable you to enhance your API with sophisticated features to control traffic, enhance performance, enforce security, and increase the utility of your APIs, without requiring you to write any code or to modify any backend services, API Monitoring helps you monitor various operational aspects of the API, and alert your operations team when events such as traffic throttling limits occur.
In this lab we will see how to use Apigee API Monitoring to proactively notify you ops team of traffic spikes. A Spike Arrest policy is already applied to your API proxy, and can throttle the number of requests processed by an API proxy and sent to a target backend, thereby protecting against performance issues and downtime.
For this lab, please ensure that you have an API Proxy with a Spike Arrest policy applied, as indicated in Module 2a Lab 1 - Throttle APIs.
-
Go to https://apigee.com/edge and log in. This is the Edge management UI.
-
Select Develop → API Proxies in the side navigation menu.
- If you have already completed API Jam Module 2a Lab 1 - Throttle APIs, you should see the {yourinitials}_Hipster-Products-API proxy that was created as part of that lab.
If you do not already have the API Proxy, please complete the steps below:
-
Download this API Proxy bundle.
-
In the subsequent wizard, select the Proxy bundle option, and click Next.
-
Click Choose file and upload the API Proxy zip bundle you previously downloaded. Replace the API Proxy name prefix '
xx
', with your initials. You do this so that you're not breaking any other user's work within the same Apigee Edge org. Then click Next. -
Once the proxy is uploaded, click the link to open the proxy.
-
Click the Develop tab to edit the proxy configuration. Select the 'default' Proxy Endpoint and edit the basepath as shown below, to
/v1/{{your initials}}_hipster-products-api
. Then click the Save button to save the changes.
If you already have the Hipster API Products proxy built from API Jam Module-1 deployed in your Apigee Edge org, no other setup is required.
- Ensure that the latest revision (it may not be 'Revision 1' as shown below), of the API Proxy is deoployed to the
test
environment. Click the Deployment drop down and select the test environment to deploy the proxy to the test environment:
Let us now add rate limit alerts to this org and environment, to alert when the Spike Arrest policy within this API proxy is triggered.
- Log in to the Apigee Edge Management UI as a user with an appropriate role.
Note: To access API Monitoring within your Apigee Edge Org, you should be assigned an appropriate API Monitoring role, such as "API Monitoring Admin", "API Monitoring User", "Org Admin", Read-only Org Admin" or "Operations Admin".
- Switch to the organization that you want to monitor, and navigate to Analyze -> API Monitoring -> Overview. This displays the API Monitoring dashboard, which is a summary view of API monitoring for all API proxies deployed to the selected environment in your organization.
- To set up a monitoring alert, click the Alerts button.
- Click the + Alert button.
- Fill in the alert details as follows:
- Alert Name:
Throttling Limit Alert
- Description:
Notify when traffic throttling limits are reached.
- Alert Type:
Fixed
- Environment:
test
- Status:
Enabled
-
Conditions
-
Metric:
Fault Code
Traffic Mgmt Policy > Spike Arrest > SpikeArrest Violation
-
Threshold:
Count
isgreater than or equal to
1
for5 minutes
-
Dimension:
Proxy
{{your initials}}_Hipster-Products-API
Region
Any
-
-
Reports
- Check the "Create an API analytics report based on alert conditions" checkbox.
-
Alert notifications
- Channel:
Email
- Destination:
{{your email address}}
- Channel:
- Click Save.
- Navigate to the API Proxy for which we are testing the alert generation, i.e. {{your initials}}_Hipster-Products-API, and to the Trace tab. Then, click on the "Start Trace Session" green button, append
/products
to the URL and click Send multiple times in quick succession, so as to trigger Spike Arrest policy violations.
- After a minute or two, you can check your email mailbox and should notice an alert notification email generated by Apigee sent to you:
- Click the View Details button. This will open a browser window with your API Monitoring dashboard and the alert details (provided that you are logged into Apigee Edge). Navigate the various options on this dashboard to understand the reason for alert, past alert data, etc.
Congratulations! You have successfully configured the platform to trigger Alerts and Notifications, based on different API metrics, thresholds and dimensions monitored.
Create similar alert configurtions for OAuth Access Token invalidation scenarios, such that the platform will send Security personnel email alert notifications when invalid access tokens are sent for more than 50% of all API traffic (across all API Proxies), in a 1 hour window. For a valid API Proxy to test this alert you can create and deploy a proxy per the instructions under Module 2a Lab 2 - Securing APIs with two-legged OAuth.
This lab demonstrates how to use the Apigee API Monitoring feature to monitor API traffic and set up automated alerts against the monitored metrics, thresholds and dimensions.