@@ -69,7 +69,7 @@ namespace SeqCli.Cli.Commands;
6969 {
7070 ""id"": ""count-star"",
7171 ""query"": ""select count(*) from stream"",
72- ""signals "": [ ""signal-id -here""]
72+ ""signalExpression "": ""signal-expression -here""]
7373 }
7474 ]
7575}
@@ -83,7 +83,6 @@ class BenchCommand : Command
8383 string _cases = "" ;
8484 string _reportingServerUrl = "" ;
8585 string _reportingServerApiKey = "" ;
86- ILogger ? _reportingLogger = null ;
8786
8887 public BenchCommand ( SeqConnectionFactory connectionFactory )
8988 {
@@ -116,7 +115,7 @@ protected override async Task<int> Run()
116115 try
117116 {
118117 var connection = _connectionFactory . Connect ( _connection ) ;
119- _reportingLogger = BuildReportingLogger ( ) ;
118+ using var reportingLogger = BuildReportingLogger ( ) ;
120119 var cases = ReadCases ( _cases ) ;
121120 var runId = Guid . NewGuid ( ) . ToString ( "N" ) . Substring ( 0 , 4 ) ;
122121 var start = _range . Start ?? DateTime . UtcNow . AddDays ( - 7 ) ;
@@ -131,9 +130,9 @@ protected override async Task<int> Run()
131130 {
132131 var response = await connection . Data . QueryAsync (
133132 c . Query ,
134- _range . Start ?? DateTime . UtcNow . AddDays ( - 7 ) ,
135- _range . End ,
136- SignalExpressionPart . FromIntersectedIds ( c . Signals )
133+ start ,
134+ end ,
135+ SignalExpressionPart . Signal ( c . SignalExpression )
137136 ) ;
138137
139138 timings . PushElapsed ( response . Statistics . ElapsedMilliseconds ) ;
@@ -149,14 +148,14 @@ protected override async Task<int> Run()
149148 using ( LogContext . PushProperty ( "MinElapsed" , timings . MinElapsed ) )
150149 using ( LogContext . PushProperty ( "MaxElapsed" , timings . MaxElapsed ) )
151150 using ( LogContext . PushProperty ( "Runs" , _runs ) )
152- using ( LogContext . PushProperty ( "Signals" , c . Signals ) )
151+ using ( LogContext . PushProperty ( "Signals" , c . SignalExpression ) )
153152 using ( LogContext . PushProperty ( "Start" , start ) )
154153 using ( LogContext . PushProperty ( "StandardDeviationElapsed" , timings . StandardDeviationElapsed ) )
155154 using ( end != null ? LogContext . PushProperty ( "End" , end ) : null )
156155 using ( LogContext . PushProperty ( "Query" , c . Query ) )
157156 {
158- _reportingLogger . Information (
159- "Bench run {BenchRunId} for query {Id}. Mean {MeanElapsed:N0} ms with relative dispersion {RelativeStandardDeviationElapsed:N2}" ,
157+ reportingLogger . Information (
158+ "Bench run {BenchRunId} for query {Id}: mean {MeanElapsed:N0} ms with relative dispersion {RelativeStandardDeviationElapsed:N2}" ,
160159 runId , c . Id ,
161160 timings . MeanElapsed ,
162161 timings . RelativeStandardDeviationElapsed ) ;
@@ -175,20 +174,18 @@ protected override async Task<int> Run()
175174 /// Build a second Serilog logger for logging benchmark results.
176175 /// </summary>
177176 Logger BuildReportingLogger ( )
178- {
179- return string . IsNullOrWhiteSpace ( _reportingServerUrl )
180- ? new LoggerConfiguration ( )
181- . Enrich . FromLogContext ( )
182- . WriteTo . Console ( )
183- . CreateLogger ( )
184- : new LoggerConfiguration ( )
185- . Enrich . FromLogContext ( )
186- . WriteTo . Console ( )
187- . WriteTo . Seq (
188- _reportingServerUrl ,
189- apiKey : string . IsNullOrWhiteSpace ( _reportingServerApiKey ) ? null : _reportingServerApiKey ,
190- period : TimeSpan . FromMilliseconds ( 1 ) )
191- . CreateLogger ( ) ;
177+ {
178+ var loggerConfiguration = new LoggerConfiguration ( )
179+ . Enrich . FromLogContext ( )
180+ . WriteTo . Console ( ) ;
181+
182+ if ( ! string . IsNullOrWhiteSpace ( _reportingServerUrl ) )
183+ loggerConfiguration . WriteTo . Seq (
184+ _reportingServerUrl ,
185+ apiKey : string . IsNullOrWhiteSpace ( _reportingServerApiKey ) ? null : _reportingServerApiKey ,
186+ period : TimeSpan . FromMilliseconds ( 1 ) ) ;
187+
188+ return loggerConfiguration . CreateLogger ( ) ;
192189 }
193190
194191 /// <summary>
0 commit comments