OpenTelemetry Instrumentation for Azure Functions (TypeScript/ESM)
Blog post from New Relic
This guide provides a detailed walkthrough for setting up OpenTelemetry with Azure Functions, specifically for TypeScript projects using ECMAScript Modules (ESM), utilizing the latest OpenTelemetry JS SDK 2.x. It addresses the lack of available guidance for these newer SDK configurations and ESM compilation, especially in the context of Azure's preview OpenTelemetry support. The guide emphasizes understanding the architecture, particularly distinguishing between the Azure Functions Host and the Worker process where the OpenTelemetry SDK operates. It outlines necessary steps such as updating the host.json file, installing relevant npm dependencies, and configuring tracing in a dedicated file to ensure proper instrumentation. The guide also discusses disabling certain Worker OpenTelemetry capabilities and console logging to avoid conflicts and ensure telemetry data is correctly routed to endpoints like New Relic. Additionally, the text highlights the importance of configuring sampling settings and provides insights into logging configurations to optimize telemetry data flow.