@azure/opentelemetry-instrumentation-azure-sdk
Version:
Instrumentation client for the Azure SDK.
64 lines (63 loc) • 2.4 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var instrumentation_exports = {};
__export(instrumentation_exports, {
AzureSdkInstrumentation: () => AzureSdkInstrumentation,
createAzureSdkInstrumentation: () => createAzureSdkInstrumentation
});
module.exports = __toCommonJS(instrumentation_exports);
var import_instrumentation = require("@opentelemetry/instrumentation");
var import_instrumenter = require("./instrumenter.js");
var import_configuration = require("./configuration.js");
class AzureSdkInstrumentation extends import_instrumentation.InstrumentationBase {
constructor(options = {}) {
super(
"@azure/opentelemetry-instrumentation-azure-sdk",
import_configuration.SDK_VERSION,
Object.assign({}, options)
);
}
/**
* Entrypoint for the module registration.
*
* @returns The patched \@azure/core-tracing module after setting its instrumenter.
*/
init() {
const result = new import_instrumentation.InstrumentationNodeModuleDefinition(
"@azure/core-tracing",
["^1.0.0-preview.14", "^1.0.0"],
(moduleExports) => {
if (typeof moduleExports.useInstrumenter === "function") {
moduleExports.useInstrumenter(new import_instrumenter.OpenTelemetryInstrumenter());
}
return moduleExports;
}
);
result.includePrerelease = true;
return result;
}
}
function createAzureSdkInstrumentation(options = {}) {
return new AzureSdkInstrumentation(options);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AzureSdkInstrumentation,
createAzureSdkInstrumentation
});
//# sourceMappingURL=instrumentation.js.map