Skip to content

Commit 8387005

Browse files
authored
Merge pull request #78 from microsoft/sk-migration-evaltracing-iandev2
Logging / Tracing / Metrics from SK for console, aspire, app inn with azd up deployment
2 parents c9ec47b + 56c986e commit 8387005

File tree

12 files changed

+1013
-410
lines changed

12 files changed

+1013
-410
lines changed
546 Bytes
Binary file not shown.

voice_agent/app/backend/rtmt.py

Lines changed: 407 additions & 289 deletions
Large diffs are not rendered by default.

voice_agent/app/backend/utility.py

Lines changed: 292 additions & 115 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"root":["./src/app.tsx","./src/env.d.ts","./src/index.tsx","./src/types.ts","./src/vite-env.d.ts","./src/components/audio/player.ts","./src/components/audio/recorder.ts","./src/components/ui/button.tsx","./src/components/ui/card.tsx","./src/components/ui/grounding-file-view.tsx","./src/components/ui/grounding-file.tsx","./src/components/ui/grounding-files.tsx","./src/components/ui/history-panel.tsx","./src/components/ui/status-message.tsx","./src/hooks/useaudioplayer.tsx","./src/hooks/useaudiorecorder.tsx","./src/hooks/userealtime.tsx","./src/lib/utils.ts"],"version":"5.8.2"}
1+
{"root":["./src/App.tsx","./src/env.d.ts","./src/index.tsx","./src/types.ts","./src/vite-env.d.ts","./src/components/audio/player.ts","./src/components/audio/recorder.ts","./src/components/ui/button.tsx","./src/components/ui/card.tsx","./src/components/ui/grounding-file-view.tsx","./src/components/ui/grounding-file.tsx","./src/components/ui/grounding-files.tsx","./src/components/ui/history-panel.tsx","./src/components/ui/status-message.tsx","./src/hooks/useAudioPlayer.tsx","./src/hooks/useAudioRecorder.tsx","./src/hooks/useRealtime.tsx","./src/lib/utils.ts"],"version":"5.8.2"}

voice_agent/app/infra/app/backend.bicep

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ param containerPort int = 8765
4343
@description('Specifies if the resource exists')
4444
param exists bool
4545

46+
@description('Endpoint to send OTLP data to for observability')
47+
param otlpEndpoint string
48+
4649
type managedIdentity = {
4750
resourceId: string
4851
clientId: string
@@ -102,6 +105,14 @@ module backend '../core/host/container-app-upsert.bicep' = {
102105
name: 'AZURE_OPENAI_REALTIME_DEPLOYMENT_NAME'
103106
value: openAiRealtimeDeploymentName
104107
}
108+
{
109+
name: 'ASPIRE_DASHBOARD_ENDPOINT'
110+
value: otlpEndpoint
111+
}
112+
{
113+
name: 'TELEMETRY_SCENARIO'
114+
value: 'console,application_insights,aspire_dashboard'
115+
}
105116
]
106117
targetPort: containerPort
107118
}

voice_agent/app/infra/core/host/container-app-upsert.bicep

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ param serviceBinds array = []
7171
@description('The target port for the container')
7272
param targetPort int = 80
7373

74+
@description('Additional ports to expose (optional)')
75+
param additionalPorts array = []
76+
7477
resource existingApp 'Microsoft.App/containerApps@2023-05-02-preview' existing = if (exists) {
7578
name: name
7679
}
@@ -101,6 +104,7 @@ module app 'container-app.bicep' = {
101104
imageName: !empty(imageName) ? imageName : exists ? existingApp.properties.template.containers[0].image : ''
102105
targetPort: targetPort
103106
serviceBinds: serviceBinds
107+
additionalPorts: additionalPorts
104108
}
105109
}
106110

voice_agent/app/infra/core/host/container-app.bicep

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ param serviceType string = ''
7575
@description('The target port for the container')
7676
param targetPort int = 80
7777

