Skip to content

Commit bb47e13

Browse files
Mark log sampling & buffering API as stable (#6534)
1 parent 8148872 commit bb47e13

16 files changed

+271
-34
lines changed

src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Buffering/PerIncomingRequestLoggingBuilderExtensions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,20 @@
33
#if NET9_0_OR_GREATER
44

55
using System;
6-
using System.Diagnostics.CodeAnalysis;
76
using Microsoft.AspNetCore.Diagnostics.Buffering;
87
using Microsoft.AspNetCore.Http;
98
using Microsoft.Extensions.Configuration;
109
using Microsoft.Extensions.DependencyInjection;
1110
using Microsoft.Extensions.DependencyInjection.Extensions;
1211
using Microsoft.Extensions.Diagnostics.Buffering;
1312
using Microsoft.Extensions.Options;
14-
using Microsoft.Shared.DiagnosticIds;
1513
using Microsoft.Shared.Diagnostics;
1614

1715
namespace Microsoft.Extensions.Logging;
1816

1917
/// <summary>
2018
/// Lets you register per incoming request log buffering in a dependency injection container.
2119
/// </summary>
22-
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
2320
public static class PerIncomingRequestLoggingBuilderExtensions
2421
{
2522
/// <summary>

src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Buffering/PerRequestLogBufferingOptions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,14 @@
55
using System;
66
using System.Collections.Generic;
77
using System.ComponentModel.DataAnnotations;
8-
using System.Diagnostics.CodeAnalysis;
98
using Microsoft.Extensions.Diagnostics.Buffering;
109
using Microsoft.Shared.Data.Validation;
11-
using Microsoft.Shared.DiagnosticIds;
1210

1311
namespace Microsoft.AspNetCore.Diagnostics.Buffering;
1412

1513
/// <summary>
1614
/// The options for log buffering per each incoming request.
1715
/// </summary>
18-
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
1916
public class PerRequestLogBufferingOptions
2017
{
2118
private const int DefaultPerRequestBufferSizeInBytes = 500 * 1024 * 1024; // 500 MB.

src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
<Description>ASP.NET Core middleware for collecting high-quality telemetry.</Description>
55
<PackageTags>$(PackageTags);aspnetcore</PackageTags>
66
<Workstream>Telemetry</Workstream>
7+
<!-- disable "Published symbols cannot be deleted to maintain compatibility" because we have different APIs for different TFMs -->
8+
<NoWarn Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))">$(NoWarn);LA0006</NoWarn>
79
</PropertyGroup>
810

911
<PropertyGroup>
1012
<TargetFrameworks>$(NetCoreTargetFrameworks)</TargetFrameworks>
1113
<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>
1214
<UseLoggingGenerator>true</UseLoggingGenerator>
13-
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
1415
<InjectSharedDebugger>true</InjectSharedDebugger>
1516
<InjectSharedDataValidation>false</InjectSharedDataValidation>
1617
<InjectSharedPools>false</InjectSharedPools>

src/Libraries/Microsoft.AspNetCore.Diagnostics.Middleware/Microsoft.AspNetCore.Diagnostics.Middleware.json

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Name": "Microsoft.AspNetCore.Diagnostics.Middleware, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
2+
"Name": "Microsoft.AspNetCore.Diagnostics.Middleware, Version=9.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
33
"Types": [
44
{
55
"Type": "static class Microsoft.Extensions.DependencyInjection.HttpLoggingServiceCollectionExtensions",
@@ -122,6 +122,10 @@
122122
"Member": "System.Collections.Generic.ISet<string> Microsoft.AspNetCore.Diagnostics.Logging.LoggingRedactionOptions.ExcludePathStartsWith { get; set; }",
123123
"Stage": "Experimental"
124124
},
125+
{
126+
"Member": "bool Microsoft.AspNetCore.Diagnostics.Logging.LoggingRedactionOptions.IncludeUnmatchedRoutes { get; set; }",
127+
"Stage": "Experimental"
128+
},
125129
{
126130
"Member": "System.Collections.Generic.IDictionary<string, Microsoft.Extensions.Compliance.Classification.DataClassification> Microsoft.AspNetCore.Diagnostics.Logging.LoggingRedactionOptions.RequestHeadersDataClasses { get; set; }",
127131
"Stage": "Experimental"
@@ -144,6 +148,52 @@
144148
}
145149
]
146150
},
151+
{
152+
"Type": "static class Microsoft.Extensions.Logging.PerIncomingRequestLoggingBuilderExtensions",
153+
"Stage": "Stable",
154+
"Methods": [
155+
{
156+
"Member": "static Microsoft.Extensions.Logging.ILoggingBuilder Microsoft.Extensions.Logging.PerIncomingRequestLoggingBuilderExtensions.AddPerIncomingRequestBuffer(this Microsoft.Extensions.Logging.ILoggingBuilder builder, Microsoft.Extensions.Configuration.IConfiguration configuration);",
157+
"Stage": "Stable"
158+
},
159+
{
160+
"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);",
161+
"Stage": "Stable"
162+
},
163+
{
164+
"Member": "static Microsoft.Extensions.Logging.ILoggingBuilder Microsoft.Extensions.Logging.PerIncomingRequestLoggingBuilderExtensions.AddPerIncomingRequestBuffer(this Microsoft.Extensions.Logging.ILoggingBuilder builder, Microsoft.Extensions.Logging.LogLevel? logLevel = null);",
165+
"Stage": "Stable"
166+
}
167+
]
168+
},
169+
{
170+
"Type": "class Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions",
171+
"Stage": "Stable",
172+
"Methods": [
173+
{
174+
"Member": "Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions.PerRequestLogBufferingOptions();",
175+
"Stage": "Stable"
176+
}
177+
],
178+
"Properties": [
179+
{
180+
"Member": "System.TimeSpan Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions.AutoFlushDuration { get; set; }",
181+
"Stage": "Stable"
182+
},
183+
{
184+
"Member": "int Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions.MaxLogRecordSizeInBytes { get; set; }",
185+
"Stage": "Stable"
186+
},
187+
{
188+
"Member": "int Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions.MaxPerRequestBufferSizeInBytes { get; set; }",
189+
"Stage": "Stable"
190+
},
191+
{
192+
"Member": "System.Collections.Generic.IList<Microsoft.Extensions.Diagnostics.Buffering.LogBufferingFilterRule> Microsoft.AspNetCore.Diagnostics.Buffering.PerRequestLogBufferingOptions.Rules { get; set; }",
193+
"Stage": "Stable"
194+
}
195+
]
196+
},
147197
{
148198
"Type": "static class Microsoft.AspNetCore.Diagnostics.Latency.RequestCheckpointConstants",
149199
"Stage": "Stable",

src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Buffering/LogBuffer.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
#if NET9_0_OR_GREATER
4-
5-
using System.Diagnostics.CodeAnalysis;
64
using Microsoft.Extensions.Logging.Abstractions;
7-
using Microsoft.Shared.DiagnosticIds;
85

96
namespace Microsoft.Extensions.Diagnostics.Buffering;
107

118
/// <summary>
129
/// Buffers logs into circular buffers and drops them after some time if not flushed.
1310
/// </summary>
14-
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
1511
#pragma warning disable S1694 // An abstract class should have both abstract and concrete methods
1612
public abstract class LogBuffer
1713
#pragma warning restore S1694 // An abstract class should have both abstract and concrete methods

src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Microsoft.Extensions.Telemetry.Abstractions.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<RootNamespace>Microsoft.Extensions.Telemetry</RootNamespace>
44
<Description>Common abstractions for high-level telemetry primitives.</Description>
55
<Workstream>Telemetry</Workstream>
6+
<!-- disable "Published symbols cannot be deleted to maintain compatibility" because we have different APIs for different TFMs -->
7+
<NoWarn Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net9.0'))">$(NoWarn);LA0006</NoWarn>
68
</PropertyGroup>
79

810
<PropertyGroup>

src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Microsoft.Extensions.Telemetry.Abstractions.json

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Name": "Microsoft.Extensions.Telemetry.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
2+
"Name": "Microsoft.Extensions.Telemetry.Abstractions, Version=9.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
33
"Types": [
44
{
55
"Type": "readonly struct Microsoft.Extensions.Diagnostics.Latency.Checkpoint : System.IEquatable<Microsoft.Extensions.Diagnostics.Latency.Checkpoint>",
@@ -179,6 +179,16 @@
179179
}
180180
]
181181
},
182+
{
183+
"Type": "abstract class Microsoft.Extensions.Diagnostics.Buffering.GlobalLogBuffer : Microsoft.Extensions.Diagnostics.Buffering.LogBuffer",
184+
"Stage": "Stable",
185+
"Methods": [
186+
{
187+
"Member": "Microsoft.Extensions.Diagnostics.Buffering.GlobalLogBuffer.GlobalLogBuffer();",
188+
"Stage": "Stable"
189+
}
190+
]
191+
},
182192
{
183193
"Type": "sealed class Microsoft.Extensions.Diagnostics.Metrics.HistogramAttribute : System.Attribute",
184194
"Stage": "Stable",
@@ -488,6 +498,24 @@
488498
}
489499
]
490500
},
501+
{
502+
"Type": "abstract class Microsoft.Extensions.Diagnostics.Buffering.LogBuffer",
503+
"Stage": "Stable",
504+
"Methods": [
505+
{
506+
"Member": "Microsoft.Extensions.Diagnostics.Buffering.LogBuffer.LogBuffer();",
507+
"Stage": "Stable"
508+
},
509+
{
510+
"Member": "abstract void Microsoft.Extensions.Diagnostics.Buffering.LogBuffer.Flush();",
511+
"Stage": "Stable"
512+
},
513+
{
514+
"Member": "abstract bool Microsoft.Extensions.Diagnostics.Buffering.LogBuffer.TryEnqueue<TState>(Microsoft.Extensions.Logging.Abstractions.IBufferedLogger bufferedLogger, in Microsoft.Extensions.Logging.Abstractions.LogEntry<TState> logEntry);",
515+
"Stage": "Stable"
516+
}
517+
]
518+
},
491519
{
492520
"Type": "static class Microsoft.Extensions.Logging.LoggerMessageHelper",
493521
"Stage": "Stable",
@@ -600,6 +628,20 @@
600628
}
601629
]
602630
},
631+
{
632+
"Type": "abstract class Microsoft.Extensions.Logging.LoggingSampler",
633+
"Stage": "Stable",
634+
"Methods": [
635+
{
636+
"Member": "Microsoft.Extensions.Logging.LoggingSampler.LoggingSampler();",
637+
"Stage": "Stable"
638+
},
639+
{
640+
"Member": "abstract bool Microsoft.Extensions.Logging.LoggingSampler.ShouldSample<TState>(in Microsoft.Extensions.Logging.Abstractions.LogEntry<TState> logEntry);",
641+
"Stage": "Stable"
642+
}
643+
]
644+
},
603645
{
604646
"Type": "sealed class Microsoft.Extensions.Logging.LogPropertiesAttribute : System.Attribute",
605647
"Stage": "Stable",
@@ -617,6 +659,10 @@
617659
{
618660
"Member": "bool Microsoft.Extensions.Logging.LogPropertiesAttribute.SkipNullProperties { get; set; }",
619661
"Stage": "Stable"
662+
},
663+
{
664+
"Member": "bool Microsoft.Extensions.Logging.LogPropertiesAttribute.Transitive { get; set; }",
665+
"Stage": "Experimental"
620666
}
621667
]
622668
},
@@ -708,6 +754,16 @@
708754
}
709755
]
710756
},
757+
{
758+
"Type": "abstract class Microsoft.Extensions.Diagnostics.Buffering.PerRequestLogBuffer : Microsoft.Extensions.Diagnostics.Buffering.LogBuffer",
759+
"Stage": "Stable",
760+
"Methods": [
761+
{
762+
"Member": "Microsoft.Extensions.Diagnostics.Buffering.PerRequestLogBuffer.PerRequestLogBuffer();",
763+
"Stage": "Stable"
764+
}
765+
]
766+
},
711767
{
712768
"Type": "class Microsoft.Extensions.Http.Diagnostics.RequestMetadata",
713769
"Stage": "Stable",

src/Libraries/Microsoft.Extensions.Telemetry.Abstractions/Sampling/LoggingSampler.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System.Diagnostics.CodeAnalysis;
54
using Microsoft.Extensions.Logging.Abstractions;
6-
using Microsoft.Shared.DiagnosticIds;
75

86
namespace Microsoft.Extensions.Logging;
97

108
/// <summary>
119
/// Controls the number of samples of log records collected and sent to the backend.
1210
/// </summary>
1311
#pragma warning disable S1694 // An abstract class should have both abstract and concrete methods
14-
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
1512
public abstract class LoggingSampler
1613
#pragma warning restore S1694 // An abstract class should have both abstract and concrete methods
1714
{

src/Libraries/Microsoft.Extensions.Telemetry/Buffering/GlobalBufferLoggingBuilderExtensions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@
33
#if NET9_0_OR_GREATER
44

55
using System;
6-
using System.Diagnostics.CodeAnalysis;
76
using Microsoft.Extensions.Configuration;
87
using Microsoft.Extensions.DependencyInjection;
98
using Microsoft.Extensions.DependencyInjection.Extensions;
109
using Microsoft.Extensions.Diagnostics.Buffering;
1110
using Microsoft.Extensions.Options;
12-
using Microsoft.Shared.DiagnosticIds;
1311
using Microsoft.Shared.Diagnostics;
1412

1513
namespace Microsoft.Extensions.Logging;
1614

1715
/// <summary>
1816
/// Lets you register log buffering in a dependency injection container.
1917
/// </summary>
20-
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
2118
public static class GlobalBufferLoggingBuilderExtensions
2219
{
2320
/// <summary>

src/Libraries/Microsoft.Extensions.Telemetry/Buffering/GlobalLogBufferingOptions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@
55
using System;
66
using System.Collections.Generic;
77
using System.ComponentModel.DataAnnotations;
8-
using System.Diagnostics.CodeAnalysis;
98
using Microsoft.Shared.Data.Validation;
10-
using Microsoft.Shared.DiagnosticIds;
119

1210
namespace Microsoft.Extensions.Diagnostics.Buffering;
1311

1412
/// <summary>
1513
/// The options for global log buffering.
1614
/// </summary>
17-
[Experimental(diagnosticId: DiagnosticIds.Experiments.Telemetry, UrlFormat = DiagnosticIds.UrlFormat)]
1815
public class GlobalLogBufferingOptions
1916
{
2017
private const int DefaultMaxBufferSizeInBytes = 500 * 1024 * 1024; // 500 MB.

0 commit comments

Comments
 (0)