sample-app-aoai-chatGPT icon indicating copy to clipboard operation
sample-app-aoai-chatGPT copied to clipboard

Application Insights not usable when deployed as webapp from AI Studio

Open m49808 opened this issue 1 year ago • 1 comments

The Application Insights link is greyed out says "Application Insights is not supported for your app's runtime configuration"

I've tried the workaround listed here https://github.com/microsoft/ApplicationInsights-dotnet/issues/2578#issuecomment-1311978824 but still not getting data.

m49808 avatar Sep 12 '23 12:09 m49808

One thing that I found helpful is adding Application Insights to the app.py code.

Here is some sample code.

from opencensus.ext.azure.log_exporter import AzureLogHandler
...
AZURE_APP_INSIGHTS_CONNECTION_STRING = os.environ.get("AZURE_APP_INSIGHTS_CONNECTION_STRING")
...
# Set up Azure Application Insights logger
app_insights_conn_str = AZURE_APP_INSIGHTS_CONNECTION_STRING
logger = logging.getLogger(__name__)
handler = AzureLogHandler(connection_string=app_insights_conn_str)
logger.addHandler(handler)
logger.setLevel(logging.INFO)
logger.info('Loaded Application Insights')

aaronba avatar Dec 13 '23 04:12 aaronba