30
30
31
31
from opentelemetry ._metrics .instrument import (
32
32
Counter ,
33
- DefaultCounter ,
34
- DefaultHistogram ,
35
- DefaultObservableCounter ,
36
- DefaultObservableGauge ,
37
- DefaultObservableUpDownCounter ,
38
- DefaultUpDownCounter ,
39
33
Histogram ,
34
+ NoOpCounter ,
35
+ NoOpHistogram ,
36
+ NoOpObservableCounter ,
37
+ NoOpObservableGauge ,
38
+ NoOpObservableUpDownCounter ,
39
+ NoOpUpDownCounter ,
40
40
ObservableCounter ,
41
41
ObservableGauge ,
42
42
ObservableUpDownCounter ,
@@ -423,7 +423,7 @@ class NoOpMeter(Meter):
423
423
def create_counter (self , name , unit = "" , description = "" ) -> Counter :
424
424
"""Returns a no-op Counter."""
425
425
super ().create_counter (name , unit = unit , description = description )
426
- if self ._check_instrument_id (name , DefaultCounter , unit , description ):
426
+ if self ._check_instrument_id (name , NoOpCounter , unit , description ):
427
427
_logger .warning (
428
428
"An instrument with name %s, type %s, unit %s and "
429
429
"description %s has been created already." ,
@@ -432,7 +432,7 @@ def create_counter(self, name, unit="", description="") -> Counter:
432
432
unit ,
433
433
description ,
434
434
)
435
- return DefaultCounter (name , unit = unit , description = description )
435
+ return NoOpCounter (name , unit = unit , description = description )
436
436
437
437
def create_up_down_counter (
438
438
self , name , unit = "" , description = ""
@@ -442,7 +442,7 @@ def create_up_down_counter(
442
442
name , unit = unit , description = description
443
443
)
444
444
if self ._check_instrument_id (
445
- name , DefaultUpDownCounter , unit , description
445
+ name , NoOpUpDownCounter , unit , description
446
446
):
447
447
_logger .warning (
448
448
"An instrument with name %s, type %s, unit %s and "
@@ -452,7 +452,7 @@ def create_up_down_counter(
452
452
unit ,
453
453
description ,
454
454
)
455
- return DefaultUpDownCounter (name , unit = unit , description = description )
455
+ return NoOpUpDownCounter (name , unit = unit , description = description )
456
456
457
457
def create_observable_counter (
458
458
self , name , callbacks = None , unit = "" , description = ""
@@ -462,7 +462,7 @@ def create_observable_counter(
462
462
name , callbacks , unit = unit , description = description
463
463
)
464
464
if self ._check_instrument_id (
465
- name , DefaultObservableCounter , unit , description
465
+ name , NoOpObservableCounter , unit , description
466
466
):
467
467
_logger .warning (
468
468
"An instrument with name %s, type %s, unit %s and "
@@ -472,7 +472,7 @@ def create_observable_counter(
472
472
unit ,
473
473
description ,
474
474
)
475
- return DefaultObservableCounter (
475
+ return NoOpObservableCounter (
476
476
name ,
477
477
callbacks ,
478
478
unit = unit ,
@@ -482,9 +482,7 @@ def create_observable_counter(
482
482
def create_histogram (self , name , unit = "" , description = "" ) -> Histogram :
483
483
"""Returns a no-op Histogram."""
484
484
super ().create_histogram (name , unit = unit , description = description )
485
- if self ._check_instrument_id (
486
- name , DefaultHistogram , unit , description
487
- ):
485
+ if self ._check_instrument_id (name , NoOpHistogram , unit , description ):
488
486
_logger .warning (
489
487
"An instrument with name %s, type %s, unit %s and "
490
488
"description %s has been created already." ,
@@ -493,7 +491,7 @@ def create_histogram(self, name, unit="", description="") -> Histogram:
493
491
unit ,
494
492
description ,
495
493
)
496
- return DefaultHistogram (name , unit = unit , description = description )
494
+ return NoOpHistogram (name , unit = unit , description = description )
497
495
498
496
def create_observable_gauge (
499
497
self , name , callbacks = None , unit = "" , description = ""
@@ -503,7 +501,7 @@ def create_observable_gauge(
503
501
name , callbacks , unit = unit , description = description
504
502
)
505
503
if self ._check_instrument_id (
506
- name , DefaultObservableGauge , unit , description
504
+ name , NoOpObservableGauge , unit , description
507
505
):
508
506
_logger .warning (
509
507
"An instrument with name %s, type %s, unit %s and "
@@ -513,7 +511,7 @@ def create_observable_gauge(
513
511
unit ,
514
512
description ,
515
513
)
516
- return DefaultObservableGauge (
514
+ return NoOpObservableGauge (
517
515
name ,
518
516
callbacks ,
519
517
unit = unit ,
@@ -528,7 +526,7 @@ def create_observable_up_down_counter(
528
526
name , callbacks , unit = unit , description = description
529
527
)
530
528
if self ._check_instrument_id (
531
- name , DefaultObservableUpDownCounter , unit , description
529
+ name , NoOpObservableUpDownCounter , unit , description
532
530
):
533
531
_logger .warning (
534
532
"An instrument with name %s, type %s, unit %s and "
@@ -538,7 +536,7 @@ def create_observable_up_down_counter(
538
536
unit ,
539
537
description ,
540
538
)
541
- return DefaultObservableUpDownCounter (
539
+ return NoOpObservableUpDownCounter (
542
540
name ,
543
541
callbacks ,
544
542
unit = unit ,
0 commit comments