From 026a4f9f174a49bf4b3a60daab53bc42c882a864 Mon Sep 17 00:00:00 2001 From: Meir Blachman Date: Mon, 25 Aug 2025 12:36:53 +0300 Subject: [PATCH 1/6] chore: Refactors metrics instrumentation to use dependency injection - ApplicationRequestInstruments Converts static ApplicationRequestInstruments to instance-based implementation that receives OrleansInstruments through constructor injection. Introduces OrleansInstruments as a new service that wraps meter creation functionality and registers it in both client and silo service containers. Updates CallbackData constructors to accept ApplicationRequestInstruments parameter, enabling proper dependency injection throughout the request lifecycle. Improves testability and follows dependency injection patterns consistently across the Orleans runtime. --- .../Core/DefaultClientServices.cs | 1 + .../Metrics/ApplicationRequestInstruments.cs | 41 +++++++++++-------- .../Diagnostics/Metrics/OrleansInstruments.cs | 8 ++++ src/Orleans.Core/Runtime/CallbackData.cs | 17 ++++---- .../Runtime/OutsideRuntimeClient.cs | 7 +++- .../Core/InsideRuntimeClient.cs | 7 +++- .../Hosting/DefaultSiloServices.cs | 1 + 7 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs diff --git a/src/Orleans.Core/Core/DefaultClientServices.cs b/src/Orleans.Core/Core/DefaultClientServices.cs index f2cdf597961..42e2298c4a3 100644 --- a/src/Orleans.Core/Core/DefaultClientServices.cs +++ b/src/Orleans.Core/Core/DefaultClientServices.cs @@ -54,6 +54,7 @@ public static void AddDefaultServices(IClientBuilder builder) services.AddLogging(); services.AddOptions(); services.TryAddSingleton(TimeProvider.System); + services.AddSingleton(); // Options logging services.TryAddSingleton(typeof(IOptionFormatter<>), typeof(DefaultOptionsFormatter<>)); diff --git a/src/Orleans.Core/Diagnostics/Metrics/ApplicationRequestInstruments.cs b/src/Orleans.Core/Diagnostics/Metrics/ApplicationRequestInstruments.cs index 8924d38ae1b..e9131689259 100644 --- a/src/Orleans.Core/Diagnostics/Metrics/ApplicationRequestInstruments.cs +++ b/src/Orleans.Core/Diagnostics/Metrics/ApplicationRequestInstruments.cs @@ -1,34 +1,41 @@ -using System; -using System.Collections.Generic; using System.Diagnostics.Metrics; namespace Orleans.Runtime; -internal static class ApplicationRequestInstruments +internal class ApplicationRequestInstruments { - internal static Counter TimedOutRequestsCounter = Instruments.Meter.CreateCounter(InstrumentNames.APP_REQUESTS_TIMED_OUT); - internal static Counter CanceledRequestsCounter = Instruments.Meter.CreateCounter(InstrumentNames.APP_REQUESTS_CANCELED); + private readonly Counter _timedOutRequestsCounter; + private readonly Counter _canceledRequestsCounter; - private static readonly long[] AppRequestsLatencyHistogramBuckets = new long[] { 1, 2, 4, 6, 8, 10, 50, 100, 200, 400, 800, 1_000, 1_500, 2_000, 5_000, 10_000, 15_000 }; - private static readonly HistogramAggregator AppRequestsLatencyHistogramAggregator = new(AppRequestsLatencyHistogramBuckets, Array.Empty>(), value => new ("duration", $"{value}ms")); - private static readonly ObservableCounter AppRequestsLatencyHistogramBucket = Instruments.Meter.CreateObservableCounter(InstrumentNames.APP_REQUESTS_LATENCY_HISTOGRAM + "-bucket", AppRequestsLatencyHistogramAggregator.CollectBuckets); - private static readonly ObservableCounter AppRequestsLatencyHistogramCount = Instruments.Meter.CreateObservableCounter(InstrumentNames.APP_REQUESTS_LATENCY_HISTOGRAM + "-count", AppRequestsLatencyHistogramAggregator.CollectCount); - private static readonly ObservableCounter AppRequestsLatencyHistogramSum = Instruments.Meter.CreateObservableCounter(InstrumentNames.APP_REQUESTS_LATENCY_HISTOGRAM + "-sum", AppRequestsLatencyHistogramAggregator.CollectSum); + private static readonly long[] AppRequestsLatencyHistogramBuckets = [1, 2, 4, 6, 8, 10, 50, 100, 200, 400, 800, 1_000, 1_500, 2_000, 5_000, 10_000, 15_000]; + private readonly HistogramAggregator _appRequestsLatencyHistogramAggregator = new(AppRequestsLatencyHistogramBuckets, [], value => new ("duration", $"{value}ms")); + private readonly ObservableCounter _appRequestsLatencyHistogramBucket; + private readonly ObservableCounter _appRequestsLatencyHistogramCount; + private readonly ObservableCounter _appRequestsLatencyHistogramSum; + internal ApplicationRequestInstruments(OrleansInstruments instruments) + { + _timedOutRequestsCounter = instruments.Meter.CreateCounter(InstrumentNames.APP_REQUESTS_TIMED_OUT); + _canceledRequestsCounter = instruments.Meter.CreateCounter(InstrumentNames.APP_REQUESTS_CANCELED); + _appRequestsLatencyHistogramAggregator = new(AppRequestsLatencyHistogramBuckets, [], value => new("duration", $"{value}ms")); + _appRequestsLatencyHistogramBucket = instruments.Meter.CreateObservableCounter(InstrumentNames.APP_REQUESTS_LATENCY_HISTOGRAM + "-bucket", _appRequestsLatencyHistogramAggregator.CollectBuckets); + _appRequestsLatencyHistogramCount = instruments.Meter.CreateObservableCounter(InstrumentNames.APP_REQUESTS_LATENCY_HISTOGRAM + "-count", _appRequestsLatencyHistogramAggregator.CollectCount); + _appRequestsLatencyHistogramSum = instruments.Meter.CreateObservableCounter(InstrumentNames.APP_REQUESTS_LATENCY_HISTOGRAM + "-sum", _appRequestsLatencyHistogramAggregator.CollectSum); + } - internal static void OnAppRequestsEnd(long durationMilliseconds) + internal void OnAppRequestsEnd(long durationMilliseconds) { - if (AppRequestsLatencyHistogramSum.Enabled) - AppRequestsLatencyHistogramAggregator.Record(durationMilliseconds); + if (_appRequestsLatencyHistogramSum.Enabled) + _appRequestsLatencyHistogramAggregator.Record(durationMilliseconds); } - internal static void OnAppRequestsTimedOut() + internal void OnAppRequestsTimedOut() { - TimedOutRequestsCounter.Add(1); + _timedOutRequestsCounter.Add(1); } - internal static void OnAppRequestsCanceled() + internal void OnAppRequestsCanceled() { - CanceledRequestsCounter.Add(1); + _canceledRequestsCounter.Add(1); } } diff --git a/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs b/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs new file mode 100644 index 00000000000..4f02fe8bbf3 --- /dev/null +++ b/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs @@ -0,0 +1,8 @@ +using System.Diagnostics.Metrics; + +namespace Orleans.Runtime; + +public class OrleansInstruments(IMeterFactory meterFactory) +{ + public Meter Meter { get; } = meterFactory.Create("Microsoft.Orleans"); +} diff --git a/src/Orleans.Core/Runtime/CallbackData.cs b/src/Orleans.Core/Runtime/CallbackData.cs index 2dcb5201340..c7b89e06c7d 100644 --- a/src/Orleans.Core/Runtime/CallbackData.cs +++ b/src/Orleans.Core/Runtime/CallbackData.cs @@ -11,6 +11,7 @@ internal sealed partial class CallbackData { private readonly SharedCallbackData shared; private readonly IResponseCompletionSource context; + private readonly ApplicationRequestInstruments _applicationRequestInstruments; private int completed; private StatusResponse? lastKnownStatus; private ValueStopwatch stopwatch; @@ -19,11 +20,13 @@ internal sealed partial class CallbackData public CallbackData( SharedCallbackData shared, IResponseCompletionSource ctx, - Message msg) + Message msg, + ApplicationRequestInstruments applicationRequestInstruments) { this.shared = shared; this.context = ctx; this.Message = msg; + _applicationRequestInstruments = applicationRequestInstruments; this.stopwatch = ValueStopwatch.StartNew(); } @@ -101,8 +104,8 @@ private void OnCancellation() stopwatch.Stop(); SignalCancellation(); shared.Unregister(Message); - ApplicationRequestInstruments.OnAppRequestsEnd((long)stopwatch.Elapsed.TotalMilliseconds); - ApplicationRequestInstruments.OnAppRequestsTimedOut(); + _applicationRequestInstruments.OnAppRequestsEnd((long)stopwatch.Elapsed.TotalMilliseconds); + _applicationRequestInstruments.OnAppRequestsTimedOut(); OrleansCallBackDataEvent.Log.OnCanceled(Message); context.Complete(Response.FromException(new OperationCanceledException(_cancellationTokenRegistration.Token))); _cancellationTokenRegistration.Dispose(); @@ -123,8 +126,8 @@ public void OnTimeout() this.shared.Unregister(this.Message); _cancellationTokenRegistration.Dispose(); - ApplicationRequestInstruments.OnAppRequestsEnd((long)this.stopwatch.Elapsed.TotalMilliseconds); - ApplicationRequestInstruments.OnAppRequestsTimedOut(); + _applicationRequestInstruments.OnAppRequestsEnd((long)this.stopwatch.Elapsed.TotalMilliseconds); + _applicationRequestInstruments.OnAppRequestsTimedOut(); OrleansCallBackDataEvent.Log.OnTimeout(this.Message); @@ -148,7 +151,7 @@ public void OnTargetSiloFail() this.stopwatch.Stop(); this.shared.Unregister(this.Message); _cancellationTokenRegistration.Dispose(); - ApplicationRequestInstruments.OnAppRequestsEnd((long)this.stopwatch.Elapsed.TotalMilliseconds); + _applicationRequestInstruments.OnAppRequestsEnd((long)this.stopwatch.Elapsed.TotalMilliseconds); OrleansCallBackDataEvent.Log.OnTargetSiloFail(this.Message); var msg = this.Message; @@ -169,7 +172,7 @@ public void DoCallback(Message response) this.stopwatch.Stop(); _cancellationTokenRegistration.Dispose(); - ApplicationRequestInstruments.OnAppRequestsEnd((long)this.stopwatch.Elapsed.TotalMilliseconds); + _applicationRequestInstruments.OnAppRequestsEnd((long)this.stopwatch.Elapsed.TotalMilliseconds); // do callback outside the CallbackData lock. Just not a good practice to hold a lock for this unrelated operation. ResponseCallback(response, this.context); diff --git a/src/Orleans.Core/Runtime/OutsideRuntimeClient.cs b/src/Orleans.Core/Runtime/OutsideRuntimeClient.cs index 6bcfc673b7d..ef929478a18 100644 --- a/src/Orleans.Core/Runtime/OutsideRuntimeClient.cs +++ b/src/Orleans.Core/Runtime/OutsideRuntimeClient.cs @@ -32,6 +32,7 @@ internal partial class OutsideRuntimeClient : IRuntimeClient, IDisposable, IClus private readonly MessagingTrace messagingTrace; private readonly InterfaceToImplementationMappingCache _interfaceToImplementationMapping; + private readonly ApplicationRequestInstruments _applicationRequestInstruments; private IGrainCallCancellationManager _cancellationManager; private IClusterConnectionStatusObserver[] _statusObservers; @@ -71,10 +72,12 @@ public OutsideRuntimeClient( MessagingTrace messagingTrace, IServiceProvider serviceProvider, TimeProvider timeProvider, - InterfaceToImplementationMappingCache interfaceToImplementationMapping) + InterfaceToImplementationMappingCache interfaceToImplementationMapping, + OrleansInstruments orleansInstruments) { TimeProvider = timeProvider; _interfaceToImplementationMapping = interfaceToImplementationMapping; + _applicationRequestInstruments = new(orleansInstruments); this.ServiceProvider = serviceProvider; _localClientDetails = localClientDetails; this.loggerFactory = loggerFactory; @@ -281,7 +284,7 @@ public void SendRequest(GrainReference target, IInvokable request, IResponseComp if (!oneWay) { - var callbackData = new CallbackData(this.sharedCallbackData, context, message); + var callbackData = new CallbackData(this.sharedCallbackData, context, message, _applicationRequestInstruments); callbackData.SubscribeForCancellation(cancellationToken); callbacks.TryAdd(message.Id, callbackData); } diff --git a/src/Orleans.Runtime/Core/InsideRuntimeClient.cs b/src/Orleans.Runtime/Core/InsideRuntimeClient.cs index d0ef329e206..f555c902b9d 100644 --- a/src/Orleans.Runtime/Core/InsideRuntimeClient.cs +++ b/src/Orleans.Runtime/Core/InsideRuntimeClient.cs @@ -41,6 +41,7 @@ internal sealed partial class InsideRuntimeClient : IRuntimeClient, ILifecyclePa private MessageCenter messageCenter; private List grainCallFilters; private readonly DeepCopier _deepCopier; + private readonly ApplicationRequestInstruments _applicationRequestInstruments; private IGrainCallCancellationManager _cancellationManager; private HostedClient hostedClient; @@ -63,11 +64,13 @@ public InsideRuntimeClient( GrainInterfaceTypeToGrainTypeResolver interfaceToTypeResolver, DeepCopier deepCopier, TimeProvider timeProvider, - InterfaceToImplementationMappingCache interfaceToImplementationMapping) + InterfaceToImplementationMappingCache interfaceToImplementationMapping, + OrleansInstruments orleansInstruments) { TimeProvider = timeProvider; this.interfaceToImplementationMapping = interfaceToImplementationMapping; this._deepCopier = deepCopier; + this._applicationRequestInstruments = new(orleansInstruments); this.ServiceProvider = serviceProvider; this.MySilo = siloDetails.SiloAddress; this.callbacks = new ConcurrentDictionary<(GrainId, CorrelationId), CallbackData>(); @@ -173,7 +176,7 @@ public void SendRequest( Debug.Assert(context is not null); // Register a callback for the request. - var callbackData = new CallbackData(sharedData, context, message); + var callbackData = new CallbackData(sharedData, context, message, _applicationRequestInstruments); callbacks.TryAdd((message.SendingGrain, message.Id), callbackData); callbackData.SubscribeForCancellation(cancellationToken); } diff --git a/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs b/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs index 7e67c106b66..a5a1908d7c0 100644 --- a/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs +++ b/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs @@ -65,6 +65,7 @@ internal static void AddDefaultServices(ISiloBuilder builder) services.AddLogging(); services.AddOptions(); services.TryAddSingleton(TimeProvider.System); + services.AddSingleton(); services.TryAddSingleton(typeof(IOptionFormatter<>), typeof(DefaultOptionsFormatter<>)); services.TryAddSingleton(typeof(IOptionFormatterResolver<>), typeof(DefaultOptionsFormatterResolver<>)); From aba99097fccfda6da8b73dcd6f48f551e70dc9ce Mon Sep 17 00:00:00 2001 From: Meir Blachman Date: Sun, 15 Feb 2026 21:51:55 +0200 Subject: [PATCH 2/6] Update src/Orleans.Core/Core/DefaultClientServices.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/Orleans.Core/Core/DefaultClientServices.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orleans.Core/Core/DefaultClientServices.cs b/src/Orleans.Core/Core/DefaultClientServices.cs index 42e2298c4a3..519618a5628 100644 --- a/src/Orleans.Core/Core/DefaultClientServices.cs +++ b/src/Orleans.Core/Core/DefaultClientServices.cs @@ -54,7 +54,7 @@ public static void AddDefaultServices(IClientBuilder builder) services.AddLogging(); services.AddOptions(); services.TryAddSingleton(TimeProvider.System); - services.AddSingleton(); + services.TryAddSingleton(); // Options logging services.TryAddSingleton(typeof(IOptionFormatter<>), typeof(DefaultOptionsFormatter<>)); From 94551e8b1c943b382ad4f19870691c43df723224 Mon Sep 17 00:00:00 2001 From: Reuben Bond Date: Sun, 15 Feb 2026 13:50:21 -0800 Subject: [PATCH 3/6] Fix OrleansInstruments DI fallback Use the existing static meter when IMeterFactory is not registered so OrleansInstruments can still be activated. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs b/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs index 4f02fe8bbf3..7e06dc877d5 100644 --- a/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs +++ b/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs @@ -2,7 +2,7 @@ namespace Orleans.Runtime; -public class OrleansInstruments(IMeterFactory meterFactory) +public class OrleansInstruments(IMeterFactory meterFactory = null) { - public Meter Meter { get; } = meterFactory.Create("Microsoft.Orleans"); + public Meter Meter { get; } = meterFactory is null ? Instruments.Meter : meterFactory.Create("Microsoft.Orleans"); } From 850c47e59514223ba4654b373f431344247d67b2 Mon Sep 17 00:00:00 2001 From: Reuben Bond Date: Sun, 15 Feb 2026 14:03:21 -0800 Subject: [PATCH 4/6] Register IMeterFactory via AddMetrics Use AddMetrics in default client/silo service registration so OrleansInstruments can depend on IMeterFactory without fallback behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Orleans.Core/Core/DefaultClientServices.cs | 1 + src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs | 4 ++-- src/Orleans.Runtime/Hosting/DefaultSiloServices.cs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Orleans.Core/Core/DefaultClientServices.cs b/src/Orleans.Core/Core/DefaultClientServices.cs index 519618a5628..4a685183249 100644 --- a/src/Orleans.Core/Core/DefaultClientServices.cs +++ b/src/Orleans.Core/Core/DefaultClientServices.cs @@ -53,6 +53,7 @@ public static void AddDefaultServices(IClientBuilder builder) // Common services services.AddLogging(); services.AddOptions(); + services.AddMetrics(); services.TryAddSingleton(TimeProvider.System); services.TryAddSingleton(); diff --git a/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs b/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs index 7e06dc877d5..4f02fe8bbf3 100644 --- a/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs +++ b/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs @@ -2,7 +2,7 @@ namespace Orleans.Runtime; -public class OrleansInstruments(IMeterFactory meterFactory = null) +public class OrleansInstruments(IMeterFactory meterFactory) { - public Meter Meter { get; } = meterFactory is null ? Instruments.Meter : meterFactory.Create("Microsoft.Orleans"); + public Meter Meter { get; } = meterFactory.Create("Microsoft.Orleans"); } diff --git a/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs b/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs index a5a1908d7c0..a78c8dab309 100644 --- a/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs +++ b/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs @@ -64,6 +64,7 @@ internal static void AddDefaultServices(ISiloBuilder builder) // Common services services.AddLogging(); services.AddOptions(); + services.AddMetrics(); services.TryAddSingleton(TimeProvider.System); services.AddSingleton(); From c4f90b6330bc6beb6f234a66c76b09bef3d2166b Mon Sep 17 00:00:00 2001 From: Reuben Bond Date: Sun, 15 Feb 2026 14:15:59 -0800 Subject: [PATCH 5/6] Address PR feedback on metrics DI - Remove duplicate histogram aggregator initialization\n- Add XML docs/null-guard for public OrleansInstruments\n- Add OrleansInstruments to Orleans.Core API baseline\n- Use TryAddSingleton for OrleansInstruments in silo services Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Metrics/ApplicationRequestInstruments.cs | 2 +- .../Diagnostics/Metrics/OrleansInstruments.cs | 10 +++++++++- src/Orleans.Runtime/Hosting/DefaultSiloServices.cs | 2 +- src/api/Orleans.Core/Orleans.Core.cs | 9 ++++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Orleans.Core/Diagnostics/Metrics/ApplicationRequestInstruments.cs b/src/Orleans.Core/Diagnostics/Metrics/ApplicationRequestInstruments.cs index e9131689259..c45ce5ea9b7 100644 --- a/src/Orleans.Core/Diagnostics/Metrics/ApplicationRequestInstruments.cs +++ b/src/Orleans.Core/Diagnostics/Metrics/ApplicationRequestInstruments.cs @@ -8,7 +8,7 @@ internal class ApplicationRequestInstruments private readonly Counter _canceledRequestsCounter; private static readonly long[] AppRequestsLatencyHistogramBuckets = [1, 2, 4, 6, 8, 10, 50, 100, 200, 400, 800, 1_000, 1_500, 2_000, 5_000, 10_000, 15_000]; - private readonly HistogramAggregator _appRequestsLatencyHistogramAggregator = new(AppRequestsLatencyHistogramBuckets, [], value => new ("duration", $"{value}ms")); + private readonly HistogramAggregator _appRequestsLatencyHistogramAggregator; private readonly ObservableCounter _appRequestsLatencyHistogramBucket; private readonly ObservableCounter _appRequestsLatencyHistogramCount; private readonly ObservableCounter _appRequestsLatencyHistogramSum; diff --git a/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs b/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs index 4f02fe8bbf3..3e28d43d85d 100644 --- a/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs +++ b/src/Orleans.Core/Diagnostics/Metrics/OrleansInstruments.cs @@ -1,8 +1,16 @@ +using System; using System.Diagnostics.Metrics; namespace Orleans.Runtime; +/// +/// Provides the used by Orleans runtime metrics. +/// +/// The meter factory used to create the Orleans meter. public class OrleansInstruments(IMeterFactory meterFactory) { - public Meter Meter { get; } = meterFactory.Create("Microsoft.Orleans"); + /// + /// Gets the Orleans runtime meter. + /// + public Meter Meter { get; } = (meterFactory ?? throw new ArgumentNullException(nameof(meterFactory))).Create("Microsoft.Orleans"); } diff --git a/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs b/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs index a78c8dab309..c2a3ae53774 100644 --- a/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs +++ b/src/Orleans.Runtime/Hosting/DefaultSiloServices.cs @@ -66,7 +66,7 @@ internal static void AddDefaultServices(ISiloBuilder builder) services.AddOptions(); services.AddMetrics(); services.TryAddSingleton(TimeProvider.System); - services.AddSingleton(); + services.TryAddSingleton(); services.TryAddSingleton(typeof(IOptionFormatter<>), typeof(DefaultOptionsFormatter<>)); services.TryAddSingleton(typeof(IOptionFormatterResolver<>), typeof(DefaultOptionsFormatterResolver<>)); diff --git a/src/api/Orleans.Core/Orleans.Core.cs b/src/api/Orleans.Core/Orleans.Core.cs index e2ebb3c68b0..20001ace54f 100644 --- a/src/api/Orleans.Core/Orleans.Core.cs +++ b/src/api/Orleans.Core/Orleans.Core.cs @@ -1338,6 +1338,13 @@ public OnDeserializedCallbacks(System.IServiceProvider serviceProvider) { } public void OnDeserialized(Orleans.Serialization.IOnDeserialized value) { } } + public partial class OrleansInstruments + { + public OrleansInstruments(System.Diagnostics.Metrics.IMeterFactory meterFactory) { } + + public System.Diagnostics.Metrics.Meter Meter { get { throw null; } } + } + public static partial class RangeFactory { public const long RING_SIZE = 4294967296L; @@ -4513,4 +4520,4 @@ public override void SetArgument(int index, object value) { } public override void SetTarget(global::Orleans.Serialization.Invocation.ITargetHolder holder) { } } -} \ No newline at end of file +} From 07c899cbb46fcfc3e87c6a94d203c448816a0c86 Mon Sep 17 00:00:00 2001 From: Reuben Bond Date: Sun, 15 Feb 2026 14:21:52 -0800 Subject: [PATCH 6/6] Remove manual Orleans.Core API edit Revert the Orleans.Core.cs baseline entry for OrleansInstruments since API baseline automation applies that change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/api/Orleans.Core/Orleans.Core.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/api/Orleans.Core/Orleans.Core.cs b/src/api/Orleans.Core/Orleans.Core.cs index 20001ace54f..97cb0bd61da 100644 --- a/src/api/Orleans.Core/Orleans.Core.cs +++ b/src/api/Orleans.Core/Orleans.Core.cs @@ -1338,13 +1338,6 @@ public OnDeserializedCallbacks(System.IServiceProvider serviceProvider) { } public void OnDeserialized(Orleans.Serialization.IOnDeserialized value) { } } - public partial class OrleansInstruments - { - public OrleansInstruments(System.Diagnostics.Metrics.IMeterFactory meterFactory) { } - - public System.Diagnostics.Metrics.Meter Meter { get { throw null; } } - } - public static partial class RangeFactory { public const long RING_SIZE = 4294967296L;