Skip to content

Commit 9980c03

Browse files
authored
Merge pull request #254695 from hectorhdzg/hectorhdzg/feedback
Update Node.js OTel docs
2 parents 94caf6c + 0c1bb2e commit 9980c03

File tree

6 files changed

+39
-628
lines changed

6 files changed

+39
-628
lines changed

.openpublishing.redirection.azure-monitor.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6349,6 +6349,11 @@
63496349
"redirect_url": "/azure/azure-monitor/app/release-and-work-item-insights?tabs=release-annotations",
63506350
"redirect_document_id": false
63516351
},
6352+
{
6353+
"source_path_from_root": "/articles/azure-monitor/app/opentelemetry-nodejs-exporter.md",
6354+
"redirect_url": "/azure/azure-monitor/app/opentelemetry-enable?tabs=nodejs",
6355+
"redirect_document_id": false
6356+
},
63526357
{
63536358
"source_path_from_root": "/articles/azure-monitor/app/work-item-integration.md",
63546359
"redirect_url": "/azure/azure-monitor/app/release-and-work-item-insights?tabs=work-item-integration",

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

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,40 @@ Dependencies
152152
- [Redis-4](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-redis-4)
153153
- [Azure SDK](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk)
154154

155-
Automatic instrumentation of Logs is currently only supported when using `applicationinsights` v3 Beta package. (https://www.npmjs.com/package/applicationinsights/v/beta)
155+
Instrumentations can be configured using AzureMonitorOpenTelemetryOptions
156156

157-
Logs
158-
- [Node.js console](https://nodejs.org/api/console.html)
159-
- [Bunyan](https://github.com/trentm/node-bunyan#readme)
160-
- [Winston](https://github.com/winstonjs/winston#readme)
157+
```typescript
158+
// Import Azure Monitor OpenTelemetry
159+
const { useAzureMonitor, AzureMonitorOpenTelemetryOptions } = require("@azure/monitor-opentelemetry");
160+
// Import OpenTelemetry HTTP Instrumentation to get config type
161+
const { HttpInstrumentationConfig } = require("@azure/monitor-opentelemetry");
162+
// Import HTTP to get type
163+
const { IncomingMessage } = require("http");
164+
165+
// Specific Instrumentation configs could be added
166+
const httpInstrumentationConfig: HttpInstrumentationConfig = {
167+
ignoreIncomingRequestHook: (request: IncomingMessage) => {
168+
return false; //Return true if you want to ignore a specific request
169+
},
170+
enabled: true
171+
};
172+
// Instrumentations configuration
173+
const options: AzureMonitorOpenTelemetryOptions = {
174+
instrumentationOptions: {
175+
http: httpInstrumentationConfig,
176+
azureSdk: { enabled: true },
177+
mongoDb: { enabled: true },
178+
mySql: { enabled: true },
179+
postgreSql: { enabled: true },
180+
redis: { enabled: true },
181+
redis4: { enabled: true },
182+
}
183+
};
184+
185+
// Enable Azure Monitor integration
186+
useAzureMonitor(options);
187+
188+
```
161189

162190

163191
#### [Python](#tab/python)
@@ -332,8 +360,6 @@ The following table represents the currently supported custom telemetry types:
332360
| | | | | | | | |
333361
| **Node.js** | | | | | | | |
334362
|    OpenTelemetry API | | Yes | Yes | Yes | | Yes | |
335-
|    Console, Winston, Bunyan| | | | | | | Yes |
336-
|    AI Classic API | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
337363
| | | | | | | | |
338364
| **Python** | | | | | | | |
339365
|    OpenTelemetry API | | Yes | Yes | Yes | | Yes | |

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ ms.reviewer: mmcc
1212

1313
This article covers configuration settings for the Azure Monitor OpenTelemetry distro.
1414

15-
> [!TIP]
16-
> For Node.js, this config guidance applies to the 3.X BETA Package only. If you're using a previous version, see the [Node.js Application Insights SDK Docs](nodejs.md).
1715

1816
## Connection string
1917

0 commit comments

Comments
 (0)