@@ -15,9 +15,11 @@ public IngestionMetrics(IMeterFactory meterFactory)
1515 {
1616 var meter = meterFactory . Create ( MeterName , MeterVersion ) ;
1717
18- batchDuration = meter . CreateHistogram < double > ( CreateInstrumentName ( "batch_duration_seconds" ) , unit : "seconds" , "Message batch processing duration in seconds" ) ;
19- ingestionDuration = meter . CreateHistogram < double > ( CreateInstrumentName ( "message_duration_seconds" ) , unit : "seconds" , description : "Audit message processing duration in seconds" ) ;
20- consecutiveBatchFailureGauge = meter . CreateObservableGauge ( CreateInstrumentName ( "consecutive_batch_failure_total" ) , ( ) => consecutiveBatchFailures , description : "Consecutive audit ingestion batch failure" ) ;
18+ var durationBucketsInSeconds = new InstrumentAdvice < double > { HistogramBucketBoundaries = [ 0.01 , 0.05 , 0.1 , 0.5 , 1 , 5 ] } ;
19+
20+ batchDuration = meter . CreateHistogram ( CreateInstrumentName ( "batch_duration_seconds" ) , unit : "seconds" , "Message batch processing duration in seconds" , advice : durationBucketsInSeconds ) ;
21+ ingestionDuration = meter . CreateHistogram ( CreateInstrumentName ( "message_duration_seconds" ) , unit : "seconds" , description : "Audit message processing duration in seconds" , advice : durationBucketsInSeconds ) ;
22+ consecutiveBatchFailureGauge = meter . CreateGauge < long > ( CreateInstrumentName ( "consecutive_batch_failure_total" ) , description : "Consecutive audit ingestion batch failure" ) ;
2123 failureCounter = meter . CreateCounter < long > ( CreateInstrumentName ( "failures_total" ) , description : "Audit ingestion failure count" ) ;
2224 }
2325
@@ -53,16 +55,16 @@ void RecordBatchOutcome(bool success)
5355 {
5456 consecutiveBatchFailures ++ ;
5557 }
58+
59+ consecutiveBatchFailureGauge . Record ( consecutiveBatchFailures ) ;
5660 }
5761
5862 static string CreateInstrumentName ( string instrumentName ) => $ "sc.audit.ingestion.{ instrumentName . ToLower ( ) } ";
5963
6064 long consecutiveBatchFailures ;
6165
6266 readonly Histogram < double > batchDuration ;
63- #pragma warning disable IDE0052
64- readonly ObservableGauge < long > consecutiveBatchFailureGauge ;
65- #pragma warning restore IDE0052
67+ readonly Gauge < long > consecutiveBatchFailureGauge ;
6668 readonly Histogram < double > ingestionDuration ;
6769 readonly Counter < long > failureCounter ;
6870
0 commit comments