From 8c6a412ee0f6d920e3e5a61448ee9ba4327ccdb4 Mon Sep 17 00:00:00 2001 From: Hector Hernandez <39923391+hectorhdzg@users.noreply.github.com> Date: Fri, 8 Sep 2023 14:12:23 -0700 Subject: [PATCH] [Azure Monitor OpenTelemetry Distro] Rename azureMonitorExporterConfig (#27063) Addressing API review requested changes --- .../review/monitor-opentelemetry.api.md | 2 +- .../samples-dev/customMetric.ts | 2 +- .../samples-dev/customTrace.ts | 2 +- .../monitor-opentelemetry/src/logs/handler.ts | 2 +- .../src/metrics/handler.ts | 2 +- .../src/metrics/standardMetrics.ts | 2 +- .../src/shared/config.ts | 16 +++++++-------- .../src/shared/jsonConfig.ts | 4 ++-- .../monitor-opentelemetry/src/shared/types.ts | 2 +- .../src/traces/handler.ts | 2 +- .../internal/unit/logs/logHandler.test.ts | 4 ++-- .../test/internal/unit/main.test.ts | 10 +++++----- .../unit/metrics/metricHandler.test.ts | 4 ++-- .../unit/metrics/standadMetrics.test.ts | 2 +- .../test/internal/unit/shared/config.json | 2 +- .../test/internal/unit/shared/config.test.ts | 20 +++++++++---------- .../internal/unit/shared/jsonConfig.test.ts | 12 +++++------ ...ureFnHook..test.ts => azureFnHook.test.ts} | 8 ++++---- .../internal/unit/traces/traceHandler.test.ts | 4 ++-- 19 files changed, 51 insertions(+), 51 deletions(-) rename sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/{azureFnHook..test.ts => azureFnHook.test.ts} (95%) diff --git a/sdk/monitor/monitor-opentelemetry/review/monitor-opentelemetry.api.md b/sdk/monitor/monitor-opentelemetry/review/monitor-opentelemetry.api.md index d7170fa838dd..3b322ea86856 100644 --- a/sdk/monitor/monitor-opentelemetry/review/monitor-opentelemetry.api.md +++ b/sdk/monitor/monitor-opentelemetry/review/monitor-opentelemetry.api.md @@ -10,7 +10,7 @@ import { Resource } from '@opentelemetry/resources'; // @public export interface AzureMonitorOpenTelemetryOptions { - azureMonitorExporterConfig?: AzureMonitorExporterOptions; + azureMonitorExporterOptions?: AzureMonitorExporterOptions; instrumentationOptions?: InstrumentationOptions; resource?: Resource; samplingRatio?: number; diff --git a/sdk/monitor/monitor-opentelemetry/samples-dev/customMetric.ts b/sdk/monitor/monitor-opentelemetry/samples-dev/customMetric.ts index 1af0b10db3c8..773ceb9c869a 100644 --- a/sdk/monitor/monitor-opentelemetry/samples-dev/customMetric.ts +++ b/sdk/monitor/monitor-opentelemetry/samples-dev/customMetric.ts @@ -17,7 +17,7 @@ import * as dotenv from "dotenv"; dotenv.config(); const options: AzureMonitorOpenTelemetryOptions = { - azureMonitorExporterConfig: { + azureMonitorExporterOptions: { connectionString: process.env["APPLICATIONINSIGHTS_CONNECTION_STRING"] || "", }, diff --git a/sdk/monitor/monitor-opentelemetry/samples-dev/customTrace.ts b/sdk/monitor/monitor-opentelemetry/samples-dev/customTrace.ts index 1dfc3a75f241..44bac350078c 100644 --- a/sdk/monitor/monitor-opentelemetry/samples-dev/customTrace.ts +++ b/sdk/monitor/monitor-opentelemetry/samples-dev/customTrace.ts @@ -17,7 +17,7 @@ import * as dotenv from "dotenv"; dotenv.config(); const options: AzureMonitorOpenTelemetryOptions = { - azureMonitorExporterConfig: { + azureMonitorExporterOptions: { connectionString: process.env["APPLICATIONINSIGHTS_CONNECTION_STRING"] || "", }, diff --git a/sdk/monitor/monitor-opentelemetry/src/logs/handler.ts b/sdk/monitor/monitor-opentelemetry/src/logs/handler.ts index 3094053a6489..f717fbddd704 100644 --- a/sdk/monitor/monitor-opentelemetry/src/logs/handler.ts +++ b/sdk/monitor/monitor-opentelemetry/src/logs/handler.ts @@ -32,7 +32,7 @@ export class LogHandler { resource: this._config.resource, }; this._loggerProvider = new LoggerProvider(loggerProviderConfig); - this._azureExporter = new AzureMonitorLogExporter(this._config.azureMonitorExporterConfig); + this._azureExporter = new AzureMonitorLogExporter(this._config.azureMonitorExporterOptions); // Log Processor could be configured through env variables // https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#batch-logrecord-processor this._logRecordProcessor = new BatchLogRecordProcessor(this._azureExporter); diff --git a/sdk/monitor/monitor-opentelemetry/src/metrics/handler.ts b/sdk/monitor/monitor-opentelemetry/src/metrics/handler.ts index 220bec01d21f..380c87cef7a5 100644 --- a/sdk/monitor/monitor-opentelemetry/src/metrics/handler.ts +++ b/sdk/monitor/monitor-opentelemetry/src/metrics/handler.ts @@ -40,7 +40,7 @@ export class MetricHandler { resource: this._config.resource, }; this._meterProvider = new MeterProvider(meterProviderConfig); - this._azureExporter = new AzureMonitorMetricExporter(this._config.azureMonitorExporterConfig); + this._azureExporter = new AzureMonitorMetricExporter(this._config.azureMonitorExporterOptions); let metricReaderOptions: PeriodicExportingMetricReaderOptions = { exporter: this._azureExporter as any, exportIntervalMillis: options?.collectionInterval || this._collectionInterval, diff --git a/sdk/monitor/monitor-opentelemetry/src/metrics/standardMetrics.ts b/sdk/monitor/monitor-opentelemetry/src/metrics/standardMetrics.ts index 0315005ba057..6f7d986a4316 100644 --- a/sdk/monitor/monitor-opentelemetry/src/metrics/standardMetrics.ts +++ b/sdk/monitor/monitor-opentelemetry/src/metrics/standardMetrics.ts @@ -50,7 +50,7 @@ export class StandardMetrics { resource: this._config.resource, }; this._meterProvider = new MeterProvider(meterProviderConfig); - this._azureExporter = new AzureMonitorMetricExporter(this._config.azureMonitorExporterConfig); + this._azureExporter = new AzureMonitorMetricExporter(this._config.azureMonitorExporterOptions); const metricReaderOptions: PeriodicExportingMetricReaderOptions = { exporter: this._azureExporter as any, exportIntervalMillis: options?.collectionInterval || this._collectionInterval, diff --git a/sdk/monitor/monitor-opentelemetry/src/shared/config.ts b/sdk/monitor/monitor-opentelemetry/src/shared/config.ts index b2527b065166..3d83cb6fe36a 100644 --- a/sdk/monitor/monitor-opentelemetry/src/shared/config.ts +++ b/sdk/monitor/monitor-opentelemetry/src/shared/config.ts @@ -19,7 +19,7 @@ export class InternalConfig implements AzureMonitorOpenTelemetryOptions { /** The rate of telemetry items tracked that should be transmitted (Default 1.0) */ public samplingRatio: number; /** Azure Monitor Exporter Configuration */ - public azureMonitorExporterConfig: AzureMonitorExporterOptions; + public azureMonitorExporterOptions: AzureMonitorExporterOptions; /** * OpenTelemetry Instrumentations configuration included as part of Azure Monitor (azureSdk, http, mongoDb, mySql, postgreSql, redis, redis4) */ @@ -43,7 +43,7 @@ export class InternalConfig implements AzureMonitorOpenTelemetryOptions { */ constructor(options?: AzureMonitorOpenTelemetryOptions) { // Default values - this.azureMonitorExporterConfig = {}; + this.azureMonitorExporterOptions = {}; this.samplingRatio = 1; this.instrumentationOptions = { http: { enabled: true }, @@ -61,9 +61,9 @@ export class InternalConfig implements AzureMonitorOpenTelemetryOptions { // This will take precedence over other settings if (options) { // Merge default with provided options - this.azureMonitorExporterConfig = Object.assign( - this.azureMonitorExporterConfig, - options.azureMonitorExporterConfig + this.azureMonitorExporterOptions = Object.assign( + this.azureMonitorExporterOptions, + options.azureMonitorExporterOptions ); this.instrumentationOptions = Object.assign( this.instrumentationOptions, @@ -80,9 +80,9 @@ export class InternalConfig implements AzureMonitorOpenTelemetryOptions { this.samplingRatio = jsonConfig.samplingRatio !== undefined ? jsonConfig.samplingRatio : this.samplingRatio; - this.azureMonitorExporterConfig = Object.assign( - this.azureMonitorExporterConfig, - jsonConfig.azureMonitorExporterConfig + this.azureMonitorExporterOptions = Object.assign( + this.azureMonitorExporterOptions, + jsonConfig.azureMonitorExporterOptions ); this.instrumentationOptions = Object.assign( this.instrumentationOptions, diff --git a/sdk/monitor/monitor-opentelemetry/src/shared/jsonConfig.ts b/sdk/monitor/monitor-opentelemetry/src/shared/jsonConfig.ts index a13f17f95e12..09fecbb65ca8 100644 --- a/sdk/monitor/monitor-opentelemetry/src/shared/jsonConfig.ts +++ b/sdk/monitor/monitor-opentelemetry/src/shared/jsonConfig.ts @@ -18,7 +18,7 @@ export class JsonConfig implements AzureMonitorOpenTelemetryOptions { /** The rate of telemetry items tracked that should be transmitted (Default 1.0) */ public samplingRatio?: number; /** Azure Monitor Exporter Configuration */ - public azureMonitorExporterConfig?: AzureMonitorExporterOptions; + public azureMonitorExporterOptions?: AzureMonitorExporterOptions; /** * OpenTelemetry Instrumentations configuration included as part of Azure Monitor (azureSdk, http, mongoDb, mySql, postgreSql, redis, redis4) */ @@ -69,7 +69,7 @@ export class JsonConfig implements AzureMonitorOpenTelemetryOptions { } try { const jsonConfig: AzureMonitorOpenTelemetryOptions = JSON.parse(jsonString); - this.azureMonitorExporterConfig = jsonConfig.azureMonitorExporterConfig; + this.azureMonitorExporterOptions = jsonConfig.azureMonitorExporterOptions; this.samplingRatio = jsonConfig.samplingRatio; this.instrumentationOptions = jsonConfig.instrumentationOptions; } catch (err) { diff --git a/sdk/monitor/monitor-opentelemetry/src/shared/types.ts b/sdk/monitor/monitor-opentelemetry/src/shared/types.ts index 62d2b3cbcb11..ebb94e94d796 100644 --- a/sdk/monitor/monitor-opentelemetry/src/shared/types.ts +++ b/sdk/monitor/monitor-opentelemetry/src/shared/types.ts @@ -14,7 +14,7 @@ process.env["AZURE_MONITOR_DISTRO_VERSION"] = AZURE_MONITOR_OPENTELEMETRY_VERSIO */ export interface AzureMonitorOpenTelemetryOptions { /** Azure Monitor Exporter Configuration */ - azureMonitorExporterConfig?: AzureMonitorExporterOptions; + azureMonitorExporterOptions?: AzureMonitorExporterOptions; /** OpenTelemetry Resource */ resource?: Resource; /** The rate of telemetry items tracked that should be transmitted (Default 1.0) */ diff --git a/sdk/monitor/monitor-opentelemetry/src/traces/handler.ts b/sdk/monitor/monitor-opentelemetry/src/traces/handler.ts index 83b518667e03..ae01189adc02 100644 --- a/sdk/monitor/monitor-opentelemetry/src/traces/handler.ts +++ b/sdk/monitor/monitor-opentelemetry/src/traces/handler.ts @@ -56,7 +56,7 @@ export class TraceHandler { forceFlushTimeoutMillis: 30000, }; this._tracerProvider = new NodeTracerProvider(tracerConfig); - this._azureExporter = new AzureMonitorTraceExporter(this._config.azureMonitorExporterConfig); + this._azureExporter = new AzureMonitorTraceExporter(this._config.azureMonitorExporterOptions); const bufferConfig: BufferConfig = { maxExportBatchSize: 512, scheduledDelayMillis: 5000, diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/logs/logHandler.test.ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/logs/logHandler.test.ts index d3299f2262e6..2d2026c0af90 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/logs/logHandler.test.ts +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/logs/logHandler.test.ts @@ -17,8 +17,8 @@ describe("LogHandler", () => { let exportStub: sinon.SinonStub; let metricHandler: MetricHandler; const _config = new InternalConfig(); - if (_config.azureMonitorExporterConfig) { - _config.azureMonitorExporterConfig.connectionString = + if (_config.azureMonitorExporterOptions) { + _config.azureMonitorExporterOptions.connectionString = "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"; } diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/main.test.ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/main.test.ts index bbf68358d10d..0fc76fbb0ff9 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/main.test.ts +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/main.test.ts @@ -2,14 +2,14 @@ // Licensed under the MIT license. import * as assert from "assert"; -import { useAzureMonitor } from "../../../src/index"; -import { InternalConfig } from "../../../src/shared/config"; +import { useAzureMonitor, AzureMonitorOpenTelemetryOptions } from "../../../src/index"; describe("Main functions", () => { it("useAzureMonitor", () => { - let config = new InternalConfig(); - config.azureMonitorExporterConfig = { - connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000", + let config: AzureMonitorOpenTelemetryOptions = { + azureMonitorExporterOptions: { + connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000", + }, }; useAzureMonitor(config); assert.ok(true); diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/metricHandler.test.ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/metricHandler.test.ts index 810851679af5..50473378e412 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/metricHandler.test.ts +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/metricHandler.test.ts @@ -14,8 +14,8 @@ describe("MetricHandler", () => { let handler: MetricHandler; let exportStub: sinon.SinonStub; const _config = new InternalConfig(); - if (_config.azureMonitorExporterConfig) { - _config.azureMonitorExporterConfig.connectionString = + if (_config.azureMonitorExporterOptions) { + _config.azureMonitorExporterOptions.connectionString = "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"; } diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/standadMetrics.test.ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/standadMetrics.test.ts index 0afc16bac447..6135149f27dd 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/standadMetrics.test.ts +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/metrics/standadMetrics.test.ts @@ -21,7 +21,7 @@ describe("#StandardMetricsHandler", () => { before(() => { const config = new InternalConfig(); - config.azureMonitorExporterConfig.connectionString = + config.azureMonitorExporterOptions.connectionString = "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;"; autoCollect = new StandardMetrics(config, { collectionInterval: 100 }); exportStub = sinon.stub(autoCollect["_azureExporter"], "export").callsFake( diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/config.json b/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/config.json index 88f0499d01e2..346da0bd2e39 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/config.json +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/config.json @@ -1,5 +1,5 @@ { - "azureMonitorExporterConfig": { + "azureMonitorExporterOptions": { "connectionString": "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/", "disableOfflineStorage": true, "storageDirectory": "testPath" diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/config.test.ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/config.test.ts index 67a7129c6f9a..59f1a5c6f143 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/config.test.ts +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/config.test.ts @@ -39,17 +39,17 @@ describe("Library/Config", () => { process.env = env; const config = new InternalConfig(); assert.deepStrictEqual( - config.azureMonitorExporterConfig.connectionString, + config.azureMonitorExporterOptions.connectionString, "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/" ); assert.deepStrictEqual(config.samplingRatio, 0.3, "Wrong samplingRatio"); assert.deepStrictEqual( - config.azureMonitorExporterConfig?.disableOfflineStorage, + config.azureMonitorExporterOptions?.disableOfflineStorage, true, "Wrong disableOfflineStorage" ); assert.deepStrictEqual( - config.azureMonitorExporterConfig?.storageDirectory, + config.azureMonitorExporterOptions?.storageDirectory, "testPath", "Wrong storageDirectory" ); @@ -91,12 +91,12 @@ describe("Library/Config", () => { assert.deepStrictEqual(config.instrumentationOptions.redis?.enabled, false, "Wrong redis"); assert.deepStrictEqual(config.instrumentationOptions.redis4?.enabled, false, "Wrong redis4"); assert.deepStrictEqual( - config.azureMonitorExporterConfig?.disableOfflineStorage, + config.azureMonitorExporterOptions?.disableOfflineStorage, undefined, "Wrong disableOfflineStorage" ); assert.deepStrictEqual( - config.azureMonitorExporterConfig?.storageDirectory, + config.azureMonitorExporterOptions?.storageDirectory, undefined, "Wrong storageDirectory" ); @@ -111,16 +111,16 @@ describe("Library/Config", () => { it("should initialize valid values", () => { const config = new InternalConfig(); - config.azureMonitorExporterConfig.connectionString = + config.azureMonitorExporterOptions.connectionString = "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"; - assert.ok(typeof config.azureMonitorExporterConfig?.connectionString === "string"); + assert.ok(typeof config.azureMonitorExporterOptions?.connectionString === "string"); assert.ok(typeof config.samplingRatio === "number"); }); it("instrumentation key validation-valid key passed", () => { const warnStub = sandbox.stub(console, "warn"); const config = new InternalConfig(); - config.azureMonitorExporterConfig.connectionString = + config.azureMonitorExporterOptions.connectionString = "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"; assert.ok(warnStub.notCalled, "warning was not raised"); }); @@ -128,7 +128,7 @@ describe("Library/Config", () => { it("instrumentation key validation-invalid key passed", () => { const warnStub = sandbox.stub(console, "warn"); const config = new InternalConfig(); - config.azureMonitorExporterConfig.connectionString = + config.azureMonitorExporterOptions.connectionString = "InstrumentationKey=1aa11111bbbb1ccc8dddeeeeffff3333"; assert.ok(warnStub.calledOn, "warning was raised"); }); @@ -136,7 +136,7 @@ describe("Library/Config", () => { it("instrumentation key validation-invalid key passed", () => { const warnStub = sandbox.stub(console, "warn"); const config = new InternalConfig(); - config.azureMonitorExporterConfig.connectionString = "abc"; + config.azureMonitorExporterOptions.connectionString = "abc"; assert.ok(warnStub.calledOn, "warning was raised"); }); }); diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/jsonConfig.test.ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/jsonConfig.test.ts index b06877ef9312..db343f208869 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/jsonConfig.test.ts +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/shared/jsonConfig.test.ts @@ -46,7 +46,7 @@ describe("Json Config", () => { process.env = env; const config = JsonConfig.getInstance(); assert.deepStrictEqual( - config.azureMonitorExporterConfig?.connectionString, + config.azureMonitorExporterOptions?.connectionString, "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/" ); }); @@ -58,7 +58,7 @@ describe("Json Config", () => { process.env = env; const config = JsonConfig.getInstance(); assert.deepStrictEqual( - config.azureMonitorExporterConfig?.connectionString, + config.azureMonitorExporterOptions?.connectionString, "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/" ); }); @@ -75,11 +75,11 @@ describe("Json Config", () => { process.env = env; const config = JsonConfig.getInstance(); assert.deepStrictEqual( - config.azureMonitorExporterConfig?.connectionString, + config.azureMonitorExporterOptions?.connectionString, "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/" ); - assert.deepStrictEqual(config.azureMonitorExporterConfig?.disableOfflineStorage, true); - assert.deepStrictEqual(config.azureMonitorExporterConfig?.storageDirectory, "testPath"); + assert.deepStrictEqual(config.azureMonitorExporterOptions?.disableOfflineStorage, true); + assert.deepStrictEqual(config.azureMonitorExporterOptions?.storageDirectory, "testPath"); assert.deepStrictEqual(config.samplingRatio, 0.3, "Wrong samplingRatio"); assert.deepStrictEqual( config.instrumentationOptions?.azureSdk?.enabled, @@ -112,7 +112,7 @@ describe("Json Config", () => { process.env = env; const config = JsonConfig.getInstance(); assert.deepStrictEqual( - config.azureMonitorExporterConfig?.connectionString, + config.azureMonitorExporterOptions?.connectionString, "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;IngestionEndpoint=https://centralus-0.in.applicationinsights.azure.com/" ); }); diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/azureFnHook..test.ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/azureFnHook.test.ts similarity index 95% rename from sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/azureFnHook..test.ts rename to sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/azureFnHook.test.ts index ab43aa7f5a95..338ab02bbec8 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/azureFnHook..test.ts +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/azureFnHook.test.ts @@ -85,7 +85,7 @@ describe("Library/AzureFunctionsHook", () => { let Module = require("module"); let preInvocationCalled = false; let config = new InternalConfig({}); - config.azureMonitorExporterConfig.connectionString = + config.azureMonitorExporterOptions.connectionString = "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333;"; metricHandler = new MetricHandler(config); handler = new TraceHandler(config, metricHandler); @@ -105,7 +105,7 @@ describe("Library/AzureFunctionsHook", () => { attributes: {}, }, }; - let preInvocationContext: any = { + let testInvocationContext: any = { inputs: [], functionCallback: () => { let span = trace.getTracer("testTracer").startSpan("test"); @@ -121,9 +121,9 @@ describe("Library/AzureFunctionsHook", () => { invocationContext: ctx, }; // Azure Functions should call preinvocation callback - callback(preInvocationContext); + callback(testInvocationContext); // Azure Functions should call customer function callback - preInvocationContext.functionCallback(null, null); + testInvocationContext.functionCallback(null, null); } }, diff --git a/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/traceHandler.test.ts b/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/traceHandler.test.ts index 184d3dec9df6..f8b6c424b1a9 100644 --- a/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/traceHandler.test.ts +++ b/sdk/monitor/monitor-opentelemetry/test/internal/unit/traces/traceHandler.test.ts @@ -22,8 +22,8 @@ describe("Library/TraceHandler", () => { before(() => { _config = new InternalConfig(); - if (_config.azureMonitorExporterConfig) { - _config.azureMonitorExporterConfig.connectionString = + if (_config.azureMonitorExporterOptions) { + _config.azureMonitorExporterOptions.connectionString = "InstrumentationKey=1aa11111-bbbb-1ccc-8ddd-eeeeffff3333"; } sandbox = sinon.createSandbox();