File tree Expand file tree Collapse file tree 4 files changed +8
-18
lines changed
ServiceControl.Audit.Persistence.RavenDB
ServiceControl.Persistence.RavenDB Expand file tree Collapse file tree 4 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,11 @@ class CheckDirtyMemory(MemoryInformationRetriever memoryInformationRetriever) :
1010{
1111 public override async Task < CheckResult > PerformCheck ( CancellationToken cancellationToken = default )
1212 {
13- var ( isHighDirty , dirtyMemoryKb ) = await memoryInformationRetriever . GetMemoryInformation ( cancellationToken ) ;
13+ var ( isHighDirty , dirtyMemory ) = await memoryInformationRetriever . GetMemoryInformation ( cancellationToken ) ;
1414
1515 if ( isHighDirty )
1616 {
17- var message = $ "There is a high level of RavenDB dirty memory ({ dirtyMemoryKb } kb ). See https://docs.particular.net/servicecontrol/troubleshooting#ravendb-dirty-memory for guidance on how to mitigate the issue.";
17+ var message = $ "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.";
1818 Log . Warn ( message ) ;
1919 return CheckResult . Failed ( message ) ;
2020 }
Original file line number Diff line number Diff line change @@ -26,16 +26,11 @@ record MemoryInformation
2626 public string DirtyMemory { get ; set ; }
2727 }
2828
29- public async Task < ( bool IsHighDirty , int DirtyMemoryKb ) > GetMemoryInformation ( CancellationToken cancellationToken = default )
29+ public async Task < ( bool IsHighDirty , string DirtyMemory ) > GetMemoryInformation ( CancellationToken cancellationToken = default )
3030 {
3131 var httpResponse = await client . GetAsync ( "/admin/debug/memory/stats?includeThreads=false&includeMappings=false" , cancellationToken ) ;
3232 var responseDto = JsonSerializer . Deserialize < ResponseDto > ( await httpResponse . Content . ReadAsStringAsync ( cancellationToken ) ) ;
3333
34- var values = responseDto . MemoryInformation . DirtyMemory . Split ( ' ' ) ;
35- if ( ! string . Equals ( values [ 1 ] , "KBytes" , StringComparison . OrdinalIgnoreCase ) )
36- {
37- throw new InvalidOperationException ( $ "Unexpected response. Was expecting memory details in KBytes, instead received: { responseDto . MemoryInformation . DirtyMemory } ") ;
38- }
39- return ( responseDto . MemoryInformation . IsHighDirty , int . Parse ( values [ 0 ] ) ) ;
34+ return ( responseDto . MemoryInformation . IsHighDirty , responseDto . MemoryInformation . DirtyMemory ) ;
4035 }
4136}
Original file line number Diff line number Diff line change @@ -10,11 +10,11 @@ class CheckDirtyMemory(MemoryInformationRetriever memoryInformationRetriever) :
1010{
1111 public override async Task < CheckResult > PerformCheck ( CancellationToken cancellationToken = default )
1212 {
13- var ( isHighDirty , dirtyMemoryKb ) = await memoryInformationRetriever . GetMemoryInformation ( cancellationToken ) ;
13+ var ( isHighDirty , dirtyMemory ) = await memoryInformationRetriever . GetMemoryInformation ( cancellationToken ) ;
1414
1515 if ( isHighDirty )
1616 {
17- var message = $ "There is a high level of RavenDB dirty memory ({ dirtyMemoryKb } kb ). See https://docs.particular.net/servicecontrol/troubleshooting#ravendb-dirty-memory for guidance on how to mitigate the issue.";
17+ var message = $ "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.";
1818 Log . Warn ( message ) ;
1919 return CheckResult . Failed ( message ) ;
2020 }
Original file line number Diff line number Diff line change @@ -25,16 +25,11 @@ record MemoryInformation
2525 public string DirtyMemory { get ; set ; }
2626 }
2727
28- public async Task < ( bool IsHighDirty , int DirtyMemoryKb ) > GetMemoryInformation ( CancellationToken cancellationToken = default )
28+ public async Task < ( bool IsHighDirty , string DirtyMemory ) > GetMemoryInformation ( CancellationToken cancellationToken = default )
2929 {
3030 var httpResponse = await client . GetAsync ( "/admin/debug/memory/stats?includeThreads=false&includeMappings=false" , cancellationToken ) ;
3131 var responseDto = JsonSerializer . Deserialize < ResponseDto > ( await httpResponse . Content . ReadAsStringAsync ( cancellationToken ) ) ;
3232
33- var values = responseDto . MemoryInformation . DirtyMemory . Split ( ' ' ) ;
34- if ( ! string . Equals ( values [ 1 ] , "KBytes" , StringComparison . OrdinalIgnoreCase ) )
35- {
36- throw new InvalidOperationException ( $ "Unexpected response. Was expecting memory details in KBytes, instead received: { responseDto . MemoryInformation . DirtyMemory } ") ;
37- }
38- return ( responseDto . MemoryInformation . IsHighDirty , int . Parse ( values [ 0 ] ) ) ;
33+ return ( responseDto . MemoryInformation . IsHighDirty , responseDto . MemoryInformation . DirtyMemory ) ;
3934 }
4035}
You can’t perform that action at this time.
0 commit comments