Skip to content

Commit dcc4ee9

Browse files
authored
Merge pull request #3 from microsoft/feat/add_logs
feat: Add logs and docs.
2 parents fd95bf3 + 8cd8d65 commit dcc4ee9

File tree

12 files changed

+144
-34
lines changed

12 files changed

+144
-34
lines changed

docs/workshop.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,15 @@ azd provision
156156

157157
Refresh your azd environment using the following commands:
158158

159+
<div class="important" data-title="Important">
160+
161+
> - The value of the `AZURE_LOCATION` option should be set depending on where your resources are deployed.
162+
> - If the resources are deployed in East US you should use `eastus`, if they are deployed in East US 2 you should use `eastus2`
163+
164+
</div>
165+
159166
```sh
160-
azd env set AZURE_LOCATION eastus2 -e ignite --no-prompt
167+
azd env set AZURE_LOCATION <YOUR-RESOURCE-LOCATION> -e ignite --no-prompt
161168
azd env refresh -e ignite
162169
```
163170

@@ -171,7 +178,7 @@ AZURE_PROCESSOR_FUNCTION_APP_NAME="func-drbl-<suffix>"
171178
AUDIOS_EVENTGRID_SYSTEM_TOPIC_NAME="evgt-<suffix>"
172179
AUDIOS_STORAGE_ACCOUNT_CONTAINER_NAME="audios"
173180
AZURE_ENV_NAME="ignite"
174-
AZURE_LOCATION="eastus2"
181+
AZURE_LOCATION="<YOUR-RESOURCE-LOCATION>"
175182
```
176183

177184
Now you can deploy all your Function Apps using the following command:
@@ -216,6 +223,14 @@ To test the environment setup, we will upload an audio file using the uploader f
216223

217224
</details>
218225

226+
You have 2 options to test the upload of a `.wav` file:
227+
- Using VS Code
228+
- Using Postman
229+
230+
Choose the most convenient one for you.
231+
232+
### Option 1: Upload with VS Code
233+
219234
Inside VS Code, open the `audioupload.http` file located on the root directory, then click on the `Send Request` button.
220235
This will send a request to the uploader function to upload an audio file to the audio's storage account:
221236

@@ -229,6 +244,26 @@ The following sample audio files are provided in the workshop, so feel free to r
229244
- [Azure Functions](assets/audios/AzureFunctions.wav)
230245
- [Microsoft AI](assets/audios/MicrosoftAI.wav)
231246

247+
Go back to the Storage Account and check the `audios` container. You should see the files that you uploaded with your `AudioUpload` Azure Function!
248+
249+
## Option 2: Upload with Postman
250+
251+
Using [Postman][postman], first go to the Azure Function and inside the function starting with `func-std-`, select `Functions` then `AudioUpload` and select the `Get Function Url` with the `default (function key)`.
252+
253+
![Azure Function url credentials](assets/func-url-credentials.png)
254+
255+
Use this url with Postman to upload the audio file.
256+
257+
You can use the provided sample audio files to test the function:
258+
259+
- [Azure Functions](assets/audios/AzureFunctions.wav)
260+
- [Microsoft AI](assets/audios/MicrosoftAI.wav)
261+
262+
Create a POST request and in the row where you set the key to `audio` for instance then, make sure to select the `file` option in the hidden dropdown menu to be able to select a file in the value field:
263+
264+
![Postman](assets/func-postman.png)
265+
266+
Go back to the Storage Account and check the `audios` container. You should see the files that you uploaded with your `AudioUpload` Azure Function!
232267

233268
## Managed identities and RBAC
234269

solutions/processor/Processor.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
</PropertyGroup>
1010
<ItemGroup>
1111
<FrameworkReference Include="Microsoft.AspNetCore.App" />
12-
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.21.0" />
13-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.9.0" />
14-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.0.0" />
15-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
16-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.2.0" />
12+
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
13+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.11.0" />
14+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.7" />
15+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
16+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
1717
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenAI" Version="0.17.0-alpha" />
1818
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.0" />
19-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.0" />
19+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
2020
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
21-
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
21+
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
2222
</ItemGroup>
2323
<ItemGroup>
2424
<None Update="host.json">

solutions/processor/host.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{
22
"version": "2.0",
33
"logging": {
4+
"fileLoggingMode": "debugOnly",
5+
"logLevel": {
6+
"default": "Information",
7+
"Host.Aggregator": "Information",
8+
"Host.Results": "Information",
9+
"Function": "Information"
10+
},
411
"applicationInsights": {
512
"samplingSettings": {
613
"isEnabled": true,
@@ -9,4 +16,4 @@
916
"enableLiveMetricsFilters": true
1017
}
1118
}
12-
}
19+
}

solutions/uploader/Uploader.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
</PropertyGroup>
1010
<ItemGroup>
1111
<FrameworkReference Include="Microsoft.AspNetCore.App" />
12-
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.21.0" />
13-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.9.0" />
14-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
15-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.2.1" />
12+
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
13+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.11.0" />
14+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
15+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
1616
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.0" />
17-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.0" />
17+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
1818
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
19-
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
19+
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
2020
</ItemGroup>
2121
<ItemGroup>
2222
<None Update="host.json">

solutions/uploader/host.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{
22
"version": "2.0",
33
"logging": {
4+
"fileLoggingMode": "debugOnly",
5+
"logLevel": {
6+
"default": "Information",
7+
"Host.Aggregator": "Information",
8+
"Host.Results": "Information",
9+
"Function": "Information"
10+
},
411
"applicationInsights": {
512
"samplingSettings": {
613
"isEnabled": true,

src/processor/AudioTranscriptionOrchestration.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ public static async Task<string> CheckTranscriptionStatus([ActivityTrigger] Audi
144144

145145
[Function(nameof(EnrichTranscription))]
146146
public static AudioTranscription EnrichTranscription(
147-
[ActivityTrigger] AudioTranscription audioTranscription, FunctionContext executionContext,
148-
[TextCompletionInput("Summarize {Result}", Model = "%CHAT_MODEL_DEPLOYMENT_NAME%")] TextCompletionResponse response
147+
[ActivityTrigger] AudioTranscription audioTranscription, FunctionContext executionContext
149148
)
150149
{
151150
// TO UPDATE

src/processor/Processor.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
</PropertyGroup>
1010
<ItemGroup>
1111
<FrameworkReference Include="Microsoft.AspNetCore.App" />
12-
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.21.0" />
13-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.9.0" />
14-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.0.0" />
15-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
16-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.2.0" />
12+
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
13+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.11.0" />
14+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.7" />
15+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
16+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
1717
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenAI" Version="0.17.0-alpha" />
1818
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.0" />
19-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.0" />
19+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
2020
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
21-
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
21+
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
2222
</ItemGroup>
2323
<ItemGroup>
2424
<None Update="host.json">

src/processor/Program.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
using Microsoft.Azure.Functions.Worker;
22
using Microsoft.Extensions.Hosting;
33
using Microsoft.Extensions.DependencyInjection;
4+
using Microsoft.Extensions.Logging;
5+
using Microsoft.Extensions.Configuration;
46

57
var host = new HostBuilder()
68
.ConfigureFunctionsWebApplication()
79
.ConfigureServices(services => {
810
services.AddApplicationInsightsTelemetryWorkerService();
911
services.ConfigureFunctionsApplicationInsights();
12+
services.Configure<LoggerFilterOptions>(options =>
13+
{
14+
LoggerFilterRule toRemove = options.Rules.FirstOrDefault(rule => rule.ProviderName
15+
== "Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider");
16+
17+
if (toRemove is not null)
18+
{
19+
options.Rules.Remove(toRemove);
20+
}
21+
});
22+
})
23+
.ConfigureAppConfiguration((hostContext, config) =>
24+
{
25+
config.AddJsonFile("host.json", optional: true);
26+
})
27+
.ConfigureLogging((hostingContext, logging) =>
28+
{
29+
logging.AddApplicationInsights(console =>
30+
{
31+
console.IncludeScopes = true;
32+
});
33+
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
1034
})
1135
.Build();
1236

13-
host.Run();
37+
host.Run();

src/processor/host.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{
22
"version": "2.0",
33
"logging": {
4+
"fileLoggingMode": "debugOnly",
5+
"logLevel": {
6+
"default": "Information",
7+
"Host.Aggregator": "Information",
8+
"Host.Results": "Information",
9+
"Function": "Information"
10+
},
411
"applicationInsights": {
512
"samplingSettings": {
613
"isEnabled": true,
@@ -9,4 +16,4 @@
916
"enableLiveMetricsFilters": true
1017
}
1118
}
12-
}
19+
}

src/uploader/Program.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,37 @@
11
using Microsoft.Azure.Functions.Worker;
22
using Microsoft.Extensions.Hosting;
33
using Microsoft.Extensions.DependencyInjection;
4+
using Microsoft.Extensions.Logging;
5+
using Microsoft.Extensions.Configuration;
46

57
var host = new HostBuilder()
68
.ConfigureFunctionsWebApplication()
79
.ConfigureServices(services => {
810
services.AddApplicationInsightsTelemetryWorkerService();
911
services.ConfigureFunctionsApplicationInsights();
12+
services.Configure<LoggerFilterOptions>(options =>
13+
{
14+
LoggerFilterRule toRemove = options.Rules.FirstOrDefault(rule => rule.ProviderName
15+
== "Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider");
16+
17+
if (toRemove is not null)
18+
{
19+
options.Rules.Remove(toRemove);
20+
}
21+
});
22+
})
23+
.ConfigureAppConfiguration((hostContext, config) =>
24+
{
25+
config.AddJsonFile("host.json", optional: true);
26+
})
27+
.ConfigureLogging((hostingContext, logging) =>
28+
{
29+
logging.AddApplicationInsights(console =>
30+
{
31+
console.IncludeScopes = true;
32+
});
33+
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
1034
})
1135
.Build();
1236

13-
host.Run();
37+
host.Run();

0 commit comments

Comments
 (0)