Skip to content

Update Python opentelemetry how-to for functions auto attach #127385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions articles/azure-functions/opentelemetry-howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ These instructions only apply for an OTLP exporter:

::: zone-end
::: zone pivot="programming-language-python"
1. Add an application setting named PYTHON_ENABLE_OPENTELEMETRY with value of True.
1. Add an application setting named `PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY` with value of True.

1. Add this entry in your `requirements.txt` file:
1. Make sure the below library is in your `requirements.txt` file, whether from uncommenting or adding yourself:

### [Application Insights](#tab/app-insights)

Expand All @@ -238,6 +238,10 @@ These instructions only apply for an OTLP exporter:

### [Application Insights](#tab/app-insights)

If you followed the above steps by setting the `PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY`, you don't need to add any additional code and skip the below.

If you would like to enable Application Insights collection manually without automatic instrumentation, add the following code:

```python
from azure.monitor.opentelemetry import configure_azure_monitor
configure_azure_monitor()
Expand Down Expand Up @@ -275,6 +279,8 @@ These instructions only apply for an OTLP exporter:

---

1. Refer to [Azure monitor Distro usage]https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry#usage) documentation for how to configure the SDK.

::: zone-end
## Considerations for OpenTelemetry

Expand Down