File tree Expand file tree Collapse file tree 4 files changed +11
-4
lines changed
McpAgentWorkshop.ServiceDefaults
McpAgentWorkshop.WorkshopApi Expand file tree Collapse file tree 4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -96,8 +96,8 @@ if [ -f "$CSHARP_PROJECT_PATH" ]; then
9696 dotnet user-secrets set " Parameters:ResourceGroupName" " $RESOURCE_GROUP_NAME " --project " $CSHARP_PROJECT_PATH "
9797 dotnet user-secrets set " Parameters:ApplicationInsightsName" " $APPLICATION_INSIGHTS_NAME " --project " $CSHARP_PROJECT_PATH "
9898 dotnet user-secrets set " Azure:ResourceGroup" " $RESOURCE_GROUP_NAME " --project " $CSHARP_PROJECT_PATH "
99- dotnet user-secrets set " Azure:Location" " $AZURE_LOCATION " --project " $CSHARP_PROJECT_PATH "
100- dotnet user-secrets set " Azure:SubscriptionId" " $AZURE_SUBSCRIPTION_ID " --project " $CSHARP_PROJECT_PATH "
99+ dotnet user-secrets set " Azure:Location" " $RG_LOCATION " --project " $CSHARP_PROJECT_PATH "
100+ dotnet user-secrets set " Azure:SubscriptionId" " $SUBSCRIPTION_ID " --project " $CSHARP_PROJECT_PATH "
101101 dotnet user-secrets set " Parameters:UniqueSuffix" " $UNIQUE_SUFFIX " --project " $CSHARP_PROJECT_PATH "
102102fi
103103
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ public static TBuilder ConfigureOpenTelemetry<TBuilder>(this TBuilder builder) w
6363 . AddHttpClientInstrumentation ( )
6464 . AddRuntimeInstrumentation ( )
6565 . AddMeter ( "Experimental.ModelContextProtocol" )
66+ . AddMeter ( "McpAgentWorkshop.WorkshopApi" )
6667 . AddMeter ( "McpAgentWorkshop.McpServer" )
6768 . AddMeter ( "Experimental.Microsoft.Extensions.AI" )
6869 . AddMeter ( "Azure.AI.Agents.Persistent.PersistentAgentsClient" ) ;
@@ -80,6 +81,7 @@ public static TBuilder ConfigureOpenTelemetry<TBuilder>(this TBuilder builder) w
8081 //.AddGrpcClientInstrumentation()
8182 . AddHttpClientInstrumentation ( )
8283 . AddSource ( "Experimental.ModelContextProtocol" )
84+ . AddSource ( "McpAgentWorkshop.WorkshopApi" )
8385 . AddSource ( "McpAgentWorkshop.McpServer" )
8486 . AddSource ( "Experimental.Microsoft.Extensions.AI" )
8587 . AddSource ( "Azure.AI.Agents.Persistent.PersistentAgentsClient" ) ;
Original file line number Diff line number Diff line change 11using System . ClientModel ;
2+ using System . Diagnostics ;
23using System . Runtime . CompilerServices ;
34using Azure . AI . Agents . Persistent ;
45using McpAgentWorkshop . WorkshopApi . Models ;
@@ -18,6 +19,8 @@ public partial class AgentService(
1819
1920 public async Task InitialiseAgentAsync ( )
2021 {
22+ using var activity = Diagnostics . ActivitySource . StartActivity ( name : "Zava Agent Initialization" ) ;
23+
2124 logger . LogInformation ( "Creating new agent: {AgentName}" , AgentName ) ;
2225
2326 var instructions = Path . Combine ( sharedPath , "instructions" , InstructionsFile ) ;
@@ -82,7 +85,7 @@ public async IAsyncEnumerable<ChatResponse> ProcessChatMessageAsync(ChatRequest
8285 request . Message ;
8386 var spanName = $ "Zava Agent Chat Request: { messagePreview } ";
8487
85- using var activity = Diagnostics . ActivitySource . StartActivity ( spanName ) ;
88+ using var activity = Diagnostics . ActivitySource . StartActivity ( spanName , ActivityKind . Server ) ;
8689
8790 PersistentAgentThread sessionThread ;
8891 AsyncCollectionResult < StreamingUpdate > ? runStream = null ;
Original file line number Diff line number Diff line change 4747 return fileInfo is not null ? TypedResults . File ( fileInfo ) : Results . NotFound ( ) ;
4848} ) ;
4949
50+ await app . StartAsync ( ) ;
51+
5052var agentService = app . Services . GetRequiredService < AgentService > ( ) ;
5153await agentService . InitialiseAgentAsync ( ) ;
5254
53- app . Run ( ) ;
55+ await app . WaitForShutdownAsync ( ) ;
You can’t perform that action at this time.
0 commit comments