Skip to content

Commit a7184e3

Browse files
Merge pull request #282 from microsoft/dev
fix: Merging dev changes to main branch
2 parents 000b0ae + 270ee5a commit a7184e3

9 files changed

Lines changed: 115 additions & 91 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
9999
if [ "$rg_exists" = "false" ]; then
100100
echo "Resource group does not exist. Creating..."
101-
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location northcentralus || { echo "Error creating resource group"; exit 1; }
101+
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location australiaeast || { echo "Error creating resource group"; exit 1; }
102102
else
103103
echo "Resource group already exists."
104104
fi
@@ -382,7 +382,7 @@ jobs:
382382
383383
# Purge OpenAI Resource
384384
echo "Purging the OpenAI Resource..."
385-
if ! az resource delete --ids /subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/providers/Microsoft.CognitiveServices/locations/northcentralus/resourceGroups/${{ env.RESOURCE_GROUP_NAME }}/deletedAccounts/${{ env.OPENAI_RESOURCE_NAME }} --verbose; then
385+
if ! az resource delete --ids /subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/providers/Microsoft.CognitiveServices/locations/australiaeast/resourceGroups/${{ env.RESOURCE_GROUP_NAME }}/deletedAccounts/${{ env.OPENAI_RESOURCE_NAME }} --verbose; then
386386
echo "Failed to purge openai resource: ${{ env.OPENAI_RESOURCE_NAME }}"
387387
else
388388
echo "Purged the openai resource: ${{ env.OPENAI_RESOURCE_NAME }}"

