cap-js / telemetry

CDS plugin providing observability features, incl. automatic OpenTelemetry instrumentation.
https://cap.cloud.sap/docs
Apache License 2.0
8 stars 6 forks source link

telemetry is assigned to wrong correlation-id #202

Closed qby-ankul closed 1 month ago

qby-ankul commented 2 months ago

Today we found a curious problem, if 2 logs are written at the same time, the correlation id is only taken from one of them. The logs differ in the following fields:

image

@cap-js/cds-typer: 0.24.0 @cap-js/cds-types: 0.2.0 @cap-js/sqlite: 1.7.3 @cap-js/telemetry: 0.2.3 @sap/cds: 7.9.4 @sap/cds-compiler: 4.9.6 @sap/cds-dk: 7.9.6 @sap/cds-dk (global): 7.9.6 @sap/cds-fiori: 1.2.7 @sap/cds-foss: 5.0.1 @sap/cds-hana: 2.0.0 @sap/cds-mtxs: 1.18.2 @sap/eslint-plugin-cds: 3.0.4 Node.js: v20.12.0

sjvans commented 1 month ago

hi @qby-ankul

  1. @cap-js/telemetry doesn't deal with logs, only with traces and metrics.
  2. multiple logs may share a correlation id, for example when they are the result of the same incoming request, so i'm afraid i'm not sure what the issue is.

please reopen with clarification of 2.

thanks, sebastian

qby-ankul commented 1 month ago

Hi @sjvans

we can confirm that these are 2 different requests. As the load on the service increases, we are seeing an increased number of incorrect assignments in the telemetry. Do you need more information?

sjvans commented 1 month ago

hi @qby-ankul

i'd need a reproducible sample. what i see in the screenshots is the json representation of an application log containing the console export of @cap-js/telemetry. 1. @cap-js/telemetry is not concerned with application logs, and 2. the console exporter is not meant for production.

best, sebastian