78+
@description('Additional ports to expose (optional)')
79+
param additionalPorts array = []
80+
7881
resource userIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' existing = if (!empty(identityName)) {
7982
name: identityName
8083
}
@@ -117,6 +120,8 @@ resource app 'Microsoft.App/containerApps@2023-05-02-preview' = {
117120
corsPolicy: {
118121
allowedOrigins: union([ 'https://portal.azure.com', 'https://ms.portal.azure.com' ], allowedOrigins)
119122
}
123+
// Add additional exposed ports if specified
124+
additionalPortMappings: !empty(additionalPorts) ? additionalPorts : null
120125
} : null
121126
dapr: daprEnabled ? {
122127
enabled: true

voice_agent/app/infra/core/host/container-apps-environment.bicep

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ param daprEnabled bool = false
1212
@description('Name of the Log Analytics workspace')
1313
param logAnalyticsWorkspaceName string
1414

15+
@description('infrastructure subnet id')
16+
param infrastructureSubnetId string
17+
1518
resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' = {
1619
name: name
1720
location: location
@@ -25,7 +28,12 @@ resource containerAppsEnvironment 'Microsoft.App/managedEnvironments@2023-05-01'
2528
}
2629
}
2730
daprAIInstrumentationKey: daprEnabled && !empty(applicationInsightsName) ? applicationInsights.properties.InstrumentationKey : ''
31+
vnetConfiguration: !empty(infrastructureSubnetId) ? {
32+
infrastructureSubnetId: infrastructureSubnetId
33+
internal: false
34+
} : null
2835
}
36+
2937
}
3038

3139
resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2022-10-01' existing = {

voice_agent/app/infra/core/host/container-apps.bicep

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ param containerRegistryAdminUserEnabled bool = false
1010
param logAnalyticsWorkspaceName string = ''
1111
param applicationInsightsName string = ''
1212
param daprEnabled bool = false
13+
param infrastructureSubnetId string = ''
1314

