@@ -271,7 +271,7 @@ func TestReader(t *testing.T) {
271
271
wantErr : & url.Error {Op : "parse" , URL : " " , Err : errors .New ("invalid URI for request" )},
272
272
},
273
273
{
274
- name : "periodic/grpc-http -none-compression" ,
274
+ name : "periodic/otlp-grpc -none-compression" ,
275
275
reader : MetricReader {
276
276
Periodic : & PeriodicMetricReader {
277
277
Exporter : MetricExporter {
@@ -289,6 +289,86 @@ func TestReader(t *testing.T) {
289
289
},
290
290
wantReader : sdkmetric .NewPeriodicReader (otlpGRPCExporter ),
291
291
},
292
+ {
293
+ name : "periodic/otlp-grpc-delta-temporality" ,
294
+ reader : MetricReader {
295
+ Periodic : & PeriodicMetricReader {
296
+ Exporter : MetricExporter {
297
+ OTLP : & OTLPMetric {
298
+ Protocol : "grpc/protobuf" ,
299
+ Endpoint : "localhost:4318" ,
300
+ Compression : ptr ("none" ),
301
+ Timeout : ptr (1000 ),
302
+ Headers : map [string ]string {
303
+ "test" : "test1" ,
304
+ },
305
+ TemporalityPreference : ptr ("delta" ),
306
+ },
307
+ },
308
+ },
309
+ },
310
+ wantReader : sdkmetric .NewPeriodicReader (otlpGRPCExporter ),
311
+ },
312
+ {
313
+ name : "periodic/otlp-grpc-cumulative-temporality" ,
314
+ reader : MetricReader {
315
+ Periodic : & PeriodicMetricReader {
316
+ Exporter : MetricExporter {
317
+ OTLP : & OTLPMetric {
318
+ Protocol : "grpc/protobuf" ,
319
+ Endpoint : "localhost:4318" ,
320
+ Compression : ptr ("none" ),
321
+ Timeout : ptr (1000 ),
322
+ Headers : map [string ]string {
323
+ "test" : "test1" ,
324
+ },
325
+ TemporalityPreference : ptr ("cumulative" ),
326
+ },
327
+ },
328
+ },
329
+ },
330
+ wantReader : sdkmetric .NewPeriodicReader (otlpGRPCExporter ),
331
+ },
332
+ {
333
+ name : "periodic/otlp-grpc-lowmemory-temporality" ,
334
+ reader : MetricReader {
335
+ Periodic : & PeriodicMetricReader {
336
+ Exporter : MetricExporter {
337
+ OTLP : & OTLPMetric {
338
+ Protocol : "grpc/protobuf" ,
339
+ Endpoint : "localhost:4318" ,
340
+ Compression : ptr ("none" ),
341
+ Timeout : ptr (1000 ),
342
+ Headers : map [string ]string {
343
+ "test" : "test1" ,
344
+ },
345
+ TemporalityPreference : ptr ("lowmemory" ),
346
+ },
347
+ },
348
+ },
349
+ },
350
+ wantReader : sdkmetric .NewPeriodicReader (otlpGRPCExporter ),
351
+ },
352
+ {
353
+ name : "periodic/otlp-grpc-invalid-temporality" ,
354
+ reader : MetricReader {
355
+ Periodic : & PeriodicMetricReader {
356
+ Exporter : MetricExporter {
357
+ OTLP : & OTLPMetric {
358
+ Protocol : "grpc/protobuf" ,
359
+ Endpoint : "localhost:4318" ,
360
+ Compression : ptr ("none" ),
361
+ Timeout : ptr (1000 ),
362
+ Headers : map [string ]string {
363
+ "test" : "test1" ,
364
+ },
365
+ TemporalityPreference : ptr ("invalid" ),
366
+ },
367
+ },
368
+ },
369
+ },
370
+ wantErr : errors .New ("unsupported temporality preference \" invalid\" " ),
371
+ },
292
372
{
293
373
name : "periodic/otlp-grpc-invalid-compression" ,
294
374
reader : MetricReader {
@@ -421,6 +501,86 @@ func TestReader(t *testing.T) {
421
501
},
422
502
wantReader : sdkmetric .NewPeriodicReader (otlpHTTPExporter ),
423
503
},
504
+ {
505
+ name : "periodic/otlp-http-cumulative-temporality" ,
506
+ reader : MetricReader {
507
+ Periodic : & PeriodicMetricReader {
508
+ Exporter : MetricExporter {
509
+ OTLP : & OTLPMetric {
510
+ Protocol : "http/protobuf" ,
511
+ Endpoint : "localhost:4318" ,
512
+ Compression : ptr ("none" ),
513
+ Timeout : ptr (1000 ),
514
+ Headers : map [string ]string {
515
+ "test" : "test1" ,
516
+ },
517
+ TemporalityPreference : ptr ("cumulative" ),
518
+ },
519
+ },
520
+ },
521
+ },
522
+ wantReader : sdkmetric .NewPeriodicReader (otlpHTTPExporter ),
523
+ },
524
+ {
525
+ name : "periodic/otlp-http-lowmemory-temporality" ,
526
+ reader : MetricReader {
527
+ Periodic : & PeriodicMetricReader {
528
+ Exporter : MetricExporter {
529
+ OTLP : & OTLPMetric {
530
+ Protocol : "http/protobuf" ,
531
+ Endpoint : "localhost:4318" ,
532
+ Compression : ptr ("none" ),
533
+ Timeout : ptr (1000 ),
534
+ Headers : map [string ]string {
535
+ "test" : "test1" ,
536
+ },
537
+ TemporalityPreference : ptr ("lowmemory" ),
538
+ },
539
+ },
540
+ },
541
+ },
542
+ wantReader : sdkmetric .NewPeriodicReader (otlpHTTPExporter ),
543
+ },
544
+ {
545
+ name : "periodic/otlp-http-delta-temporality" ,
546
+ reader : MetricReader {
547
+ Periodic : & PeriodicMetricReader {
548
+ Exporter : MetricExporter {
549
+ OTLP : & OTLPMetric {
550
+ Protocol : "http/protobuf" ,
551
+ Endpoint : "localhost:4318" ,
552
+ Compression : ptr ("none" ),
553
+ Timeout : ptr (1000 ),
554
+ Headers : map [string ]string {
555
+ "test" : "test1" ,
556
+ },
557
+ TemporalityPreference : ptr ("delta" ),
558
+ },
559
+ },
560
+ },
561
+ },
562
+ wantReader : sdkmetric .NewPeriodicReader (otlpHTTPExporter ),
563
+ },
564
+ {
565
+ name : "periodic/otlp-http-invalid-temporality" ,
566
+ reader : MetricReader {
567
+ Periodic : & PeriodicMetricReader {
568
+ Exporter : MetricExporter {
569
+ OTLP : & OTLPMetric {
570
+ Protocol : "http/protobuf" ,
571
+ Endpoint : "localhost:4318" ,
572
+ Compression : ptr ("none" ),
573
+ Timeout : ptr (1000 ),
574
+ Headers : map [string ]string {
575
+ "test" : "test1" ,
576
+ },
577
+ TemporalityPreference : ptr ("invalid" ),
578
+ },
579
+ },
580
+ },
581
+ },
582
+ wantErr : errors .New ("unsupported temporality preference \" invalid\" " ),
583
+ },
424
584
{
425
585
name : "periodic/otlp-http-invalid-compression" ,
426
586
reader : MetricReader {
0 commit comments