Coralogix Node module which extends the existing functionality of OpenTelemetry Node SDK.
npm install --save @coralogix/opentelemetry
This sampler extends the existing Node.js OpenTelemetry instrumentation setup in order to define, report, and monitor Coralogix transactions.
import {CoralogixTransactionSampler} from "@coralogix/opentelemetry";
sampler: new CoralogixTransactionSampler(new AlwaysOnSampler()) // or your original sampler
It works with individual auto-instrumentation and manual instrumentation. The bundled auto-instrumentation method is not supported.
To use Coralogix flows with express you must use the setExpressApp
function to make sure that the CoralogixTransactionSampler
understands your routes and endpoints.
Example:
const sampler = new CoralogixTransactionSampler();
const tracerProvider = new BasicTracerProvider({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: '<your-service-name>'
}),
sampler
});
import express from "express";
import router from "./router";
const app = express();
app.use('/', router);
sampler.setExpressApp(app);
app.listen(3000, () => {
console.log('Server is running')
});