microsoft/ApplicationInsights-Python

Not able to set cloudrole name

Closed this issue · 3 comments

I am trying to set cloudrole name for dependencies but its not getting set which I view the dependencies in applicaiton insights.

I am following this URL to set cloud role name https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-configuration?tabs=python

    os.environ["OTEL_RESOURCE_ATTRIBUTES"] = "service.instance.id=" + service_name
    os.environ["OTEL_SERVICE_NAME"] = service_name

    conn_str_from_env = os.environ.get("APPLICATIONINSIGHTS_CONNECTION_STRING")
    configure_azure_monitor()

    tracer =  trace.get_tracer(name)

    with tracer.start_as_current_span("test"):
                test()

Can you confirm whether setting the environment variable outside of code before runtime works correctly? It's possible that setting an environment variable as you does not work for all environments.

lzchen commented

@anandchugh

Are you still having this issue?

lzchen commented

Closing this issue for now. @anandchugh please message here if you are still having trouble and we can revisit.