1415
module containerAppsEnvironment 'container-apps-environment.bicep' = {
1516
name: '${name}-container-apps-environment'
@@ -20,6 +21,7 @@ module containerAppsEnvironment 'container-apps-environment.bicep' = {
2021
logAnalyticsWorkspaceName: logAnalyticsWorkspaceName
2122
applicationInsightsName: applicationInsightsName
2223
daprEnabled: daprEnabled
24+
infrastructureSubnetId: infrastructureSubnetId
2325
}
2426
}
2527

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
@description('The Azure region for the resources.')
2+
param location string
3+
4+
@description('Tags to apply to the resources.')
5+
param tags object = {}
6+
7+
@description('Name for the virtual network.')
8+
param vnetName string
9+
10+
@description('Address prefix for the virtual network.')
11+
param vnetAddressPrefix string
12+
13+
@description('Name for the infrastructure subnet.')
14+
param infrastructureSubnetName string = 'infrastructure-subnet'
15+
16+
@description('Address prefix for the infrastructure subnet.')
17+
param infrastructureSubnetPrefix string
18+
19+
@description('Name for the Container Apps subnet.')
20+
param containerAppsSubnetName string = 'containerapps-subnet'
21+
22+
@description('Address prefix for the Container Apps subnet.')
23+
param containerAppsSubnetPrefix string
24+
25+
// Create the virtual network
26+
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2023-04-01' = {
27+
name: vnetName
28+
location: location
29+
tags: tags
30+
properties: {
31+
addressSpace: {
32+
addressPrefixes: [
33+
vnetAddressPrefix
34+
]
35+
}
36+
subnets: [
37+
{
38+
name: containerAppsSubnetName
39+
properties: {
40+
addressPrefix: containerAppsSubnetPrefix
41+
privateEndpointNetworkPolicies: 'Disabled'
42+
privateLinkServiceNetworkPolicies: 'Enabled'
43+
}
44+
}
45+
{
46+
name: infrastructureSubnetName
47+
properties: {
48+
addressPrefix: infrastructureSubnetPrefix
49+
delegations: [
50+
{
51+
name: 'Microsoft.App.environments'
52+
properties: {
53+
serviceName: 'Microsoft.App/environments'
54+
}
55+
}
56+
]
57+
}
58+
}
59+
]
60+
}
61+
}
62+
63+
// Add a Network Security Group (NSG) rule to allow inbound 443 traffic on the container apps subnet
64+
resource containerAppsSubnetNsg 'Microsoft.Network/networkSecurityGroups@2023-04-01' = {
65+
name: '${containerAppsSubnetName}-nsg'
66+
location: location
67+
tags: tags
68+
properties: {
69+
securityRules: [
70+
{
71+
name: 'Allow-Inbound-443'
72+
properties: {
73+
priority: 100
74+
direction: 'Inbound'
75+
access: 'Allow'
76+
protocol: 'Tcp'
77+
sourcePortRange: '*'
78+
destinationPortRange: '443'
79+
sourceAddressPrefix: '*'
80+
destinationAddressPrefix: '*'
81+
}
82+
}
83+
{
84+
name: 'Allow-Inbound-Intra-VNet-18889'
85+
properties: {
86+
priority: 200
87+
direction: 'Inbound'
88+
access: 'Allow'
89+
protocol: 'Tcp'
90+
sourcePortRange: '*'
91+
destinationPortRange: '18889'
92+
sourceAddressPrefix: 'VirtualNetwork'
93+
destinationAddressPrefix: 'VirtualNetwork'
94+
}
95+
}
96+
{
97+
name: 'Allow-Inbound-Intra-VNet-18890'
98+
properties: {
99+
priority: 201
100+
direction: 'Inbound'
101+
access: 'Allow'
102+
protocol: 'Tcp'
103+
sourcePortRange: '*'
104+
destinationPortRange: '18890'
105+
sourceAddressPrefix: 'VirtualNetwork'
106+
destinationAddressPrefix: 'VirtualNetwork'
107+
}
108+
}
109+
{
110+
name: 'Allow-Outbound-443'
111+
properties: {
112+
priority: 100
113+
direction: 'Outbound'
114+
access: 'Allow'
115+
protocol: 'Tcp'
116+
sourcePortRange: '*'
117+
destinationPortRange: '443'
118+
sourceAddressPrefix: '*'
119+
destinationAddressPrefix: '*'
120+
}
121+
}
122+
{
123+
name: 'Allow-Outbound-Intra-VNet-18889'
124+
properties: {
125+
priority: 200
126+
direction: 'Outbound'
127+
access: 'Allow'
128+
protocol: 'Tcp'
129+
sourcePortRange: '*'
130+
destinationPortRange: '18889'
131+
sourceAddressPrefix: 'VirtualNetwork'
132+
destinationAddressPrefix: 'VirtualNetwork'
133+
}
134+
}
135+
{
136+
name: 'Allow-Outbound-Intra-VNet-18890'
137+
properties: {
138+
priority: 201
139+
direction: 'Outbound'
140+
access: 'Allow'
141+
protocol: 'Tcp'
142+
sourcePortRange: '*'
143+
destinationPortRange: '18890'
144+
sourceAddressPrefix: 'VirtualNetwork'
145+
destinationAddressPrefix: 'VirtualNetwork'
146+
}
147+
}
148+
]
149+
}
150+
}
151+
152+
// Associate the NSG with the container apps subnet
153+
resource containerAppsSubnetNsgAssociation 'Microsoft.Network/virtualNetworks/subnets@2023-04-01' = {
154+
parent: virtualNetwork
155+
name: containerAppsSubnetName
156+
properties: {
157+
addressPrefix: containerAppsSubnetPrefix
158+
networkSecurityGroup: {
159+
id: containerAppsSubnetNsg.id
160+
}
161+
privateEndpointNetworkPolicies: 'Disabled'
162+
privateLinkServiceNetworkPolicies: 'Enabled'
163+
}
164+
}
165+
166+
// Output the subnet details
167+
output vnetId string = virtualNetwork.id
168+
output vnetName string = virtualNetwork.name
169+
output infrastructureSubnetId string = virtualNetwork.properties.subnets[0].id
170+
output containerAppsSubnetId string = virtualNetwork.properties.subnets[1].id
171+
output infrastructureSubnetName string = infrastructureSubnetName
172+
output containerAppsSubnetName string = containerAppsSubnetName

0 commit comments

Comments
 (0)