infra/main.bicep

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -887,10 +887,7 @@ module containerAppBackend 'br/public:avm/res/app/container-app:0.19.0' = {
887887
name: 'AZURE_BLOB_CONTAINER_NAME'
888888
value: appStorageContainerName
889889
}
890-
{
891-
name: 'AZURE_OPENAI_ENDPOINT'
892-
value: 'https://${aiServices.outputs.name}.openai.azure.com/'
893-
}
890+
894891
{
895892
name: 'MIGRATOR_AGENT_MODEL_DEPLOY'
896893
value: modelDeployment.name
@@ -955,6 +952,18 @@ module containerAppBackend 'br/public:avm/res/app/container-app:0.19.0' = {
955952
name: 'APP_ENV'
956953
value: 'prod'
957954
}
955+
{
956+
name: 'AZURE_BASIC_LOGGING_LEVEL'
957+
value: 'INFO'
958+
}
959+
{
960+
name: 'AZURE_PACKAGE_LOGGING_LEVEL'
961+
value: 'WARNING'
962+
}
963+
{
964+
name: 'AZURE_LOGGING_PACKAGES'
965+
value: ''
966+
}
958967
],
959968
enableMonitoring
960969
? [
@@ -1072,7 +1081,6 @@ output WEB_APP_URL string = 'https://${containerAppFrontend.outputs.fqdn}'
10721081
output COSMOSDB_ENDPOINT string = cosmosDb.outputs.endpoint
10731082
output AZURE_BLOB_ACCOUNT_NAME string = storageAccount.outputs.name
10741083
output AZURE_BLOB_ENDPOINT string = 'https://${storageAccount.outputs.name}.blob.core.windows.net/'
1075-
output AZURE_OPENAI_ENDPOINT string = 'https://${aiServices.outputs.name}.openai.azure.com/'
10761084
output AZURE_AI_AGENT_PROJECT_NAME string = aiServices.outputs.aiProjectInfo.name
10771085
output AZURE_AI_AGENT_ENDPOINT string = aiServices.outputs.aiProjectInfo.apiEndpoint
10781086
output AZURE_AI_AGENT_PROJECT_CONNECTION_STRING string = aiServices.outputs.aiProjectInfo.apiEndpoint

infra/main.json

Lines changed: 58 additions & 62 deletions
Large diffs are not rendered by default.

infra/main_custom.bicep

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -921,10 +921,7 @@ module containerAppBackend 'br/public:avm/res/app/container-app:0.19.0' = {
921921
name: 'AZURE_BLOB_CONTAINER_NAME'
922922
value: appStorageContainerName
923923
}
924-
{
925-
name: 'AZURE_OPENAI_ENDPOINT'
926-
value: 'https://${aiServices.outputs.name}.openai.azure.com/'
927-
}
924+
928925
{
929926
name: 'MIGRATOR_AGENT_MODEL_DEPLOY'
930927
value: modelDeployment.name
@@ -985,6 +982,18 @@ module containerAppBackend 'br/public:avm/res/app/container-app:0.19.0' = {
985982
name: 'APP_ENV'
986983
value: 'prod'
987984
}
985+
{
986+
name: 'AZURE_BASIC_LOGGING_LEVEL'
987+
value: 'INFO'
988+
}
989+
{
990+
name: 'AZURE_PACKAGE_LOGGING_LEVEL'
991+
value: 'WARNING'
992+
}
993+
{
994+
name: 'AZURE_LOGGING_PACKAGES'
995+
value: ''
996+
}
988997
],
989998
enableMonitoring
990999
? [
@@ -1113,7 +1122,6 @@ output COSMOSDB_ENDPOINT string = cosmosDb.outputs.endpoint
11131122
output AZURE_BLOB_ACCOUNT_NAME string = storageAccount.outputs.name
11141123
output AZURE_BLOB_ENDPOINT string = 'https://${storageAccount.outputs.name}.blob.core.windows.net/'
11151124
output AZURE_CONTAINER_REGISTRY_ENDPOINT string = containerRegistry.properties.loginServer
1116-
output AZURE_OPENAI_ENDPOINT string = 'https://${aiServices.outputs.name}.openai.azure.com/'
11171125
output AZURE_AI_AGENT_PROJECT_NAME string = aiServices.outputs.aiProjectInfo.name
11181126
output AZURE_AI_AGENT_ENDPOINT string = aiServices.outputs.aiProjectInfo.apiEndpoint
11191127
output AZURE_AI_AGENT_RESOURCE_GROUP_NAME string = resourceGroup().name

src/backend/.env.sample

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,12 @@ AZURE_AI_AGENT_RESOURCE_GROUP_NAME = ""
2525
AZURE_AI_AGENT_PROJECT_NAME = ""
2626
AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME = ""
2727

28-
APP_ENV = "dev"
28+
APP_ENV = "dev"
29+
30+
# Basic application logging (default: INFO level)
31+
AZURE_BASIC_LOGGING_LEVEL=INFO
32+
# Azure package logging (default: WARNING level to suppress INFO)
33+
AZURE_PACKAGE_LOGGING_LEVEL=WARNING
34+
# Comma-separated list of specific logger names to configure (default: empty - no custom loggers)
35+
# Example: AZURE_LOGGING_PACKAGES=azure.identity.aio._internal,azure.monitor.opentelemetry.exporter.export._base
36+
AZURE_LOGGING_PACKAGES=

src/backend/api/api_routes.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,6 @@
5353
"No Application Insights Instrumentation Key found. Skipping configuration"
5454
)
5555

56-
# Configure logging
57-
logging.basicConfig(level=logging.INFO)
58-
59-
# Suppress INFO logs from 'azure.core.pipeline.policies.http_logging_policy'
60-
logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(
61-
logging.WARNING
62-
)
63-
logging.getLogger("azure.identity.aio._internal").setLevel(logging.WARNING)
64-
65-
# Suppress info logs from OpenTelemetry exporter
66-
logging.getLogger("azure.monitor.opentelemetry.exporter.export._base").setLevel(
67-
logging.WARNING
68-
)
69-
7056

7157
def record_exception_to_trace(e):
7258
"""Record exception to the current OpenTelemetry trace span."""

src/backend/app.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
"""Create and configure the FastAPI application."""
2+
import logging
3+
import os
24
from contextlib import asynccontextmanager
35

46
from api.api_routes import router as backend_router
@@ -26,6 +28,24 @@
2628
load_dotenv()
2729

2830
# Configure logging
31+
# Basic application logging (default: INFO level)
32+
AZURE_BASIC_LOGGING_LEVEL = os.getenv("AZURE_BASIC_LOGGING_LEVEL", "INFO").upper()
33+
# Azure package logging (default: WARNING level to suppress INFO)
34+
AZURE_PACKAGE_LOGGING_LEVEL = os.getenv("AZURE_PACKAGE_LOGGING_LEVEL", "WARNING").upper()
35+
# Azure logging packages (default: empty list)
36+
azure_logging_packages_env = os.getenv("AZURE_LOGGING_PACKAGES")
37+
AZURE_LOGGING_PACKAGES = azure_logging_packages_env.split(",") if azure_logging_packages_env else []
38+
39+
# Basic config: logging.basicConfig(level=logging.INFO)
40+
logging.basicConfig(
41+
level=getattr(logging, AZURE_BASIC_LOGGING_LEVEL, logging.INFO),
42+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
43+
)
44+
45+
# Package config: Azure loggers set to WARNING to suppress INFO
46+
for logger_name in AZURE_LOGGING_PACKAGES:
47+
logging.getLogger(logger_name).setLevel(getattr(logging, AZURE_PACKAGE_LOGGING_LEVEL, logging.WARNING))
48+
2949
logger = AppLogger("app")
3050

3151
# Global variables for agents

src/backend/common/config/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def __init__(self):
3939
self.azure_service_bus_namespace = os.getenv("AZURE_SERVICE_BUS_NAMESPACE")
4040
self.azure_queue_name = os.getenv("AZURE_QUEUE_NAME")
4141

42-
self.azure_openai_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
4342
self.ai_project_endpoint = os.getenv("AI_PROJECT_ENDPOINT")
4443
self.migrator_agent_model_deploy = os.getenv("MIGRATOR_AGENT_MODEL_DEPLOY")
4544
self.picker_agent_model_deploy = os.getenv("PICKER_AGENT_MODEL_DEPLOY")

src/backend/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ typing-extensions
3636
python-jose[cryptography]
3737
passlib[bcrypt]
3838
semantic-kernel[azure]==1.32.2
39-
openai==2.0.0
4039
sqlparse
4140
sqlglot
4241
unittest2

0 commit comments

Comments
 (0)