@@ -42,7 +42,8 @@ public async Task HistogramFormat_Test()
4242 {
4343 List < ICounterPayload > payload = new ( ) ;
4444
45- payload . Add ( new AggregatePercentilePayload ( MeterName , InstrumentName , "DisplayName" , string . Empty , string . Empty ,
45+ payload . Add ( new AggregatePercentilePayload ( new CounterMetadata ( MeterName , InstrumentName , meterTags : null , instrumentTags : null , scopeHash : null ) ,
46+ "DisplayName" , string . Empty , string . Empty ,
4647 new Quantile [ ] { new Quantile ( 0.5 , Value1 ) , new Quantile ( 0.95 , Value2 ) , new Quantile ( 0.99 , Value3 ) } ,
4748 Timestamp ) ) ;
4849
@@ -51,7 +52,7 @@ public async Task HistogramFormat_Test()
5152
5253 // Question - this is manually recreating what PrometheusDataModel.GetPrometheusNormalizedName does to get the metric name;
5354 // should we call this method, or should this also be implicitly testing its behavior by having this hard-coded?
54- string metricName = $ "{ MeterName . ToLowerInvariant ( ) } _{ payload [ 0 ] . Name } ";
55+ string metricName = $ "{ MeterName . ToLowerInvariant ( ) } _{ payload [ 0 ] . CounterMetadata . CounterName } ";
5556
5657 const string quantile_50 = "{quantile=\" 0.5\" }" ;
5758 const string quantile_95 = "{quantile=\" 0.95\" }" ;
@@ -68,15 +69,16 @@ public async Task HistogramFormat_Test()
6869 [ Fact ]
6970 public async Task GaugeFormat_Test ( )
7071 {
71- ICounterPayload payload = new GaugePayload ( MeterName , InstrumentName , "DisplayName" , "" , null , Value1 , Timestamp ) ;
72+ ICounterPayload payload = new GaugePayload ( new CounterMetadata ( MeterName , InstrumentName , meterTags : null , instrumentTags : null , scopeHash : null ) ,
73+ "DisplayName" , "" , null , Value1 , Timestamp ) ;
7274
7375 MemoryStream stream = await GetMetrics ( new ( ) { payload } ) ;
7476
7577 List < string > lines = ReadStream ( stream ) ;
7678
7779 // Question - this is manually recreating what PrometheusDataModel.GetPrometheusNormalizedName does to get the metric name;
7880 // should we call this method, or should this also be implicitly testing its behavior by having this hard-coded?
79- string metricName = $ "{ MeterName . ToLowerInvariant ( ) } _{ payload . Name } ";
81+ string metricName = $ "{ MeterName . ToLowerInvariant ( ) } _{ payload . CounterMetadata . CounterName } ";
8082
8183 Assert . Equal ( 3 , lines . Count ) ;
8284 Assert . Equal ( FormattableString . Invariant ( $ "# HELP { metricName } { payload . Unit } { payload . DisplayName } ") , lines [ 0 ] ) ;
@@ -87,15 +89,16 @@ public async Task GaugeFormat_Test()
8789 [ Fact ]
8890 public async Task CounterFormat_Test ( )
8991 {
90- ICounterPayload payload = new RatePayload ( MeterName , InstrumentName , "DisplayName" , "" , null , Value1 , IntervalSeconds , Timestamp ) ;
92+ ICounterPayload payload = new RatePayload ( new CounterMetadata ( MeterName , InstrumentName , meterTags : null , instrumentTags : null , scopeHash : null ) ,
93+ "DisplayName" , "" , null , Value1 , IntervalSeconds , Timestamp ) ;
9194
9295 MemoryStream stream = await GetMetrics ( new ( ) { payload } ) ;
9396
9497 List < string > lines = ReadStream ( stream ) ;
9598
9699 // Question - this is manually recreating what PrometheusDataModel.GetPrometheusNormalizedName does to get the metric name;
97100 // should we call this method, or should this also be implicitly testing its behavior by having this hard-coded?
98- string metricName = $ "{ MeterName . ToLowerInvariant ( ) } _{ payload . Name } ";
101+ string metricName = $ "{ MeterName . ToLowerInvariant ( ) } _{ payload . CounterMetadata . CounterName } ";
99102
100103 Assert . Equal ( 3 , lines . Count ) ;
101104 Assert . Equal ( $ "# HELP { metricName } { payload . Unit } { payload . DisplayName } ", lines [ 0 ] ) ;
0 commit comments