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

Reduce logging noise from MemoryStorage, InsideRuntimeClient, and LocalGrainDirectory #8780

Merged
merged 2 commits into from
Dec 17, 2023
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
19 changes: 5 additions & 14 deletions src/Orleans.Persistence.Memory/Storage/MemoryStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Orleans.Storage
{

/// <summary>
/// This is a simple in-memory grain implementation of a storage provider.
/// </summary>
Expand All @@ -21,16 +20,6 @@ namespace Orleans.Storage
/// because [by-design] it does not provide any resilience
/// or long-term persistence capabilities.
/// </remarks>
/// <example>
/// Example configuration for this storage provider in OrleansConfiguration.xml file:
/// <code>
/// &lt;OrleansConfiguration xmlns="urn:orleans">
/// &lt;Globals>
/// &lt;StorageProviders>
/// &lt;Provider Type="Orleans.Storage.MemoryStorage" Name="MemoryStore" />
/// &lt;/StorageProviders>
/// </code>
/// </example>
[DebuggerDisplay("MemoryStore:{" + nameof(name) + "}")]
public class MemoryGrainStorage : IGrainStorage, IDisposable
{
Expand All @@ -55,8 +44,11 @@ public MemoryGrainStorage(string name, MemoryGrainStorageOptions options, ILogge
this.logger = logger;
this.storageSerializer = options.GrainStorageSerializer ?? defaultGrainStorageSerializer;

//Init
logger.LogInformation("Init: Name={Name} NumStorageGrains={NumStorageGrains}", name, options.NumStorageGrains);

if (logger.IsEnabled(LogLevel.Debug))
{
logger.LogDebug("Init: Name={Name} NumStorageGrains={NumStorageGrains}", name, options.NumStorageGrains);
}

storageGrains = new Lazy<IMemoryStorageGrain>[options.NumStorageGrains];
for (int i = 0; i < storageGrains.Length; i++)
Expand Down Expand Up @@ -141,7 +133,6 @@ private IMemoryStorageGrain GetStorageGrain(string id)
/// <param name="data">The serialized stored data</param>
internal T ConvertFromStorageFormat<T>(ReadOnlyMemory<byte> data)
{

T dataValue = default;
try
{
Expand Down
16 changes: 10 additions & 6 deletions src/Orleans.Runtime/Core/InsideRuntimeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,18 +498,22 @@ private Task OnRuntimeInitializeStop(CancellationToken tc)

private Task OnRuntimeInitializeStart(CancellationToken tc)
{
var stopWatch = Stopwatch.StartNew();
var stopWatch = ValueStopwatch.StartNew();
var timerLogger = this.loggerFactory.CreateLogger<SafeTimer>();
var minTicks = Math.Min(this.messagingOptions.ResponseTimeout.Ticks, TimeSpan.FromSeconds(1).Ticks);
var period = TimeSpan.FromTicks(minTicks);
this.callbackTimer = new SafeTimer(timerLogger, this.OnCallbackExpiryTick, null, period, period);
this.disposables.Add(this.callbackTimer);

stopWatch.Stop();
this.logger.LogInformation(
(int)ErrorCode.SiloStartPerfMeasure,
"Start InsideRuntimeClient took {ElapsedMs} milliseconds",
stopWatch.ElapsedMilliseconds);
if (logger.IsEnabled(LogLevel.Debug))
{
stopWatch.Stop();
this.logger.LogInformation(
(int)ErrorCode.SiloStartPerfMeasure,
"Start InsideRuntimeClient took {ElapsedMs} milliseconds",
stopWatch.Elapsed.TotalMilliseconds);
}

return Task.CompletedTask;
}

Expand Down
6 changes: 5 additions & 1 deletion src/Orleans.Runtime/GrainDirectory/LocalGrainDirectory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ public LocalGrainDirectory(

public void Start()
{
log.LogInformation("Start");
if (log.IsEnabled(LogLevel.Debug))
{
log.LogDebug("Start");
}

Running = true;
if (maintainer != null)
{
Expand Down
Loading