Skip to content
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

Resource error #319

Closed
harmankaya opened this issue Nov 16, 2023 · 2 comments
Closed

Resource error #319

harmankaya opened this issue Nov 16, 2023 · 2 comments

Comments

@harmankaya
Copy link

Is it possible to make _setup_resources() optional in configure_azure_monitor()? I'm referring to the following segment of code:

def configure_azure_monitor(**kwargs) -> None:
    """This function works as a configuration layer that allows the
    end user to configure OpenTelemetry and Azure monitor components. The
    configuration can be done via arguments passed to this function.

    :keyword str connection_string: Connection string for your Application Insights resource.
    :keyword credential: Token credential, such as `ManagedIdentityCredential` or `ClientSecretCredential`,
     used for Azure Active Directory (AAD) authentication. Defaults to `None`.
    :paramtype credential: ~azure.core.credentials.TokenCredential or None
    :keyword bool disable_offline_storage: Boolean value to determine whether to disable storing failed
     telemetry records for retry. Defaults to `False`.
    :keyword str storage_directory: Storage directory in which to store retry files. Defaults to
     `<tempfile.gettempdir()>/Microsoft/AzureMonitor/opentelemetry-python-<your-instrumentation-key>`.
    :keyword str logger_name: The name of the Python logger that telemetry will be collected.
    :rtype: None
    """

    configurations = _get_configurations(**kwargs)

    disable_tracing = configurations[DISABLE_TRACING_ARG]
    disable_logging = configurations[DISABLE_LOGGING_ARG]
    disable_metrics = configurations[DISABLE_METRICS_ARG]

    # Setup resources
    _setup_resources() # <----- this line

   ....

When developing a containerized FastAPI application, I encounter an issue during live reloads or application startups. The error message is as follows:

Exception  in detector <opentelemetry.resource.detector.azure.vm.AzureVMResourceDetector object at 0xffffa58ef810>, ignoring

This error repeats multiple times with a few seconds interval, ultimately leading to:

Cannot call collect on a MetricReader until it is registered on a MeterProvider

After these messages, the application starts normally. However, this issue is a significant inconvenience during local development, particularly when experimenting with Azure Application Insights.

I suspect _setup_resources() is the root cause, as it seems to configure the environment as if it were an Azure resource. Could this be the case?

Additionally, I've only started encountering this error in version 1.1.0; it wasn't an issue in previous versions.

Lastly, why doesn't this repository reflect the latest version of the package?

@lzchen
Copy link
Contributor

lzchen commented Nov 20, 2023

The azure-monitor-opentelemetry package code has moved to the azure-sdk repository so please open up your issue there.

@jeremydvoss
Copy link
Member

Migrated to Azuer sdk: Azure/azure-sdk-for-python#33253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants