1- using System ;
1+ using System ;
22using System . Diagnostics ;
33using System . Linq ;
44using System . Net ;
@@ -18,26 +18,27 @@ public class GraphiteRtqProfiler : IRtqProfiler
1818 public GraphiteRtqProfiler ( [ NotNull ] IStatsDClient statsDClient ,
1919 [ NotNull ] IGraphiteClient graphiteClient ,
2020 [ NotNull ] string statsDKeyNamePrefix ,
21- [ NotNull ] string consumerGraphitePathPrefix )
21+ [ NotNull ] string consumerGraphitePathPrefix ,
22+ [ CanBeNull ] string consumerName = null )
2223 {
2324 if ( string . IsNullOrEmpty ( statsDKeyNamePrefix ) )
2425 throw new InvalidOperationException ( "statsDKeyNamePrefix is empty" ) ;
2526 if ( string . IsNullOrEmpty ( consumerGraphitePathPrefix ) )
2627 throw new InvalidOperationException ( "consumerGraphitePathPrefix is empty" ) ;
2728 this . statsDClient = statsDClient . WithScopes ( $ "{ statsDKeyNamePrefix } .{ Dns . GetHostName ( ) } ", $ "{ statsDKeyNamePrefix } .Total") ;
2829 this . graphiteClient = graphiteClient ;
29- this . consumerGraphitePathPrefix = FormatGraphitePathPrefix ( consumerGraphitePathPrefix ) ;
30+ this . consumerGraphitePathPrefix = FormatGraphitePathPrefix ( consumerGraphitePathPrefix , consumerName ) ;
3031 }
3132
3233 [ NotNull ]
33- private static string FormatGraphitePathPrefix ( [ NotNull ] string graphitePathPrefix )
34+ private static string FormatGraphitePathPrefix ( [ NotNull ] string graphitePathPrefix , [ CanBeNull ] string consumerName )
3435 {
3536 var processName = Process . GetCurrentProcess ( )
3637 . ProcessName
3738 . Replace ( ".exe" , string . Empty )
3839 . Split ( new [ ] { '.' } , StringSplitOptions . RemoveEmptyEntries )
3940 . Last ( ) ;
40- return $ "{ graphitePathPrefix } .{ Dns . GetHostName ( ) } .{ processName } ";
41+ return $ "{ graphitePathPrefix } .{ Dns . GetHostName ( ) } .{ consumerName ?? processName } ";
4142 }
4243
4344 public void ProcessTaskCreation ( [ NotNull ] TaskMetaInformation meta )
0 commit comments