ID-Based correlation mechanism is used for end-to-end transaction tracing. Two common use cases it is often used for (but not limited to):

User Click Tracing

(User Click>network>backend apps>db sql... correlation)

Correlation of a User Click down to any transactions that are triggered by that click e.g. network request, application api call, database sql, etc. Correlation IDs are injected at different start points (ex: User action in browser) and are carried along to other services. Each service that is monitored by one of our agents will pick up the ID, tag any data collected with said ID, and pass it along to further services (ex: when making outbound requests). Typically the easiest to set up, provided that we can monitor all / most applications / services across an environment. 

Service Tracing

Services calls/transactions often need to be traced, similarly to the above, the germainAPM components (js, agent, engine..) are built to support these kinds of transaction tracing. 

Example (for an AngularJS-NodeJS-MySQL application)

In this example, we have a multi-tier web application which the user interacts with through the browser. The application UI is generated by a server-side NodeJS application which makes requests to a Java backend service. The Java service interacts with a database as well as MQ services.

The ID-based correlation happens automatically by injecting germainAPM JS Script (for Real User Monitoring). This mechanism produces a unique correlation ID into each request made from that Angular UI. The germainAPM Agent (in this case for "NodeJS") receives the correlation IDs and passes it along down the line as part of requests made to the Java backend services. The Java monitoring agent records SQL queries and messages sent to MQ.

Setup

  1. Inject the Germain UX monitoring scripts into Angular JS web application (see User Experience Monitoring)

    Once the Germain UX monitoring scripts are included in a web application, they will automatically add a correlation header to each outgoing XHR request made by the web browser. 
    Then the UX monitoring will create a data point for the user activity (i.e., navigation, click, etc) as well as for any HTTP requests that were part of it.

  2. Deploy the Germain APM NodeJS agent  (see Node.js Monitoring)
    The Germain APM Java NodeJS instruments Inbound and Outbound HTTP requests, which will collect and pass along the correlation ID from UX monitoring to the next layer being monitored. The NodeJS agent supports collection of a number of useful metrics and the creation of custom transactions/events/metrics via our API.

  3. Deploy the Germain APM Java agent with each Java service (see Java/Jvm Monitoring)
    The Germain APM Java agent provides instrumentation to for a number of well-known interface points:

    1. Inbound HTTP requests (via Servlet and Filter APIs)

    2. Outbound HTTP requests (via HttpUrlConnection)

    3. SQL Queries (JDBC)

    4. MQ messaging (JMS)

  4. Beyond these default points, the agent can be configured to instrument the execution of any custom Java class / method.
    When the agent records an inbound HTTP request which includes the Germain correlation header, it attach the correlation ID to any transactions and events generated in the context of the HTTP request. For example, if the request triggers the execution of a SQL statement, the agent will record the query text as well as associated metrics as a data point that is tagged with the correlation ID.
    Similarly, if the request triggers a message to be sent via JMS broker, the agent will record this operation as a data point in Germain APM including the correlation ID. Further, it will annotate the message to include the correlation ID, so that the recipient services further downstream can also be correlated, assuming it is also monitored by one of the Germain APM agents.