Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@
#if NET9_0_OR_GREATER

using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Diagnostics.Buffering;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Diagnostics.Buffering;
using Microsoft.Extensions.Options;
using Microsoft.Shared.DiagnosticIds;
using Microsoft.Shared.Diagnostics;

namespace Microsoft.Extensions.Logging;

/// <summary>
/// Lets you register per incoming request log buffering in a dependency injection container.
/// </summary>
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
public static class PerIncomingRequestLoggingBuilderExtensions
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Diagnostics.Buffering;
using Microsoft.Shared.Data.Validation;
using Microsoft.Shared.DiagnosticIds;

namespace Microsoft.AspNetCore.Diagnostics.Buffering;

/// <summary>
/// The options for log buffering per each incoming request.
/// </summary>
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
public class PerRequestLogBufferingOptions
{
private const int DefaultPerRequestBufferSizeInBytes = 500 * 1024 * 1024; // 500 MB.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
<Description>ASP.NET Core middleware for collecting high-quality telemetry.</Description>
<PackageTags>$(PackageTags);aspnetcore</PackageTags>
<Workstream>Telemetry</Workstream>
<!-- disable "Published symbols cannot be deleted to maintain compatibility" because we have different APIs for different TFMs -->
<NoWarn Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))">$(NoWarn);LA0006</NoWarn>
</PropertyGroup>

