In this guide we illustrate the integration of Coherence Spring Sock Shop with Oracle Cloud Infrastructure (OCI) Application Performance Monitoring (APM) as another option to process distributed traces.
To set up Sock Shop with APM, please follow the guide Complete Application Deployment but please ignore the section about Jaeger.
You can find the official OCI APM Documentation at:
In order to set up APM we will start from scratch. The only requirement is that you have a valid account for OCI. Here are the basic steps to set up APM:
- Login to OCI.
- Under
Observability and Management
, selectApplication Performance Administration
. - Click on
Create APM Domain
. - Enter a name
Coherence Spring Sock Shop
. - For now, we can check the checkbox
Create as Always Free Domain
. - Click on the link
Coherence Spring Sock Shop
to enter theDomain Details
screen.
On the Domain Details
screen, we are interested in 3 values:
- Data Upload Endpoint
- Private Data Key or
- Public Data Key
We will use these values to construct the Application Performance Monitoring collector URL. The APM collector URL has the following format:
<apm-domain-short-id>.<apm-collector-domain>/<API version>/observations/<observationType>
?dataFormat=<dataFormat>&dataFormatVersion=<dataFormatVersion>&dataKey=<dataKey>
For detailed information on the APM Collector URL Format see the reference guide.
Private versus Public Data Key:
You can either use the Private Data Key or the Public Data Key, depending on your environment. This was built to allow users to separate traffic that comes from safe locations like your backend servers vs. a non-safe locations like browsers or in any situation where any end user may look up the traffic and see the data key.
- When using the Private Data Key you must also set
<observationType>
toprivate-span
. - When using the Public Data Key you must also set
<observationType>
topublic-span
.
In the Sock Shop use-case we will use the private key, but both configurations will work. Your URL should look like this:
https://[redacted].apm-agt.us-ashburn-1.oci.oraclecloud.com/20200101/observations/private-span?dataFormat=zipkin&dataFormatVersion=2&dataKey=[private key]
We need to enable tracing for OCI APM in the app.yaml
files for each service under the /k8s/coherence/
folder. Here
we will also set the APM collector URL that we obtained in the previous section. It is important that we split up the
URL into the parts base-url
and the api-path
.
We need to specify the following properties and set:
management.tracing.enabled
totrue
management.zipkin.tracing.endpoint
tohttps://[redacted].apm-agt.us-ashburn-1.oci.oraclecloud.com/20200101/observations/private-span?dataFormat=zipkin&dataFormatVersion=2&dataKey=[private key]
Your app.yaml
file should look like this:
application:
main: com.oracle.coherence.examples.sockshop.spring.carts.CartsApp
args:
- "--port=8080"
- "--management.tracing.enabled=true"
- "--management.zipkin.tracing.endpoint=https://[redacted].apm-agt.us-ashburn-1.oci.oraclecloud.com/20200101/observations/private-span?dataFormat=zipkin&dataFormatVersion=2&dataKey=[private key]"
- "--coherence.server.startup-timeout=5m"
Rebuild and redeploy the Sock Shop services. Now order some socks and afterwards head over to the APM dashboard at:
There, select you Compartment
and your APM Domain
and then click on the run button, and you should see the traces
that were emitted from the Sock Shop application.