Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] cleanup tracing #273

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
12 changes: 6 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const LOG = cds.log('telemetry')

const { diag } = require('@opentelemetry/api')
const { registerInstrumentations } = require('@opentelemetry/instrumentation')
const { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } = require('@opentelemetry/semantic-conventions')
// const { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } = require('@opentelemetry/semantic-conventions')

const tracing = require('./tracing')
const metrics = require('./metrics')
Expand Down Expand Up @@ -47,11 +47,11 @@ module.exports = function () {

const resource = getResource()

// REVISIT: better way to make available?
cds._telemetry = {
name: resource.attributes[ATTR_SERVICE_NAME],
version: resource.attributes[ATTR_SERVICE_VERSION]
}
// // REVISIT: better way to make available?
// cds._telemetry = {
// name: resource.attributes[ATTR_SERVICE_NAME],
// version: resource.attributes[ATTR_SERVICE_VERSION]
// }

/*
* setup tracing
Expand Down
12 changes: 6 additions & 6 deletions lib/tracing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ module.exports = resource => {
tracerProvider.addSpanProcessor(spanProcessor)
}

// REVISIT: better way to set/ pass tracer?
cds._telemetry.tracer = trace.getTracer('@cap-js/telemetry', require('../../package.json').version)
// // REVISIT: better way to set/ pass tracer?
// cds._telemetry.tracer = trace.getTracer('@cap-js/telemetry', require('../../package.json').version)

// REVISIT: only start tracing once served
cds.on('served', () => {
cds._telemetry.tracer._active = true
})
// // REVISIT: only start tracing once served
// cds.on('served', () => {
// cds._telemetry.tracer._active = true
// })

// clear sap passport for new tx
if (process.env.SAP_PASSPORT) {
Expand Down
Loading
Loading