CONTEXT
Let F be a frontend, B a backend, R a recorder, A an APIGW deployment with a route and F a backend serverless function(Fn). A and B are implemented based on this code. F implemented based on this example. F exposed in APIGW as a route backed by function F
Here is the diagram of resources involved:

CONFIGURATION
Create an APM domain following this post

Grab the Data Upload Endpoint and the autogenerated_public_datakey for later:

Deploy the “Trace a function with APM and add custom child spans using Zipkin” function following instructions here and enable tracing as follows:

Modify the code of the recorder.js function and construct the zipkin endpoint with the values of Data Upload Endpoint and autogenerated_public_datakey to get something like this:
// Send spans to Zipkin asynchronously over HTTP const zipkinBaseUrl = 'https://aaaa.....aapi.apm-agt.eu-frankfurt-1.oci.oraclecloud.com'; const httpLogger = new HttpLogger({ endpoint: `${zipkinBaseUrl}/20200101/observations/public-span?dataFormat=zipkin&dataFormatVersion=2&dataKey=QMPW....3D`, jsonEncoder: JSON_V2 });
Expose Fn function in APIGW:

TRACING RESULTS
Following the screenshots of the traces generated when calling the different resources
/a request TO frontend

/b request TO frontend

/c request TO frontend

/s1 request to backend

/s2 request to backend

/f3 request to APIGW

CONCLUSION
Tracing capabilities in OCI can make your life easier when building apps distributed across several layers. Cloud native technologies help delivering business needs quicker and with less effort that traditional approaches, anyway tracing can be utilised in both cases.
That’s all, hope it helps! 🙂
One Comment