Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
bhaskrsaishankr
Participant
3,204

SAP Cloud platform, API Management offers many best practices which can be customized based on your requirement. Logging is a bit complex part of SAP APIM. Custom Charts is an option to monitor the APIs based on our own way of representing the graph.


In this blog I'm going to show you how to log and display the error messages on the custom chart using statistics collector policy.

Step: 1

The first step is to create an API Proxy using an URL/provider/proxy in the API Portal.

Once API is created it should be deployed successfully.

Step: 2

Now, go to Analyze tab, Click on +Add and create a custom metric.


Create Custom Metric


Add the dimension, name it and click on Ok.



Create Dimension


Step: 3

Then create a custom chart.


Custom Chart


Note: I created custom chart in a Custom_view named custom view. we can also create on existing custom views.

Add Dimensions and Measures for checking the required data to be represented on the Chart.


Here I'm considering API Name, Response Code and Error_Description (Displayed in order on the graph) (Created Dimension) as my Dimensions and Errors, Policy Error, Target Error as my Measures to display on the chart.


Note: Measures are displayed on the Vertical axis and Dimensions are displayed on the Horizontal axis.


Dimensions and Measures


Step: 4

Filter the APIs and Response codes which you want to monitor on the graph (chart)


Filter APIs and Response Codes


Note: Here I've filtered out one API (Test_Monitoring) which I created for testing also filtered out with 2xx response codes.

Step: 5

Now open the created API Proxy and add statistics collector policy and API Key policy in the proxy pre flow.


Name of the statistics should be the name created in the custom metric - Dimension Refer. Step 2

Here I used ref='error.content' as I wanted to plot the complete error message on the graph. For Reference - https://help.sap.com/docs/SAP_CLOUD_PLATFORM_API_MANAGEMENT/66d066d903c2473f81ec33acfe2ccdb4/edf281e...


Statistics collector Policy


Step: 6

Call the API with Invalid API key or No API key from Postman/API Test Console.


API Test Console


Step 7:

Now go the created custom chart as the error will be captured and displayed on the custom chart created.

Note 1: Use date-time to filter accordingly to check for a certain time period.

Note 2: Sometimes after creating a chart with custom dimension or custom measure, you'll experience a delay of 20-30 minutes before data starts appearing in the charts.


Custom Chart


To analyze further open the custom chart and click on the bar.


Custom Chart


Again Click on the bar to check the Response Code.


Custom Chart


Again Click on the bar to check the Error_Description.


Custom Chart


Similarly you can create your own Dimensions and Measures and try plotting them on the graph. 🙂


For more information please visit -

https://help.sap.com/docs/SAP_CLOUD_PLATFORM_API_MANAGEMENT/66d066d903c2473f81ec33acfe2ccdb4/adcbc07...
2 Comments
Labels in this area