@@ -92,6 +92,34 @@ public void AddViewWithNullMetricStreamConfigurationThrowsArgumentnullException(
92
92
. Build ( ) ) ;
93
93
}
94
94
95
+ [ Fact ]
96
+ public void AddViewWithNameThrowsInvalidArgumentExceptionWhenConflict ( )
97
+ {
98
+ var exportedItems = new List < Metric > ( ) ;
99
+
100
+ using var meter1 = new Meter ( "AddViewWithGuaranteedConflictThrowsInvalidArgumentException" ) ;
101
+
102
+ Assert . Throws < ArgumentException > ( ( ) => Sdk . CreateMeterProviderBuilder ( )
103
+ . AddMeter ( meter1 . Name )
104
+ . AddView ( "instrumenta.*" , name : "newname" )
105
+ . AddInMemoryExporter ( exportedItems )
106
+ . Build ( ) ) ;
107
+ }
108
+
109
+ [ Fact ]
110
+ public void AddViewWithNameInMetricStreamConfigurationThrowsInvalidArgumentExceptionWhenConflict ( )
111
+ {
112
+ var exportedItems = new List < Metric > ( ) ;
113
+
114
+ using var meter1 = new Meter ( "AddViewWithGuaranteedConflictThrowsInvalidArgumentException" ) ;
115
+
116
+ Assert . Throws < ArgumentException > ( ( ) => Sdk . CreateMeterProviderBuilder ( )
117
+ . AddMeter ( meter1 . Name )
118
+ . AddView ( "instrumenta.*" , new MetricStreamConfiguration ( ) { Name = "newname" } )
119
+ . AddInMemoryExporter ( exportedItems )
120
+ . Build ( ) ) ;
121
+ }
122
+
95
123
[ Theory ]
96
124
[ MemberData ( nameof ( MetricTestData . InvalidHistogramBoundaries ) , MemberType = typeof ( MetricTestData ) ) ]
97
125
public void AddViewWithInvalidHistogramBoundsThrowsArgumentException ( double [ ] boundaries )
@@ -277,33 +305,6 @@ public void ViewWithNullCustomNameTakesInstrumentName()
277
305
Assert . Equal ( counter1 . Name , metric . Name ) ;
278
306
}
279
307
280
- [ Fact ]
281
- public void ViewToRenameMetricWildCardMatch ( )
282
- {
283
- using var meter = new Meter ( Utils . GetCurrentMethodName ( ) ) ;
284
- var exportedItems = new List < Metric > ( ) ;
285
- using var meterProvider = Sdk . CreateMeterProviderBuilder ( )
286
- . AddMeter ( meter . Name )
287
- . AddView ( "counter*" , "renamed" )
288
- . AddInMemoryExporter ( exportedItems )
289
- . Build ( ) ;
290
-
291
- // Expecting one metric stream.
292
- var counter1 = meter . CreateCounter < long > ( "counterA" ) ;
293
- counter1 . Add ( 10 ) ;
294
- var counter2 = meter . CreateCounter < long > ( "counterB" ) ;
295
- counter2 . Add ( 10 ) ;
296
- var counter3 = meter . CreateCounter < long > ( "counterC" ) ;
297
- counter3 . Add ( 10 ) ;
298
- meterProvider . ForceFlush ( MaxTimeToAllowForFlush ) ;
299
-
300
- // counter* matches all 3 instruments which all
301
- // becomes "renamed" and only 1st one is exported.
302
- Assert . Single ( exportedItems ) ;
303
- var metric = exportedItems [ 0 ] ;
304
- Assert . Equal ( "renamed" , metric . Name ) ;
305
- }
306
-
307
308
[ Fact ]
308
309
public void ViewToProduceMultipleStreamsFromInstrument ( )
309
310
{
0 commit comments