Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more metrics and logs to workbook #630

Merged
merged 4 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions infra/app/eventgrid.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ resource eventGridSystemTopicNameBlobEvents 'Microsoft.EventGrid/systemTopics/ev
}
}
}

output name string = eventGridSystemTopic.name
1 change: 1 addition & 0 deletions infra/app/function.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,4 @@ module functionaccess '../core/security/keyvault-access.bicep' = if (useKeyVault
}

output FUNCTION_IDENTITY_PRINCIPAL_ID string = function.outputs.identityPrincipalId
output functionName string = function.outputs.name
34 changes: 34 additions & 0 deletions infra/app/workbook.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
param workbookDisplayName string
param location string
param hostingPlanName string
param functionName string
param websiteName string
param adminWebsiteName string
param eventGridSystemTopicName string
param logAnalyticsName string
param azureOpenAIResourceName string
param azureAISearchName string
param storageAccountName string

var wookbookContents = loadTextContent('../workbooks/workbook.json')
var wookbookContentsSubReplaced = replace(wookbookContents, '{subscription-id}', subscription().id)
var wookbookContentsRGReplaced = replace(wookbookContentsSubReplaced, '{resource-group}', resourceGroup().name)
var wookbookContentsAppServicePlanReplaced = replace(wookbookContentsRGReplaced, '{app-service-plan}', hostingPlanName)
var wookbookContentsBackendAppServiceReplaced = replace(wookbookContentsAppServicePlanReplaced, '{backend-app-service}', functionName)
var wookbookContentsWebAppServiceReplaced = replace(wookbookContentsBackendAppServiceReplaced, '{web-app-service}', websiteName)
var wookbookContentsAdminAppServiceReplaced = replace(wookbookContentsWebAppServiceReplaced, '{admin-app-service}', adminWebsiteName)
var wookbookContentsEventGridReplaced = replace(wookbookContentsAdminAppServiceReplaced, '{event-grid}', eventGridSystemTopicName)
var wookbookContentsLogAnalyticsReplaced = replace(wookbookContentsEventGridReplaced, '{log-analytics}', logAnalyticsName)
var wookbookContentsOpenAIReplaced = replace(wookbookContentsLogAnalyticsReplaced, '{open-ai}', azureOpenAIResourceName)
var wookbookContentsAISearchReplaced = replace(wookbookContentsOpenAIReplaced, '{ai-search}', azureAISearchName)
var wookbookContentsStorageAccountReplaced = replace(wookbookContentsAISearchReplaced, '{storage-account}', storageAccountName)

module cwydsa_workbook '../core/monitor/workbook.bicep' = {
name: workbookDisplayName
params: {
workbookId: 'd9bd03af-7ef0-4bac-b91b-b14ee4c7002b'
workbookDisplayName: workbookDisplayName
location: location
workbookContents: wookbookContentsStorageAccountReplaced
}
}
5 changes: 2 additions & 3 deletions infra/core/monitor/workbook.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ param workbookContents string

param location string = resourceGroup().location

resource workbookId_resource 'microsoft.insights/workbooks@2023-06-01' = {
resource workbook_resource 'microsoft.insights/workbooks@2023-06-01' = {
name: workbookId
location: location
kind: 'shared'
Expand All @@ -26,7 +26,6 @@ resource workbookId_resource 'microsoft.insights/workbooks@2023-06-01' = {
sourceId: workbookSourceId
category: workbookType
}
dependsOn: []
}

output workbookId string = workbookId_resource.id
output workbookId string = workbook_resource.id
31 changes: 22 additions & 9 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ param hostingPlanSku string = 'B3'
@description('Name of Web App')
param websiteName string = 'web-${resourceToken}'

@description('Name of Admin Web App')
param adminWebsiteName string = '${websiteName}-admin'

@description('Name of Application Insights')
param applicationInsightsName string = 'appinsights-${resourceToken}'

Expand Down Expand Up @@ -148,6 +151,9 @@ param contentSafetyName string = 'contentsafety-${resourceToken}'
@description('Azure Speech Service Name')
param speechServiceName string = 'speech-${resourceToken}'

@description('Log Analytics Name')
param logAnalyticsName string = 'la-${resourceToken}'

param newGuidString string = newGuid()
param searchTag string = 'chatwithyourdata-sa'

Expand Down Expand Up @@ -440,10 +446,10 @@ module web_docker './app/web.bicep' = if (hostingModel == 'container') {
}

module adminweb './app/adminweb.bicep' = if (hostingModel == 'code') {
name: '${websiteName}-admin'
name: adminWebsiteName
scope: rg
params: {
name: '${websiteName}-admin'
name: adminWebsiteName
location: location
tags: union(tags, { 'azd-service-name': 'adminweb' })
runtimeName: 'python'
Expand Down Expand Up @@ -501,10 +507,10 @@ module adminweb './app/adminweb.bicep' = if (hostingModel == 'code') {
}

module adminweb_docker './app/adminweb.bicep' = if (hostingModel == 'container') {
name: '${websiteName}-admin-docker'
name: '${adminWebsiteName}-docker'
scope: rg
params: {
name: '${websiteName}-admin-docker'
name: '${adminWebsiteName}-docker'
location: location
tags: union(tags, { 'azd-service-name': 'adminweb-docker' })
dockerFullImageName: 'fruoccopublic.azurecr.io/rag-adminwebapp'
Expand Down Expand Up @@ -569,19 +575,26 @@ module monitoring './core/monitor/monitoring.bicep' = {
tags: {
'hidden-link:${resourceId('Microsoft.Web/sites', applicationInsightsName)}': 'Resource'
}
logAnalyticsName: 'la-${resourceToken}'
logAnalyticsName: logAnalyticsName
applicationInsightsDashboardName: 'dash-${applicationInsightsName}'
}
}

module workbook './core/monitor/workbook.bicep' = {
name: workbookDisplayName
module workbook './app/workbook.bicep' = {
name: 'workbook'
scope: rg
params: {
workbookId: 'd9bd03af-7ef0-4bac-b91b-b14ee4c7002b'
workbookDisplayName: workbookDisplayName
location: location
workbookContents: loadTextContent('workbooks/workbook.json')
hostingPlanName: hostingplan.outputs.name
functionName: hostingModel == 'container' ? function_docker.outputs.functionName : function.outputs.functionName
websiteName: hostingModel == 'container' ? web_docker.outputs.FRONTEND_API_NAME : web.outputs.FRONTEND_API_NAME
adminWebsiteName: hostingModel == 'container' ? adminweb_docker.outputs.WEBSITE_ADMIN_NAME : adminweb.outputs.WEBSITE_ADMIN_NAME
eventGridSystemTopicName: eventgrid.outputs.name
logAnalyticsName: monitoring.outputs.logAnalyticsWorkspaceName
azureOpenAIResourceName: openai.outputs.name
azureAISearchName: search.outputs.name
storageAccountName: storage.outputs.name
}
}

Expand Down
273 changes: 207 additions & 66 deletions infra/main.json

Large diffs are not rendered by default.

Loading
Loading