Skip to content

[Bug] opentelemetry-related errors for Linux Dedicated / Linux Consumption #1668

Closed
@hallvictoria

Description

@hallvictoria

Background

Python Azure Function apps on runtime version 4.1038.400.2 on Linux Dedicated or Linux Consumption (not Flex Consumption) that include older versions of azure.core.*, opentelemetry-api, opentelemetry-sdk, or other packages that have these as dependencies may see opentelemetry-related errors during function indexing and function execution.

Examples of these errors include:

"ImportError: cannot import name '_OTEL_PYTHON_LOGGER_PROVIDER' from 'opentelemetry.environment_variables'" 

"ImportError: cannot import name '_OTEL_PYTHON_EVENT_LOGGER_PROVIDER' from 'opentelemetry.environment_variables'"

"ModuleNotFoundError: No module named 'azure.core.tracing.ext.opentelemetry_span'"

"ImportError: cannot import name 'DependencyConflictError' from 'opentelemetry.instrumentation.dependencies"

"ImportError: cannot import name 'Distribution' from 'opentelemetry.util._importlib_metadata'"

"ImportError: cannot import name 'PackageNotFoundError' from 'opentelemetry.util._importlib_metadata'"

"ImportError: cannot import name 'distributions' from 'opentelemetry.util._importlib_metadata'"

Root Cause

A new feature was planned to include OpenTelemetry support by default, so users wouldn’t need to manually add any OpenTelemetry-related packages to their application dependencies. To enable this, the azure-monitor-opentelemetry-exporter and azure-monitor-opentelemetry libraries were added to the Python 3.9–3.11 images.

These images include the latest versions of the libraries. However, if an app brings an older version of one of the dependencies of the AzMon distro, it will result in a dependency conflict.

Mitigations

  1. Update to opentelemetry-api>=1.28.0
  2. Pin to runtime version 4.1036 using LinuxFxVersion

Long-Term Solution

We are in the process of rolling out a fix for this issue, which will be in runtime version 4.1038.400.3. ETA for the fix is ~1 week. The team is investigating different options to provide support for this new feature without impacting existing apps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions