Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
331 stars 100 forks source link

feat: Support OpenTelemetry Azure monitor distro #1509

Open lzchen opened 2 weeks ago

lzchen commented 2 weeks ago

Description

We are planning to support auto instrumentation of Azure monitor distro for azure functions. This allows automatic collection of telemetry using OpenTelemetry apis/sdks in users applications in azure functions. The current design is an opt-in model which is controlled by an Appsetting PYTHON_ENABLE_OPENTELEMETRY. The worker takes an indirect dependency on the distro package and attempts to load/instrument with it via configure_azure_monitor() api provided. The idea is to have this package already preinstalled into the functions image. Until the images are pushed out with this package, you may test this change by manually installing the distro onto your dev environment.

Additionally, any exceptions thrown by the distro are caught and logged accordingly. A telemetry sdk should never cause a user's application to crash.

@gavin-aguiar @vrdmr

lzchen commented 2 weeks ago

@gavin-aguiar

Since this is a telemetry sdk meant only to be loaded once, I have placed this in worker_init_request. Is there anything special that happens during environment_reload_request that needs to be done pertaining this in your opinion?

gavin-aguiar commented 4 days ago

/azp run

azure-pipelines[bot] commented 4 days ago
Azure Pipelines successfully started running 1 pipeline(s).