Thursday, October 12, 2017

#599 APIP CS Analytics/Monitoring and custom logging

Monitoring of APIs is a very important feature of Oracle's API Platform Cloud Service.
We can do so at three levels -

1. Management UI

2. APIP CS REST API

3. Gateway logs


So, as usual, here is a simple example to get us going.





















As you can see, the API leverages the new APIP CS Service feature, which essentially
virtualises the backend endpoint.

Here is the Service Definition for my backend Bank Balance service -




The service is essentially a SOA Composite running on my laptop.

Anyway, back to monitoring -

I deploy the API to my Gateway and execute some tests via Postman.

My first test doesn't include the required app-key, so it gets rejected.


I now add the app key and re-test - and see the response I expect



I now execute some more requests so as to hit the throttling threshold -

Analytics via Management Portal UI 

Let's drill into the Errors & Rejections -


Now let's look at retrieving the same via the REST API.

Analytics via APIP CS REST API

Here I look for all rejections -

Again, I test using Postman -




Nice stuff!

Analytics via APIP CS Gateway logs

I find my Gateway log files here - 

/out/domains/gateway1/apics/analytics/logs


I check out the most recent logfile -


Now to the final piece -

the Response definition of the API is as follows -


As you ca see, I have included a Logging Policy -
Here I attempt to log the customer account number, returned by the backend service.




As you can see, the default custom logfile is called apipcs.log.

I find that logfile here - /out/domains/gateway1/apics/customlogs


so it failed to find the accoountNr, now what a surprise.
I now go back to the API definition and amend the Log policy accordingly.




No comments:

Post a Comment