Skip to content

Commit aa594ab

Browse files
Merge pull request #252145 from hectorhdzg/hectorhdzg/nodejsupda
[Azure Monitor OpenTelemetry] Add explanation regarding manual APIs
2 parents a0fd444 + e569654 commit aa594ab

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

articles/azure-monitor/app/opentelemetry-add-modify.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,12 +1328,14 @@ Not available in .NET.
13281328
#### [Node.js](#tab/nodejs)
13291329

13301330

1331+
If you would like to add custom events or need access to the Application Insights API, you will need to replace the @azure/monitor-opentelemetry package with the `applicationinsights` v3 Beta package (https://www.npmjs.com/package/applicationinsights/v/beta). Same methods and interfaces should be available there, all sample code in documented for @azure/monitor-opentelemetry apply to v3 Beta package as well.
1332+
13311333
You need to use `applicationinsights` v3 Beta package to send custom telemetry using the Application Insights Classic API. (https://www.npmjs.com/package/applicationinsights/v/beta)
13321334

13331335
```javascript
13341336
const { TelemetryClient } = require("applicationinsights");
13351337

1336-
const appInsights = new TelemetryClient();
1338+
const telemetryClient = new TelemetryClient();
13371339
```
13381340

13391341
Then use the `TelemetryClient` to send custom telemetry:
@@ -1344,7 +1346,7 @@ Then use the `TelemetryClient` to send custom telemetry:
13441346
let eventTelemetry = {
13451347
name: "testEvent"
13461348
};
1347-
appInsights.trackEvent(eventTelemetry);
1349+
telemetryClient.trackEvent(eventTelemetry);
13481350
```
13491351

13501352
##### Logs
@@ -1354,7 +1356,7 @@ Then use the `TelemetryClient` to send custom telemetry:
13541356
message: "testMessage",
13551357
severity: "Information"
13561358
};
1357-
appInsights.trackTrace(traceTelemetry);
1359+
telemetryClient.trackTrace(traceTelemetry);
13581360
```
13591361

13601362
##### Exceptions
@@ -1367,7 +1369,7 @@ Then use the `TelemetryClient` to send custom telemetry:
13671369
exception: error,
13681370
severity: "Critical"
13691371
};
1370-
appInsights.trackException(exceptionTelemetry);
1372+
telemetryClient.trackException(exceptionTelemetry);
13711373
}
13721374
```
13731375

articles/azure-monitor/app/opentelemetry-configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Use one of the following two ways to configure the connection string:
123123
```typescript
124124
const { useAzureMonitor, AzureMonitorOpenTelemetryOptions } = require("@azure/monitor-opentelemetry");
125125
const options: AzureMonitorOpenTelemetryOptions = {
126-
azureMonitorExporterConfig: {
126+
azureMonitorExporterOptions: {
127127
connectionString: "<your connection string>"
128128
}
129129
};
@@ -601,7 +601,7 @@ For example:
601601
const { useAzureMonitor, AzureMonitorOpenTelemetryOptions } = require("@azure/monitor-opentelemetry");
602602

603603
const options: AzureMonitorOpenTelemetryOptions = {
604-
azureMonitorExporterConfig = {
604+
azureMonitorExporterOptions = {
605605
connectionString: "<Your Connection String>",
606606
storageDirectory: "C:\\SomeDirectory",
607607
disableOfflineStorage: false

0 commit comments

Comments
 (0)