You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varmessage=$"There is a high level of RavenDB dirty memory ({dirtyMemory}). See https://docs.particular.net/servicecontrol/troubleshooting#ravendb-dirty-memory for guidance on how to mitigate the issue.";
20
-
Log.Warn(message);
21
-
returnCheckResult.Failed(message);
20
+
logger.LogWarning("There is a high level of RavenDB dirty memory ({DirtyMemory}). See https://docs.particular.net/servicecontrol/troubleshooting#ravendb-dirty-memory for guidance on how to mitigate the issue.",dirtyMemory);
21
+
returnCheckResult.Failed($"There is a high level of RavenDB dirty memory ({dirtyMemory}). See https://docs.particular.net/servicecontrol/troubleshooting#ravendb-dirty-memory for guidance on how to mitigate the issue.");
message=$"{RavenPersistenceConfiguration.DataSpaceRemainingThresholdKey} must be an integer.";
58
-
Logger.Fatal(message);
59
-
thrownewException(message);
57
+
Logger.LogCritical("{RavenPersistenceConfigurationDataSpaceRemainingThresholdKey} must be an integer.",RavenPersistenceConfiguration.DataSpaceRemainingThresholdKey);
58
+
thrownewException($"{RavenPersistenceConfiguration.DataSpaceRemainingThresholdKey} must be an integer.");
60
59
}
61
60
62
61
if(threshold<0)
63
62
{
64
-
message=$"{RavenPersistenceConfiguration.DataSpaceRemainingThresholdKey} is invalid, minimum value is 0.";
65
-
Logger.Fatal(message);
66
-
thrownewException(message);
63
+
Logger.LogCritical("{RavenPersistenceConfigurationDataSpaceRemainingThresholdKey} is invalid, minimum value is 0.",RavenPersistenceConfiguration.DataSpaceRemainingThresholdKey);
64
+
thrownewException($"{RavenPersistenceConfiguration.DataSpaceRemainingThresholdKey} is invalid, minimum value is 0.");
67
65
}
68
66
69
67
if(threshold>100)
70
68
{
71
-
message=$"{RavenPersistenceConfiguration.DataSpaceRemainingThresholdKey} is invalid, maximum value is 100.";
72
-
Logger.Fatal(message);
73
-
thrownewException(message);
69
+
Logger.LogCritical("{RavenPersistenceConfigurationDataSpaceRemainingThresholdKey} is invalid, maximum value is 100.",RavenPersistenceConfiguration.DataSpaceRemainingThresholdKey);
70
+
thrownewException($"{RavenPersistenceConfiguration.DataSpaceRemainingThresholdKey} is invalid, maximum value is 100.");
@@ -46,10 +47,9 @@ public override Task<CheckResult> PerformCheck(CancellationToken cancellationTok
46
47
returnSuccessResult;
47
48
}
48
49
49
-
varmessage=$"Audit message ingestion stopped! {percentRemaining:P0} disk space remaining on data drive '{dataDriveInfo.VolumeLabel} ({dataDriveInfo.RootDirectory})' on '{Environment.MachineName}'. This is less than {percentageThreshold}% - the minimal required space configured. The threshold can be set using the {RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey} configuration setting.";
50
-
Logger.Warn(message);
50
+
logger.LogWarning("Audit message ingestion stopped! {PercentRemaining:P0} disk space remaining on data drive '{DataDriveInfoVolumeLabel} ({DataDriveInfoRootDirectory})' on '{EnvironmentMachineName}'. This is less than {PercentageThreshold}% - the minimal required space configured. The threshold can be set using the {RavenPersistenceConfigurationMinimumStorageLeftRequiredForIngestionKey} configuration setting.",percentRemaining,dataDriveInfo.VolumeLabel,dataDriveInfo.RootDirectory,Environment.MachineName,percentageThreshold,RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey);
51
51
stateHolder.CanIngestMore=false;
52
-
returnCheckResult.Failed(message);
52
+
returnCheckResult.Failed($"Audit message ingestion stopped! {percentRemaining:P0} disk space remaining on data drive '{dataDriveInfo.VolumeLabel} ({dataDriveInfo.RootDirectory})' on '{Environment.MachineName}'. This is less than {percentageThreshold}% - the minimal required space configured. The threshold can be set using the {RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey} configuration setting.");
@@ -61,30 +61,27 @@ public static int Parse(IDictionary<string, string> settings)
61
61
62
62
if(!int.TryParse(thresholdValue,outvarthreshold))
63
63
{
64
-
varmessage=$"{RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey} must be an integer.";
65
-
Logger.Fatal(message);
66
-
thrownewException(message);
64
+
Logger.LogCritical("{RavenPersistenceConfigurationMinimumStorageLeftRequiredForIngestionKey} must be an integer.",RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey);
65
+
thrownewException($"{RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey} must be an integer.");
67
66
}
68
67
69
68
if(threshold<0)
70
69
{
71
-
varmessage=$"{RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey} is invalid, minimum value is 0.";
72
-
Logger.Fatal(message);
73
-
thrownewException(message);
70
+
Logger.LogCritical("{RavenPersistenceConfigurationMinimumStorageLeftRequiredForIngestionKey} is invalid, minimum value is 0.",RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey);
71
+
thrownewException($"{RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey} is invalid, minimum value is 0.");
74
72
}
75
73
76
74
if(threshold>100)
77
75
{
78
-
varmessage=$"{RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey} is invalid, maximum value is 100.";
79
-
Logger.Fatal(message);
80
-
thrownewException(message);
76
+
Logger.LogCritical("{RavenPersistenceConfigurationMinimumStorageLeftRequiredForIngestionKey} is invalid, maximum value is 100.",RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey);
77
+
thrownewException($"{RavenPersistenceConfiguration.MinimumStorageLeftRequiredForIngestionKey} is invalid, maximum value is 100.");
Copy file name to clipboardExpand all lines: src/ServiceControl.Audit.Persistence.RavenDB/CustomChecks/CheckRavenDBIndexLag.cs
+11-9Lines changed: 11 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,13 @@
5
5
usingSystem.Text;
6
6
usingSystem.Threading;
7
7
usingSystem.Threading.Tasks;
8
+
usingMicrosoft.Extensions.Logging;
8
9
usingNServiceBus.CustomChecks;
9
-
usingNServiceBus.Logging;
10
10
usingRaven.Client.Documents.Operations;
11
11
usingServiceControl.Audit.Persistence.RavenDB;
12
+
usingServiceControl.Infrastructure;
12
13
13
-
classCheckRavenDBIndexLag(IRavenDocumentStoreProviderdocumentStoreProvider):CustomCheck("Audit Database Index Lag","ServiceControl.Audit Health",TimeSpan.FromMinutes(5))
14
+
classCheckRavenDBIndexLag(IRavenDocumentStoreProviderdocumentStoreProvider,ILogger<CheckRavenDBIndexLag>logger):CustomCheck("Audit Database Index Lag","ServiceControl.Audit Health",TimeSpan.FromMinutes(5))
@@ -43,12 +44,12 @@ static int CheckAndReportIndexesWithTooMuchIndexLag(IndexInformation[] indexes)
43
44
if(indexLag>IndexLagThresholdError)
44
45
{
45
46
indexCountWithTooMuchLag++;
46
-
Log.Error($"Index [{indexStats.Name}] IndexingLag {indexLag} is above error threshold ({IndexLagThresholdError}). Launch in maintenance mode to let indexes catch up.");
47
+
logger.LogError("Index [{IndexStatsName}] IndexingLag {IndexLag} is above error threshold ({IndexLagThresholdError}). Launch in maintenance mode to let indexes catch up.",indexStats.Name,indexLag,IndexLagThresholdError);
47
48
}
48
49
elseif(indexLag>IndexLagThresholdWarning)
49
50
{
50
51
indexCountWithTooMuchLag++;
51
-
Log.Warn($"Index [{indexStats.Name}] IndexingLag {indexLag} is above warning threshold ({IndexLagThresholdWarning}). Launch in maintenance mode to let indexes catch up.");
52
+
logger.LogWarning("Index [{IndexStatsName}] IndexingLag {IndexLag} is above warning threshold ({IndexLagThresholdWarning}). Launch in maintenance mode to let indexes catch up.",indexStats.Name,indexLag,IndexLagThresholdWarning);
52
53
}
53
54
}
54
55
}
@@ -58,7 +59,7 @@ static int CheckAndReportIndexesWithTooMuchIndexLag(IndexInformation[] indexes)
0 commit comments