Skip to content

[Bug] OpenTelemetry _load_runtime_context() returning an error and resulting in Worker failed to load function error #41535

Open
@TheDataDexter

Description

@TheDataDexter
  • Package Name: azure-monitor-opentelemetry
  • Package Version: 1.6.10
  • Operating System: Linux
  • Python Version: 3.11

Describe the bug
After deploying our Azure Function App, the runtime fails to load the function, and the following error appears in the logs:

Worker failed to load function: 'function_name' with functionId: '00000000-0000-0000-00000000000000000'.

from opentelemetry import trace
File "/home/site/wwwroot/.python_packages/lib/site-packages/opentelemetry/trace/__init__.py", line 85, in <module>
  from opentelemetry import context as context_api
File "/home/site/wwwroot/.python_packages/lib/site-packages/opentelemetry/context/__init__.py", line 70, in <module>
  _RUNTIME_CONTEXT = _load_runtime_context()
File "/home/site/wwwroot/.python_packages/lib/site-packages/opentelemetry/context/__init__.py", line 60, in _load_runtime_context
  return next(  # type: ignore
StopIteration

We have not changed the requirements.txt recently. This error appeared as of last week (Thursday for our team).

To Reproduce
Steps to reproduce the behavior:

  1. Deploy a Python Azure Function App using the following dependencies:
    pgsql
    Kopiëren
    Bewerken
    azure-functions
    aiohttp
    azure-identity
    lxml
    cryptography==43.0.3
    opentelemetry-api
    opentelemetry-sdk
    azure-monitor-opentelemetry
    opentelemetry-instrumentation-requests
    opentelemetry-instrumentation-aiohttp-client
  2. Use Python version 3.11 and Azure Function runtime version 1.1039.500.0.
  3. Observe the failure in Application Insights or log stream.

Expected behavior
The function app should start without any runtime errors and execute the functions normally.

Screenshots
N/A

Additional context
We have tried to downgrade the package and found the same error. We suspect a compatibility issue or a breaking change in the latest azure-monitor-opentelemetry or its transitive dependencies (especially opentelemetry.context).

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.MonitorMonitor, Monitor Ingestion, Monitor QueryService AttentionWorkflow: This issue is responsible by Azure service team.bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions