@instana/core
Version:
Core library for Instana's Node.js packages
28 lines (19 loc) • 571 B
JavaScript
/*
* (c) Copyright IBM Corp. 2023
*/
;
const constants = require('../constants');
module.exports.init = () => {
const { RestifyInstrumentation } = require('@opentelemetry/instrumentation-restify');
const instrumentation = new RestifyInstrumentation();
if (!instrumentation.getConfig().enabled) {
instrumentation.enable();
}
};
module.exports.getKind = otelSpan => {
let kind = constants.EXIT;
if (otelSpan.attributes && otelSpan.attributes['restify.type'] === 'middleware') {
kind = constants.INTERMEDIATE;
}
return kind;
};