Skip to content

Commit 092fd4a

Browse files
Merge pull request #98 from microsoft/feature/add-opentelemetry-logs
feat: added opentelemetry logs
2 parents e96f339 + e1cfc2d commit 092fd4a

6 files changed

Lines changed: 279 additions & 17 deletions

File tree

infra/deploy_ai_foundry.bicep

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ var aiHubFriendlyName = azureAiHubName
2525
var aiHubDescription = 'AI Hub for KM template'
2626
var aiProjectName = '${abbrs.ai.aiHubProject}${solutionName}'
2727
var aiProjectFriendlyName = aiProjectName
28-
var aiSearchName = '${abbrs.ai.aiSearch}${solutionName}'
28+
var aiSearchName = '${solutionName}-search'
29+
var applicationInsightsName = '${solutionName}-appi'
30+
2931

3032

3133
resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = {
@@ -44,6 +46,17 @@ resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
4446
}
4547
}
4648

49+
resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
50+
name: applicationInsightsName
51+
location: location
52+
kind: 'web'
53+
properties: {
54+
Application_Type: 'web'
55+
publicNetworkAccessForIngestion: 'Enabled'
56+
publicNetworkAccessForQuery: 'Enabled'
57+
WorkspaceResourceId: logAnalytics.id
58+
}
59+
}
4760

4861
var storageNameCleaned = replace(replace(replace(replace('${storageName}cast', '-', ''), '_', ''), '.', ''),'/', '')
4962

@@ -305,5 +318,6 @@ output storageAccountName string = storageNameCleaned
305318

306319
output logAnalyticsId string = logAnalytics.id
307320
output storageAccountId string = storage.id
321+
output applicationInsightsConnectionString string = applicationInsights.properties.ConnectionString
308322

309323
output projectConnectionString string = '${split(aiHubProject.properties.discoveryUrl, '/')[2]};${subscription().subscriptionId};${resourceGroup().name};${aiHubProject.name}'

infra/main.bicep

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ resource containerAppBackend 'Microsoft.App/containerApps@2023-05-01' = {
284284
name: 'COSMOSDB_ENDPOINT'
285285
value: databaseAccount.outputs.endpoint
286286
}
287+
{
288+
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
289+
value: azureAifoundry.outputs.applicationInsightsConnectionString
290+
}
287291
{
288292
name: 'COSMOSDB_DATABASE'
289293
value: cosmosdbDatabase

infra/main.json

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"metadata": {
55
"_generator": {
66
"name": "bicep",
7-
"version": "0.33.93.31351",
8-
"templateHash": "16851365929061577011"
7+
"version": "0.35.1.17967",
8+
"templateHash": "13571363186442322406"
99
}
1010
},
1111
"parameters": {
@@ -386,6 +386,10 @@
386386
"name": "COSMOSDB_ENDPOINT",
387387
"value": "[reference(resourceId('Microsoft.Resources/deployments', toLower(format('{0}{1}databaseAccount', variables('abbrs').databases.cosmosDBDatabase, variables('ResourcePrefix')))), '2022-09-01').outputs.endpoint.value]"
388388
},
389+
{
390+
"name": "APPLICATIONINSIGHTS_CONNECTION_STRING",
391+
"value": "[reference(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', subscription().subscriptionId, resourceGroup().name), 'Microsoft.Resources/deployments', 'deploy_ai_foundry'), '2022-09-01').outputs.applicationInsightsConnectionString.value]"
392+
},
389393
{
390394
"name": "COSMOSDB_DATABASE",
391395
"value": "[variables('cosmosdbDatabase')]"
@@ -614,8 +618,8 @@
614618
"metadata": {
615619
"_generator": {
616620
"name": "bicep",
617-
"version": "0.33.93.31351",
618-
"templateHash": "4801202077166882355"
621+
"version": "0.35.1.17967",
622+
"templateHash": "4754404420489871145"
619623
}
620624
},
621625
"parameters": {
@@ -714,8 +718,8 @@
714718
"metadata": {
715719
"_generator": {
716720
"name": "bicep",
717-
"version": "0.33.93.31351",
718-
"templateHash": "3632224099881800620"
721+
"version": "0.35.1.17967",
722+
"templateHash": "14711167186840027914"
719723
}
720724
},
721725
"parameters": {
@@ -850,8 +854,8 @@
850854
"metadata": {
851855
"_generator": {
852856
"name": "bicep",
853-
"version": "0.33.93.31351",
854-
"templateHash": "9456018511253136487"
857+
"version": "0.35.1.17967",
858+
"templateHash": "6185941478702970428"
855859
}
856860
},
857861
"parameters": {
@@ -1128,7 +1132,8 @@
11281132
"aiHubDescription": "AI Hub for KM template",
11291133
"aiProjectName": "[format('{0}{1}', variables('abbrs').ai.aiHubProject, parameters('solutionName'))]",
11301134
"aiProjectFriendlyName": "[variables('aiProjectName')]",
1131-
"aiSearchName": "[format('{0}{1}', variables('abbrs').ai.aiSearch, parameters('solutionName'))]",
1135+
"aiSearchName": "[format('{0}-search', parameters('solutionName'))]",
1136+
"applicationInsightsName": "[format('{0}-appi', parameters('solutionName'))]",
11321137
"storageNameCleaned": "[replace(replace(replace(replace(format('{0}cast', variables('storageName')), '-', ''), '_', ''), '.', ''), '/', '')]"
11331138
},
11341139
"resources": [
@@ -1166,6 +1171,22 @@
11661171
}
11671172
}
11681173
},
1174+
{
1175+
"type": "Microsoft.Insights/components",
1176+
"apiVersion": "2020-02-02",
1177+
"name": "[variables('applicationInsightsName')]",
1178+
"location": "[variables('location')]",
1179+
"kind": "web",
1180+
"properties": {
1181+
"Application_Type": "web",
1182+
"publicNetworkAccessForIngestion": "Enabled",
1183+
"publicNetworkAccessForQuery": "Enabled",
1184+
"WorkspaceResourceId": "[resourceId('Microsoft.OperationalInsights/workspaces', variables('workspaceName'))]"
1185+
},
1186+
"dependsOn": [
1187+
"[resourceId('Microsoft.OperationalInsights/workspaces', variables('workspaceName'))]"
1188+
]
1189+
},
11691190
{
11701191
"type": "Microsoft.Storage/storageAccounts",
11711192
"apiVersion": "2022-09-01",
@@ -1434,6 +1455,10 @@
14341455
"type": "string",
14351456
"value": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageNameCleaned'))]"
14361457
},
1458+
"applicationInsightsConnectionString": {
1459+
"type": "string",
1460+
"value": "[reference(resourceId('Microsoft.Insights/components', variables('applicationInsightsName')), '2020-02-02').ConnectionString]"
1461+
},
14371462
"projectConnectionString": {
14381463
"type": "string",
14391464
"value": "[format('{0};{1};{2};{3}', split(reference(resourceId('Microsoft.MachineLearningServices/workspaces', variables('aiProjectName')), '2024-01-01-preview').discoveryUrl, '/')[2], subscription().subscriptionId, resourceGroup().name, variables('aiProjectName'))]"

0 commit comments

Comments
 (0)