Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.63k stars 2.84k forks source link

Application Insights capturing requests in incorrect unit #35087

Open cecheta opened 7 months ago

cecheta commented 7 months ago

Describe the bug When usng configure_azure_monitor() to monitor the application, the Application Map displays some request times in minutes and seconds when they are meant to be in milliseconds. I am not sure if this is a bug within Azure or the SDK, however it only appears for the request using the requests library, and not the Azure SDK.

To Reproduce

requirements.txt

azure-monitor-opentelemetry==1.3.0
azure-storage-blob==12.19.1
requests==2.31.0

app.py

from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor()

import os

import requests
from azure.storage.blob import BlobServiceClient
from flask import Flask

app = Flask(__name__)

@app.route("/")
def root():
    return requests.get("https://www.google.com").text

@app.route("/blob")
def blob():
    blob_service_client = BlobServiceClient.from_connection_string(
        os.environ["AZURE_STORAGE_CONNECTION_STRING"]
    )
    return str([container.name for container in blob_service_client.list_containers()])

Expected behavior Calls should be displayed in milliseconds

Screenshots Screenshot 2024-04-05 140433 Screenshot 2024-04-05 140323

github-actions[bot] commented 7 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AzmonActionG @AzmonAlerts @AzMonEssential @AzmonLogA @dadunl @SameergMS.

lzchen commented 7 months ago

@cecheta

Just to confirm, you are expecting the app map to show 127ms for that call instead of 2min 7s or is the call actually taking that long and you are simply wanting it to be represented in ms?

cecheta commented 7 months ago

Hi @lzchen, I am expecting the map to display 127 ms, which is the actual time that the request took.

For some reason, it is being interpreted as 127 s, which is 2 min 7 s

lzchen commented 7 months ago

@cecheta

This seems like an application map ux bug. I have forwarded your issue to the corresponding group.

xiangyan99 commented 7 months ago

@lzchen application map ux is not monitored in this repo.

Do we have a way to track it?

lzchen commented 7 months ago

@xiangyan99

There is a tracking issue on devops. I will send this to you internally.