Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 77 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion sdk/monitor/monitor-opentelemetry/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Release History

## 1.17.0 ()
## 1.17.0 (Unreleaseed)

### Features Added

- Added support for the AKS resource detector from `@opentelemetry/resource-detector-azure`.
- Added `AKS_RESOURCE_DETECTOR_POPULATION` statsbeat feature signal to track when the AKS resource detector successfully populates resource attributes.
- Replaced custom `AzureFunctionsHook` with `@azure/functions-opentelemetry-instrumentation` for Azure Functions context propagation. The new package is maintained by the Azure Functions team and provides additional capabilities including log forwarding and `WorkerOpenTelemetryEnabled` host capability. Added `azureFunctions` to `instrumentationOptions`, allowing the Azure Functions instrumentation to be configured (enabled/disabled) like all other instrumentations. It is enabled by default.

### Bugs Fixed

Expand Down
5 changes: 4 additions & 1 deletion sdk/monitor/monitor-opentelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const options: AzureMonitorOpenTelemetryOptions = {
instrumentationOptions: {
// Instrumentations generating traces
azureSdk: { enabled: true },
azureFunctions: { enabled: true },
http: { enabled: true },
mongoDb: { enabled: true },
mySql: { enabled: true },
Expand Down Expand Up @@ -155,6 +156,7 @@ useAzureMonitor(options);
{
http: { enabled: true },
azureSdk: { enabled: true },
azureFunctions: { enabled: true },
mongoDb: { enabled: true },
mySql: { enabled: true },
postgreSql: { enabled: true },
Expand Down Expand Up @@ -248,7 +250,7 @@ process.env["APPLICATIONINSIGHTS_CONFIGURATION_FILE"] = "path/to/customConfig.js

The following OpenTelemetry Instrumentation libraries are included as part of Azure Monitor OpenTelemetry.

**Note:** The Azure SDK, MongoDB, MySQL, PostgreSQL, Redis, and Redis-4 instrumentations are enabled by default for distributed tracing. The HTTP/HTTPS instrumentation is also enabled by default. All other instrumentations are disabled by default and can be enabled by setting `enabled: true` in the instrumentation options.
**Note:** The Azure SDK, Azure Functions, MongoDB, MySQL, PostgreSQL, Redis, and Redis-4 instrumentations are enabled by default for distributed tracing. The HTTP/HTTPS instrumentation is also enabled by default. All other instrumentations are disabled by default and can be enabled by setting `enabled: true` in the instrumentation options.

> _Warning:_ Instrumentation libraries are based on experimental OpenTelemetry specifications. Microsoft's _preview_ support commitment is to ensure that the following libraries emit data to Azure Monitor Application Insights, but it's possible that breaking changes or experimental mapping will block some data elements.

Expand All @@ -261,6 +263,7 @@ The following OpenTelemetry Instrumentation libraries are included as part of Az
- [Redis](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-redis)
- [Redis-4](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-redis-4)
- [Azure SDK](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/instrumentation/opentelemetry-instrumentation-azure-sdk)
- [Azure Functions](https://github.com/Azure/azure-functions-nodejs-opentelemetry)

### Metrics

Expand Down
3 changes: 2 additions & 1 deletion sdk/monitor/monitor-opentelemetry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@azure/monitor-opentelemetry",
"author": "Microsoft Corporation",
"sdk-type": "client",
"version": "1.16.0",
"version": "1.17.0",
"description": "Azure Monitor OpenTelemetry (Node.js)",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
Expand Down Expand Up @@ -73,6 +73,7 @@
"@azure/core-auth": "^1.10.1",
"@azure/core-rest-pipeline": "^1.22.2",
"@azure/logger": "^1.3.0",
"@azure/functions-opentelemetry-instrumentation": "^0.3.0",
"@azure/monitor-opentelemetry-exporter": "1.0.0-beta.39",
"@azure/opentelemetry-instrumentation-azure-sdk": "^1.0.0-beta.9",
"@microsoft/applicationinsights-web-snippet": "^1.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function _getSdkInstance(): NodeSDK | undefined;

// @public
export interface InstrumentationOptions {
azureFunctions?: InstrumentationConfig;
azureSdk?: InstrumentationConfig;
bunyan?: InstrumentationConfig;
http?: InstrumentationConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class QuickpulseSender {
private endpointUrl: string;
private credential: TokenCredential;
private credentialScopes: string[];
// @ts-expect-error - accessed by tests via bracket notation
// @ts-expect-error - assigned in constructor, accessed by tests via bracket notation
private quickpulseClientOptions: {
credential?: TokenCredential;
credentialScopes?: string[];
Expand Down
1 change: 1 addition & 0 deletions sdk/monitor/monitor-opentelemetry/src/shared/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class InternalConfig implements AzureMonitorOpenTelemetryOptions {
this.instrumentationOptions = {
http: { enabled: true },
azureSdk: { enabled: true },
azureFunctions: { enabled: true },
mongoDb: { enabled: true },
mySql: { enabled: true },
postgreSql: { enabled: true },
Expand Down
13 changes: 0 additions & 13 deletions sdk/monitor/monitor-opentelemetry/src/shared/module-cjs.cts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,6 @@
// As per https://github.com/isaacs/tshy?tab=readme-ov-file#commonjs-dialect-polyfills
// Encapsulating the ESM / CommonJS specific implementation as needed.

/**
* A CommonJS module loader for Azure Function Core.
*/
export function loadAzureFunctionCore(): ReturnType<typeof require> {
try {
// eslint-disable-next-line @typescript-eslint/no-require-imports
return require("@azure/functions-core");
} catch (e) {
// Module not found, this is expected in non-Azure Functions environments
return undefined;
}
}

/**
* A polyfill for __dirname in CommonJS
* @returns The directory name of the current module.
Expand Down
16 changes: 0 additions & 16 deletions sdk/monitor/monitor-opentelemetry/src/shared/module.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,13 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { createRequire } from "node:module";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";

// Provides ESM-specific implementation for various functions
// As per https://github.com/isaacs/tshy?tab=readme-ov-file#commonjs-dialect-polyfills
// Encapsulating the ESM / CommonJS specific implementation as needed.

/**
* An ESM module loader for Azure Function Core.
* @returns The Azure Functions Core module if it exists, otherwise undefined
*/
export function loadAzureFunctionCore(): ReturnType<typeof require> {
try {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore ESM only output
return createRequire(import.meta.url)("@azure/functions-core");
} catch (e) {
// Module not found, this is expected in non-Azure Functions environments
return undefined;
}
}

/**
* A polyfill for __dirname in ESM.
*
Expand Down
Loading