UNPKG

@azure/opentelemetry-instrumentation-azure-sdk

Version:
1 lines 2.88 kB
{"version":3,"file":"instrumentation-browser.mjs","sourceRoot":"","sources":["../../src/instrumentation-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EACL,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAOtD;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,mBAAmB;IAC9D,YAAY,UAA0C,EAAE;QACtD,KAAK,CACH,gDAAgD,EAChD,WAAW,EACX,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAC3B,CAAC;IACJ,CAAC;IACD,2GAA2G;IACjG,IAAI;QACZ,QAAQ;IACV,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,eAAe,CAAC,IAAI,yBAAyB,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,OAAO;QACL,QAAQ;IACV,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,6BAA6B,CAC3C,UAA0C,EAAE;IAE5C,OAAO,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n Instrumentation,\n InstrumentationConfig} from \"@opentelemetry/instrumentation\";\nimport {\n InstrumentationBase\n} from \"@opentelemetry/instrumentation\";\n\nimport { OpenTelemetryInstrumenter } from \"./instrumenter.js\";\nimport { SDK_VERSION } from \"./configuration.js\";\nimport { useInstrumenter } from \"@azure/core-tracing\";\n\n/**\n * Configuration options that can be passed to {@link createAzureSdkInstrumentation} function.\n */\nexport interface AzureSdkInstrumentationOptions extends InstrumentationConfig {}\n\n/**\n * The instrumentation module for the Azure SDK. Implements OpenTelemetry's {@link Instrumentation}.\n */\nexport class AzureSdkInstrumentation extends InstrumentationBase {\n constructor(options: AzureSdkInstrumentationOptions = {}) {\n super(\n \"@azure/opentelemetry-instrumentation-azure-sdk\",\n SDK_VERSION,\n Object.assign({}, options),\n );\n }\n /** In the browser we rely on overriding the `enable` function instead as there are no modules to patch. */\n protected init(): void {\n // no-op\n }\n\n /**\n * Entrypoint for the module registration. Ensures the global instrumenter is set to use OpenTelemetry.\n */\n enable(): void {\n useInstrumenter(new OpenTelemetryInstrumenter());\n }\n\n disable(): void {\n // no-op\n }\n}\n\n/**\n * Enables Azure SDK Instrumentation using OpenTelemetry for Azure SDK client libraries.\n *\n * When registered, any Azure data plane package will begin emitting tracing spans for internal calls\n * as well as network calls\n *\n * Example usage:\n * ```ts\n * const openTelemetryInstrumentation = require(\"@opentelemetry/instrumentation\");\n * openTelemetryInstrumentation.registerInstrumentations({\n * instrumentations: [createAzureSdkInstrumentation()],\n * })\n * ```\n */\nexport function createAzureSdkInstrumentation(\n options: AzureSdkInstrumentationOptions = {},\n): Instrumentation {\n return new AzureSdkInstrumentation(options);\n}\n"]}