Conversation
schiwekM
commented
Sep 29, 2023
- Adds OTEL library
- Test cases definitely not final (+ how to test that metrics + traces actually end up in Dynatrace / other collectors
| @@ -0,0 +1,67 @@ | |||
| { | |||
There was a problem hiding this comment.
rework based on audit-logging
| @@ -0,0 +1,204 @@ | |||
| const cds = require('@sap/cds') | |||
| const LOG = cds.log('trace') | |||
There was a problem hiding this comment.
do we really need to use multiple module names? if no, it should be otel. if yes, something like otel - xxx...
| @@ -0,0 +1,18 @@ | |||
| const cds = require('@sap/cds') | |||
| const LOG = cds.log('trace') | |||
| @@ -0,0 +1,359 @@ | |||
| const cds = require('@sap/cds'), | |||
| xsenv = require('@sap/xsenv') | |||
| const LOG = cds.log('otel') | |||
| if (!cds.env.trace) cds.env.trace = {} //Ensures that later code does not break | ||
| if (!cds.env.metrics) cds.env.metrics = {} //Ensures that later code does not break |
There was a problem hiding this comment.
there should be a common root. also, defaults should be provided in package.json, which makes these ensures unnecessary
There was a problem hiding this comment.
I would disagree as cds.env.logs also exists and this way it is more consistent
| tracerProvider: provider, | ||
| instrumentations: instrumentations | ||
| }) | ||
| if (!cds.env.tracer) cds.env.tracer = trace.getTracer(cds.env.trace.name, cds.env.trace.version) |
There was a problem hiding this comment.
what is cds.env.tracer? cds.env is for config
There was a problem hiding this comment.
cds.env.tracer is the tracer class from Otel used in trace.js for actual tracing as the reference has to be handed over. Moved it to cds.env.trace.tracer
Co-authored-by: sjvans <30337871+sjvans@users.noreply.github.com>
|
Closed in favour for the other PR |