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

(0.8.2) Update logging settings/configs #1810

Open
wants to merge 9 commits into
base: release/0.8.2
Choose a base branch
from
Open
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
18 changes: 11 additions & 7 deletions src/dotnet/AuthorizationAPI/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"Logging": {
"LogLevel": {
"Default": "Warning"
},
"OpenTelemetry": {
"LogLevel": {
"Default": "Warning"
}
}
},
"AllowedHosts": "*"
}
3 changes: 2 additions & 1 deletion src/dotnet/Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<PackageReference Include="Azure.Data.AppConfiguration" Version="1.4.0" />
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Azure.Messaging.EventGrid" Version="4.22.0-beta.1" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.1.0" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.AspNetCore" Version="1.2.0" />
<PackageReference Include="Azure.ResourceManager.CognitiveServices" Version="1.3.2" />
<PackageReference Include="Azure.ResourceManager.EventGrid" Version="1.1.0-beta.4" />
<PackageReference Include="Azure.Search.Documents" Version="11.5.1" />
Expand All @@ -68,6 +68,7 @@
<PackageReference Include="Asp.Versioning.Http" Version="8.1.0" />
<PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.4" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.4.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
Expand Down
9 changes: 9 additions & 0 deletions src/dotnet/Common/Constants/Data/AppConfiguration.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@
}
]
},
{
"namespace": "Logging",
"dependency_injection_key": null,
"configuration_section": {
"description": "Configuration section used to configure logging for the FoundationaLLM services."
},
"configuration_keys": [
]
},
{
"namespace": "Configuration",
"dependency_injection_key": null,
Expand Down
79 changes: 79 additions & 0 deletions src/dotnet/Common/Logging/ActivitySources.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using FoundationaLLM.Common.Constants;
using System.Diagnostics;

namespace FoundationaLLM.Common.Logging
{
/// <summary>
/// All ActivitySources for the FoundationaLLM services. This is a central place to define all ActivitySources.
/// </summary>
public class ActivitySources
{
/// <summary>
/// AgentHubAPI ActivitySource.
/// </summary>
public static readonly ActivitySource AgentHubAPIActivitySource = new(ServiceNames.AgentHubAPI);

/// <summary>
/// CoreAPI ActivitySource.
/// </summary>
public static readonly ActivitySource CoreAPIActivitySource = new(ServiceNames.CoreAPI);

/// <summary>
/// GatekeeperAPI ActivitySource.
/// </summary>
public static readonly ActivitySource GatekeeperAPIActivitySource = new(ServiceNames.GatekeeperAPI);

/// <summary>
/// GatewayAdapterAPI ActivitySource.
/// </summary>
public static readonly ActivitySource GatewayAdapterAPIActivitySource = new(ServiceNames.GatewayAdapterAPI);

/// <summary>
/// ManagementAPI ActivitySource.
/// </summary>
public static readonly ActivitySource ManagementAPIActivitySource = new(ServiceNames.ManagementAPI);

/// <summary>
/// OrchestrationAPI ActivitySource.
/// </summary>
public static readonly ActivitySource OrchestrationAPIActivitySource = new(ServiceNames.OrchestrationAPI);

/// <summary>
/// SemanticKernelAPI ActivitySource.
/// </summary>
public static readonly ActivitySource SemanticKernelAPIActivitySource = new(ServiceNames.SemanticKernelAPI);

/// <summary>
/// StateAPI ActivitySource.
/// </summary>
public static readonly ActivitySource StateAPIActivitySource = new(ServiceNames.StateAPI);

/// <summary>
/// VectorizationAPI ActivitySource.
/// </summary>
public static readonly ActivitySource VectorizationAPIActivitySource = new(ServiceNames.VectorizationAPI);

/// <summary>
/// Start an activity with the given name and source. If addBaggage is true, the baggage from the parent activity will be added to the new activity.
/// </summary>
/// <param name="name"></param>
/// <param name="source"></param>
/// <param name="kind"></param>
/// <param name="addBaggage"></param>
/// <returns></returns>
public static Activity StartActivity(string name, ActivitySource source, ActivityKind kind = System.Diagnostics.ActivityKind.Consumer, bool addBaggage = true)
{
var activity = source.StartActivity(name, kind);

if (addBaggage && activity != null)
{
foreach (var bag in activity?.Parent?.Baggage)
{
activity?.AddTag(bag.Key, bag.Value);
}
}

return activity;
}
}
}
2 changes: 1 addition & 1 deletion src/dotnet/Common/Services/Azure/AzureCosmosDBService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public async Task DeleteSessionAndMessagesAsync(string sessionId, CancellationTo

var response = _sessions.GetItemQueryIterator<dynamic>(query);

Console.WriteLine($"Deleting {sessionId} session and related messages.");
_logger.LogInformation($"Deleting {sessionId} session and related messages.");

var batch = _sessions.CreateTransactionalBatch(partitionKey);
var count = 0;
Expand Down
Loading