<PropertyGroup>
<TargetFrameworks>$(NetCoreTargetFrameworks)</TargetFrameworks>
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
<UseLoggingGenerator>true</UseLoggingGenerator>
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
<InjectSharedDebugger>true</InjectSharedDebugger>
<InjectSharedDataValidation>false</InjectSharedDataValidation>
<InjectSharedPools>false</InjectSharedPools>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Name": "Microsoft.AspNetCore.Diagnostics.Middleware, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
"Name": "Microsoft.AspNetCore.Diagnostics.Middleware, Version=9.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
"Types": [
{
"Type": "static class Microsoft.Extensions.DependencyInjection.HttpLoggingServiceCollectionExtensions",
Expand Down Expand Up @@ -122,6 +122,10 @@
"Member": "System.Collections.Generic.ISet<string> Microsoft.AspNetCore.Diagnostics.Logging.LoggingRedactionOptions.ExcludePathStartsWith { get; set; }",
"Stage": "Experimental"
},
{
"Member": "bool Microsoft.AspNetCore.Diagnostics.Logging.LoggingRedactionOptions.IncludeUnmatchedRoutes { get; set; }",
"Stage": "Experimental"
},
{
"Member": "System.Collections.Generic.IDictionary<string, Microsoft.Extensions.Compliance.Classification.DataClassification> Microsoft.AspNetCore.Diagnostics.Logging.LoggingRedactionOptions.RequestHeadersDataClasses { get; set; }",
"Stage": "Experimental"
Expand All @@ -144,6 +148,52 @@
}
]
},
{
"Type": "static class Microsoft.Extensions.Logging.PerIncomingRequestLoggingBuilderExtensions",
"Stage": "Stable",
"Methods": [
{
"Member": "static Microsoft.Extensions.Logging.ILoggingBuilder Microsoft.Extensions.Logging.PerIncomingRequestLoggingBuilderExtensions.AddPerIncomingRequestBuffer(this Microsoft.Extensions.Logging.ILoggingBuilder builder, Microsoft.Extensions.Configuration.IConfiguration configuration);",
"Stage": "Stable"
},
{
"Member": "static Microsoft.Extensions.Logging.ILoggingBuilder Microsoft.Extensions.Logging.PerIncomingRequestLoggingBuilderExtensions.AddPerIncomingRequestBuffer(this Microsoft.Extensions.Logging.ILoggingBuilder builder, System.Action<Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions> configure);",
"Stage": "Stable"
},
{
"Member": "static Microsoft.Extensions.Logging.ILoggingBuilder Microsoft.Extensions.Logging.PerIncomingRequestLoggingBuilderExtensions.AddPerIncomingRequestBuffer(this Microsoft.Extensions.Logging.ILoggingBuilder builder, Microsoft.Extensions.Logging.LogLevel? logLevel = null);",
"Stage": "Stable"
}
]
},
{
"Type": "class Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions",
"Stage": "Stable",
"Methods": [
{
"Member": "Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions.PerRequestLogBufferingOptions();",
"Stage": "Stable"
}
],
"Properties": [
{
"Member": "System.TimeSpan Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions.AutoFlushDuration { get; set; }",
"Stage": "Stable"
},
{
"Member": "int Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions.MaxLogRecordSizeInBytes { get; set; }",
"Stage": "Stable"
},
{
"Member": "int Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions.MaxPerRequestBufferSizeInBytes { get; set; }",
"Stage": "Stable"
},
{
"Member": "System.Collections.Generic.IList<Microsoft.Extensions.Diagnostics.Buffering.LogBufferingFilterRule> Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions.Rules { get; set; }",
"Stage": "Stable"
}
]
},
{
"Type": "static class Microsoft.AspNetCore.Diagnostics.Latency.RequestCheckpointConstants",
"Stage": "Stable",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#if NET9_0_OR_GREATER

using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Shared.DiagnosticIds;

namespace Microsoft.Extensions.Diagnostics.Buffering;

/// <summary>
/// Buffers logs into circular buffers and drops them after some time if not flushed.
/// </summary>
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
#pragma warning disable S1694 // An abstract class should have both abstract and concrete methods
public abstract class LogBuffer
#pragma warning restore S1694 // An abstract class should have both abstract and concrete methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<RootNamespace>Microsoft.Extensions.Telemetry</RootNamespace>
<Description>Common abstractions for high-level telemetry primitives.</Description>
<Workstream>Telemetry</Workstream>
<!-- disable "Published symbols cannot be deleted to maintain compatibility" because we have different APIs for different TFMs -->
<NoWarn Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))">$(NoWarn);LA0006</NoWarn>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Name": "Microsoft.Extensions.Telemetry.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
"Name": "Microsoft.Extensions.Telemetry.Abstractions, Version=9.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
"Types": [
{
"Type": "readonly struct Microsoft.Extensions.Diagnostics.Latency.Checkpoint : System.IEquatable<Microsoft.Extensions.Diagnostics.Latency.Checkpoint>",
Expand Down Expand Up @@ -179,6 +179,16 @@
}
]
},
{
"Type": "abstract class Microsoft.Extensions.Diagnostics.Buffering.GlobalLogBuffer : Microsoft.Extensions.Diagnostics.Buffering.LogBuffer",
"Stage": "Stable",
"Methods": [
{
"Member": "Microsoft.Extensions.Diagnostics.Buffering.GlobalLogBuffer.GlobalLogBuffer();",
"Stage": "Stable"
}
]
},
{
"Type": "sealed class Microsoft.Extensions.Diagnostics.Metrics.HistogramAttribute : System.Attribute",
"Stage": "Stable",
Expand Down Expand Up @@ -488,6 +498,24 @@
}
]
},
{
"Type": "abstract class Microsoft.Extensions.Diagnostics.Buffering.LogBuffer",
"Stage": "Stable",
"Methods": [
{
"Member": "Microsoft.Extensions.Diagnostics.Buffering.LogBuffer.LogBuffer();",
"Stage": "Stable"
},
{
"Member": "abstract void Microsoft.Extensions.Diagnostics.Buffering.LogBuffer.Flush();",
"Stage": "Stable"
},
{
"Member": "abstract bool Microsoft.Extensions.Diagnostics.Buffering.LogBuffer.TryEnqueue<TState>(Microsoft.Extensions.Logging.Abstractions.IBufferedLogger bufferedLogger, in Microsoft.Extensions.Logging.Abstractions.LogEntry<TState> logEntry);",
"Stage": "Stable"
}
]
},
{
"Type": "static class Microsoft.Extensions.Logging.LoggerMessageHelper",
"Stage": "Stable",
Expand Down Expand Up @@ -600,6 +628,20 @@
}
]
},
{
"Type": "abstract class Microsoft.Extensions.Logging.LoggingSampler",
"Stage": "Stable",
"Methods": [
{
"Member": "Microsoft.Extensions.Logging.LoggingSampler.LoggingSampler();",
"Stage": "Stable"
},
{
"Member": "abstract bool Microsoft.Extensions.Logging.LoggingSampler.ShouldSample<TState>(in Microsoft.Extensions.Logging.Abstractions.LogEntry<TState> logEntry);",
"Stage": "Stable"
}
]
},
{
"Type": "sealed class Microsoft.Extensions.Logging.LogPropertiesAttribute : System.Attribute",
"Stage": "Stable",
Expand All @@ -617,6 +659,10 @@
{
"Member": "bool Microsoft.Extensions.Logging.LogPropertiesAttribute.SkipNullProperties { get; set; }",
"Stage": "Stable"
},
{
"Member": "bool Microsoft.Extensions.Logging.LogPropertiesAttribute.Transitive { get; set; }",
"Stage": "Experimental"
}
]
},
Expand Down Expand Up @@ -708,6 +754,16 @@
}
]
},
{
"Type": "abstract class Microsoft.Extensions.Diagnostics.Buffering.PerRequestLogBuffer : Microsoft.Extensions.Diagnostics.Buffering.LogBuffer",
"Stage": "Stable",
"Methods": [
{
"Member": "Microsoft.Extensions.Diagnostics.Buffering.PerRequestLogBuffer.PerRequestLogBuffer();",
"Stage": "Stable"
}
]
},
{
"Type": "class Microsoft.Extensions.Http.Diagnostics.RequestMetadata",
"Stage": "Stable",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Shared.DiagnosticIds;

namespace Microsoft.Extensions.Logging;

/// <summary>
/// Controls the number of samples of log records collected and sent to the backend.
/// </summary>
#pragma warning disable S1694 // An abstract class should have both abstract and concrete methods
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
public abstract class LoggingSampler
#pragma warning restore S1694 // An abstract class should have both abstract and concrete methods
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@
#if NET9_0_OR_GREATER

using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Diagnostics.Buffering;
using Microsoft.Extensions.Options;
using Microsoft.Shared.DiagnosticIds;
using Microsoft.Shared.Diagnostics;

namespace Microsoft.Extensions.Logging;

/// <summary>
/// Lets you register log buffering in a dependency injection container.
/// </summary>
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
public static class GlobalBufferLoggingBuilderExtensions
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Shared.Data.Validation;
using Microsoft.Shared.DiagnosticIds;

namespace Microsoft.Extensions.Diagnostics.Buffering;

/// <summary>
/// The options for global log buffering.
/// </summary>
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
public class GlobalLogBufferingOptions
{
private const int DefaultMaxBufferSizeInBytes = 500 * 1024 * 1024; // 500 MB.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
#if NET9_0_OR_GREATER

using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Logging;
using Microsoft.Shared.DiagnosticIds;

namespace Microsoft.Extensions.Diagnostics.Buffering;

Expand All @@ -17,7 +15,6 @@ namespace Microsoft.Extensions.Diagnostics.Buffering;
/// If a log entry does not match any rule, it will be emitted normally.
/// If the buffer size limit is reached, the oldest buffered log entries will be dropped (not emitted!) to make room for new ones.
/// </remarks>
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
public class LogBufferingFilterRule
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<RootNamespace>Microsoft.Extensions.Diagnostics</RootNamespace>
<Description>Provides canonical implementations of telemetry abstractions.</Description>
<Workstream>Telemetry</Workstream>
<!-- disable "Published symbols cannot be deleted to maintain compatibility" because we have different APIs for different TFMs -->
<NoWarn Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))">$(NoWarn);LA0006</NoWarn>
</PropertyGroup>

<PropertyGroup>
Expand Down
Loading
Loading