Background

Including a correlation ID in all TruCare Cloud Applications’ logging will make it trivial to search for all log messages related to any request. This would expedite troubleshooting by making log messages discoverable across application boundaries; immediately revealing which application is reporting issues or failures. This will promote 10x application synergies and produce good vibes.

Life without correlation IDs

Monolithic

important thing is that the correlation id, well correlates log messages together. if the log stack is good, and you can search by a guid, maybe you don’t want to prefix it. but if your log stack is still a bit primitivie or segment, you might want to add a prefix descriptor

Acceptance Criteria

  • All incoming HTTP(s) requests should look for an upstream correlation ID in the header as “X-Correlation-ID”. If it exists, it should be used as the correlation ID for all downstream actions/requests.
  • If no correlation ID is passed into the application, one should be generated. It should be in one of two formats:
    • {appname}-{guid}
    • {appname}-{action}-{guid} where “appname” is the name of the application where “action” is an optional string, indicating the action that was being performed when the correlation ID was generated
  • All outgoing HTTP(s) request should include the correlation ID in the request header, as “X-Correlation-ID”.
  • All outgoing HTTP(s) responses should include the correlation ID in the request header, as “X-Correlation-ID”.
  • All log messages created as a result of a call from an external application should:
    • be of a “JSON map structure”, so that it can easily be searched for in ELK
    • include the correlation id under “correlation_id” field
    • include the application name under “appname” field

Hints

It is critical that all generated GUIDs inside the correlation IDs are unique. Each time a correlation ID is generated for a request the GUID should be unique; no two user-requests should share the same GUID. Failure to do so will diminish the value that correlation ID support provides.