diff --git a/CHANGELOG.md b/CHANGELOG.md index c674113cb16..339c74894a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), @@ -16,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#2363](https://github.com/open-telemetry/opentelemetry-python/pull/2363)) - [exporter/opentelemetry-exporter-otlp-proto-grpc] Add Sum to OTLPMetricExporter ([#2370](https://github.com/open-telemetry/opentelemetry-python/pull/2370)) +- [api] Rename `_DefaultMeter` and `_DefaultMeterProvider` to `NoOpMeter` and `NoOpMeterProvider`. + ([#2383](https://github.com/open-telemetry/opentelemetry-python/pull/2383)) ## [1.8.0-0.27b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.8.0-0.27b0) - 2021-12-17 @@ -38,7 +41,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.7.1-0.26b1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.7.0-0.26b0) - 2021-11-11 - - Add support for Python 3.10 ([#2207](https://github.com/open-telemetry/opentelemetry-python/pull/2207)) - remove `X-B3-ParentSpanId` for B3 propagator as per OpenTelemetry specification @@ -110,10 +112,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add name to `BatchSpanProcessor` worker thread ([#2186](https://github.com/open-telemetry/opentelemetry-python/pull/2186)) - ## [1.5.0-0.24b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.5.0-0.24b0) - 2021-08-26 - - Add pre and post instrumentation entry points ([#1983](https://github.com/open-telemetry/opentelemetry-python/pull/1983)) - Fix documentation on well known exporters and variable OTEL_TRACES_EXPORTER which were misnamed @@ -141,12 +141,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.23.1](https://github.com/open-telemetry/opentelemetry-python/pull/1987) - 2021-07-26 ### Changed + - Fix opentelemetry-bootstrap dependency script. ([#1987](https://github.com/open-telemetry/opentelemetry-python/pull/1987)) ## [1.4.0-0.23b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.4.0-0.23b0) - 2021-07-21 ### Added + - Moved `opentelemetry-instrumentation` to core repository. ([#1959](https://github.com/open-telemetry/opentelemetry-python/pull/1959)) - Add support for OTLP Exporter Protobuf over HTTP @@ -157,6 +159,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1893](https://github.com/open-telemetry/opentelemetry-python/pull/1893)) ### Added + - Give OTLPHandler the ability to process attributes ([#1952](https://github.com/open-telemetry/opentelemetry-python/pull/1952)) - Add global LogEmitterProvider and convenience function get_log_emitter @@ -165,6 +168,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1903](https://github.com/open-telemetry/opentelemetry-python/pull/1903)) ### Changed + - Updated `opentelemetry-opencensus-exporter` to use `service_name` of spans instead of resource ([#1897](https://github.com/open-telemetry/opentelemetry-python/pull/1897)) - Added descriptions to the env variables mentioned in the opentelemetry-specification @@ -187,6 +191,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1946](https://github.com/open-telemetry/opentelemetry-python/pull/1946)) ### Fixed + - Updated `opentelementry-opentracing-shim` `ScopeShim` to report exceptions in opentelemetry specification format, rather than opentracing spec format. ([#1878](https://github.com/open-telemetry/opentelemetry-python/pull/1878)) @@ -194,12 +199,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.3.0-0.22b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.3.0-0.22b0) - 2021-06-01 ### Added + - Allow span limits to be set programatically via TracerProvider. ([#1877](https://github.com/open-telemetry/opentelemetry-python/pull/1877)) - Added support for CreateKey functionality. ([#1853](https://github.com/open-telemetry/opentelemetry-python/pull/1853)) ### Changed + - Updated get_tracer to return an empty string when passed an invalid name ([#1854](https://github.com/open-telemetry/opentelemetry-python/pull/1854)) - Changed AttributeValue sequences to warn mypy users on adding None values to array @@ -214,6 +221,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.2.0, 0.21b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.2.0-0.21b0) - 2021-05-11 ### Added + - Added example for running Django with auto instrumentation. ([#1803](https://github.com/open-telemetry/opentelemetry-python/pull/1803)) - Added `B3SingleFormat` and `B3MultiFormat` propagators to the `opentelemetry-propagator-b3` package. @@ -226,6 +234,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1863](https://github.com/open-telemetry/opentelemetry-python/pull/1863)) ### Changed + - Fixed OTLP gRPC exporter silently failing if scheme is not specified in endpoint. ([#1806](https://github.com/open-telemetry/opentelemetry-python/pull/1806)) - Rename CompositeHTTPPropagator to CompositePropagator as per specification. @@ -253,12 +262,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1856](https://github.com/open-telemetry/opentelemetry-python/pull/1856)) ### Removed + - Moved `opentelemetry-instrumentation` to contrib repository. ([#1797](https://github.com/open-telemetry/opentelemetry-python/pull/1797)) ## [1.1.0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.1.0) - 2021-04-20 ### Added + - Added `py.typed` file to every package. This should resolve a bunch of mypy errors for users. ([#1720](https://github.com/open-telemetry/opentelemetry-python/pull/1720)) @@ -273,6 +284,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1799](https://github.com/open-telemetry/opentelemetry-python/pull/1799)) ### Changed + - Adjust `B3Format` propagator to be spec compliant by not modifying context when propagation headers are not present/invalid/empty ([#1728](https://github.com/open-telemetry/opentelemetry-python/pull/1728)) @@ -297,6 +309,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.0.0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.0.0) - 2021-03-26 ### Added + - Document how to work with fork process web server models(Gunicorn, uWSGI etc...) ([#1609](https://github.com/open-telemetry/opentelemetry-python/pull/1609)) - Add `max_attr_value_length` support to Jaeger exporter @@ -310,6 +323,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1500](https://github.com/open-telemetry/opentelemetry-python/pull/1500)) ### Changed + - remove `service_name` from constructor of jaeger and opencensus exporters and use of env variable `OTEL_PYTHON_SERVICE_NAME` ([#1669])(https://github.com/open-telemetry/opentelemetry-python/pull/1669) @@ -368,6 +382,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1690](https://github.com/open-telemetry/opentelemetry-python/pull/1690)) ### Removed + - Removed unused `get_hexadecimal_trace_id` and `get_hexadecimal_span_id` methods. ([#1675](https://github.com/open-telemetry/opentelemetry-python/pull/1675)) - Remove `OTEL_EXPORTER_*_ INSECURE` env var @@ -378,6 +393,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.19b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.19b0) - 2021-03-26 ### Changed + - remove `service_name` from constructor of jaeger and opencensus exporters and use of env variable `OTEL_PYTHON_SERVICE_NAME` ([#1669])(https://github.com/open-telemetry/opentelemetry-python/pull/1669) @@ -385,18 +401,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1651](https://github.com/open-telemetry/opentelemetry-python/pull/1651)) ### Removed + - Removing support for Python 3.5 ([#1706](https://github.com/open-telemetry/opentelemetry-python/pull/1706)) ## [0.18b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.18b0) - 2021-02-16 ### Added + - Add urllib to opentelemetry-bootstrap target list ([#1584](https://github.com/open-telemetry/opentelemetry-python/pull/1584)) ## [1.0.0rc1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.0.0rc1) - 2021-02-12 ### Changed + - Tracer provider environment variables are now consistent with the rest ([#1571](https://github.com/open-telemetry/opentelemetry-python/pull/1571)) - Rename `TRACE_` to `TRACES_` for environment variables @@ -409,6 +428,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1521](https://github.com/open-telemetry/opentelemetry-python/pull/1521)) ### Added + - Added `end_on_exit` argument to `start_as_current_span` ([#1519](https://github.com/open-telemetry/opentelemetry-python/pull/1519)) - Add `Span.set_attributes` method to set multiple values with one call @@ -419,6 +439,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1545](https://github.com/open-telemetry/opentelemetry-python/pull/1545)) ### Removed + - Remove Configuration ([#1523](https://github.com/open-telemetry/opentelemetry-python/pull/1523)) - Remove Metrics as part of stable, marked as experimental @@ -427,6 +448,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.17b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.17b0) - 2021-01-20 ### Added + - Add support for OTLP v0.6.0 ([#1472](https://github.com/open-telemetry/opentelemetry-python/pull/1472)) - Add protobuf via gRPC exporting support for Jaeger @@ -439,7 +461,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1374](https://github.com/open-telemetry/opentelemetry-python/pull/1374)) - Add local/remote samplers to parent based sampler ([#1440](https://github.com/open-telemetry/opentelemetry-python/pull/1440)) -- Add support for OTEL_SPAN_{ATTRIBUTE_COUNT_LIMIT,EVENT_COUNT_LIMIT,LINK_COUNT_LIMIT} +- Add support for OTEL*SPAN*{ATTRIBUTE_COUNT_LIMIT,EVENT_COUNT_LIMIT,LINK_COUNT_LIMIT} ([#1377](https://github.com/open-telemetry/opentelemetry-python/pull/1377)) - Return `None` for `DictGetter` if key not found ([#1449](https://github.com/open-telemetry/opentelemetry-python/pull/1449)) @@ -460,6 +482,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1482](https://github.com/open-telemetry/opentelemetry-python/pull/1482)) ### Changed + - `opentelemetry-exporter-zipkin` Updated zipkin exporter status code and error tag ([#1486](https://github.com/open-telemetry/opentelemetry-python/pull/1486)) - Recreate span on every run of a `start_as_current_span`-decorated function @@ -491,15 +514,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1544](https://github.com/open-telemetry/opentelemetry-python/pull/1544)) ### Removed + - `opentelemetry-api` Remove ThreadLocalRuntimeContext since python3.4 is not supported. ## [0.16b1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.16b1) - 2020-11-26 + ### Added + - Add meter reference to observers ([#1425](https://github.com/open-telemetry/opentelemetry-python/pull/1425)) ## [0.16b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.16b0) - 2020-11-25 + ### Added + - Add optional parameter to `record_exception` method ([#1314](https://github.com/open-telemetry/opentelemetry-python/pull/1314)) - Add pickle support to SpanContext class @@ -514,7 +542,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1404](https://github.com/open-telemetry/opentelemetry-python/pull/1404)) - Added support for `OTEL_EXPORTER` to the `opentelemetry-instrument` command ([#1036](https://github.com/open-telemetry/opentelemetry-python/pull/1036)) + ### Changed + - Change temporality for Counter and UpDownCounter ([#1384](https://github.com/open-telemetry/opentelemetry-python/pull/1384)) - OTLP exporter: Handle error case when no credentials supplied @@ -542,6 +572,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.15b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.15b0) -2020-11-02 ### Added + - Add Env variables in OTLP exporter ([#1101](https://github.com/open-telemetry/opentelemetry-python/pull/1101)) - Add support for Jaeger Span Exporter configuration by environment variables and
@@ -549,6 +580,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1114](https://github.com/open-telemetry/opentelemetry-python/pull/1114)) ### Changed + - Updating status codes to adhere to specs ([#1282](https://github.com/open-telemetry/opentelemetry-python/pull/1282)) - Set initial checkpoint timestamp in aggregators @@ -571,6 +603,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.14b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.14b0) - 2020-10-13 ### Added + - Add optional parameter to `record_exception` method ([#1242](https://github.com/open-telemetry/opentelemetry-python/pull/1242)) - Add support for `OTEL_PROPAGATORS` @@ -585,8 +618,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1105](https://github.com/open-telemetry/opentelemetry-python/pull/1120)) - Adding Resource to MeterRecord ([#1209](https://github.com/open-telemetry/opentelemetry-python/pull/1209)) -s + s + ### Changed + - Store `int`s as `int`s in the global Configuration object ([#1118](https://github.com/open-telemetry/opentelemetry-python/pull/1118)) - Allow for Custom Trace and Span IDs Generation - `IdsGenerator` for TracerProvider @@ -599,7 +634,7 @@ s ([#1146](https://github.com/open-telemetry/opentelemetry-python/pull/1146)) - Update OpenTelemetry protos to v0.5.0 ([#1143](https://github.com/open-telemetry/opentelemetry-python/pull/1143)) -- Zipkin exporter now accepts a ``max_tag_value_length`` attribute to customize the +- Zipkin exporter now accepts a `max_tag_value_length` attribute to customize the maximum allowed size a tag value can have. ([#1151](https://github.com/open-telemetry/opentelemetry-python/pull/1151)) - Fixed OTLP events to Zipkin annotations translation. @@ -620,6 +655,7 @@ s ## [0.13b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.13b0) - 2020-09-17 ### Added + - Add instrumentation info to exported spans ([#1095](https://github.com/open-telemetry/opentelemetry-python/pull/1095)) - Add metric OTLP exporter @@ -643,6 +679,7 @@ s ([#1053](https://github.com/open-telemetry/opentelemetry-python/pull/1053)) ### Changed + - Refactor `SpanContext.is_valid` from a method to a data attribute ([#1005](https://github.com/open-telemetry/opentelemetry-python/pull/1005)) - Moved samplers from API to SDK @@ -670,16 +707,19 @@ s ([#1096](https://github.com/open-telemetry/opentelemetry-python/pull/1096)) ### Removed + - Drop support for Python 3.4 ([#1099](https://github.com/open-telemetry/opentelemetry-python/pull/1099)) ## [0.12b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.12.0) - 2020-08-14 ### Added + - Implement Views in metrics SDK ([#596](https://github.com/open-telemetry/opentelemetry-python/pull/596)) ### Changed + - Update environment variable names, prefix changed from `OPENTELEMETRY` to `OTEL` ([#904](https://github.com/open-telemetry/opentelemetry-python/pull/904)) - Stop TracerProvider and MeterProvider from being overridden @@ -706,9 +746,12 @@ s ## [0.11b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.11.0) - 2020-07-28 ### Added + - Add support for resources and resource detector ([#853](https://github.com/open-telemetry/opentelemetry-python/pull/853)) + ### Changed + - Return INVALID_SPAN if no TracerProvider set for get_current_span ([#751](https://github.com/open-telemetry/opentelemetry-python/pull/751)) - Rename record_error to record_exception @@ -719,6 +762,7 @@ s ## [0.10b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.10.0) - 2020-06-23 ### Changed + - Regenerate proto code and add pyi stubs ([#823](https://github.com/open-telemetry/opentelemetry-python/pull/823)) - Rename CounterAggregator -> SumAggregator @@ -727,6 +771,7 @@ s ## [0.9b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.9.0) - 2020-06-10 ### Added + - Adding trace.get_current_span, Removing Tracer.get_current_span ([#552](https://github.com/open-telemetry/opentelemetry-python/pull/552)) - Add SumObserver, UpDownSumObserver and LastValueAggregator in metrics @@ -734,7 +779,9 @@ s - Add start_pipeline to MeterProvider ([#791](https://github.com/open-telemetry/opentelemetry-python/pull/791)) - Initial release of opentelemetry-ext-otlp, opentelemetry-proto + ### Changed + - Move stateful & resource from Meter to MeterProvider ([#751](https://github.com/open-telemetry/opentelemetry-python/pull/751)) - Rename Measure to ValueRecorder in metrics @@ -751,10 +798,12 @@ s ## [0.8b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.8.0) - 2020-05-27 ### Added + - Add a new bootstrap command that enables automatic instrument installations. ([#650](https://github.com/open-telemetry/opentelemetry-python/pull/650)) ### Changed + - Handle boolean, integer and float values in Configuration ([#662](https://github.com/open-telemetry/opentelemetry-python/pull/662)) - bugfix: ensure status is always string @@ -783,12 +832,14 @@ s ## [0.7b1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.7.1) - 2020-05-12 ### Added + - Add reset for the global configuration object, for testing purposes ([#636](https://github.com/open-telemetry/opentelemetry-python/pull/636)) - Add support for programmatic instrumentation ([#579](https://github.com/open-telemetry/opentelemetry-python/pull/569)) ### Changed + - tracer.get_tracer now optionally accepts a TracerProvider ([#602](https://github.com/open-telemetry/opentelemetry-python/pull/602)) - Configuration object can now be used by any component of opentelemetry, @@ -826,6 +877,7 @@ s ## [0.6b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.6.0) - 2020-03-30 ### Added + - Add support for lazy events and links ([#474](https://github.com/open-telemetry/opentelemetry-python/pull/474)) - Adding is_remote flag to SpanContext, indicating when a span is remote @@ -835,6 +887,7 @@ s - Initial release: opentelemetry-instrumentation ### Changed + - Metrics API no longer uses LabelSet ([#527](https://github.com/open-telemetry/opentelemetry-python/pull/527)) - Allow digit as first char in vendor specific trace state key @@ -845,6 +898,7 @@ s ## [0.5b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.5.0) - 2020-03-16 ### Added + - Adding Correlation Context API/SDK and propagator ([#471](https://github.com/open-telemetry/opentelemetry-python/pull/471)) - Adding a global configuration module to simplify setting and getting globals @@ -858,6 +912,7 @@ s - Initial release opentelemetry-ext-otcollector ### Changed + - Rename metric handle to bound metric instrument ([#470](https://github.com/open-telemetry/opentelemetry-python/pull/470)) - Moving resources to sdk @@ -878,6 +933,7 @@ s ## [0.4a0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.4.0) - 2020-02-21 ### Added + - Added named Tracers ([#301](https://github.com/open-telemetry/opentelemetry-python/pull/301)) - Add int and valid sequenced to AttributeValue type @@ -899,6 +955,7 @@ s - Initial release opentelemetry-ext-zipkin, opentelemetry-ext-prometheus ### Changed + - Separate Default classes from interface descriptions ([#311](https://github.com/open-telemetry/opentelemetry-python/pull/311)) - Export span status @@ -924,28 +981,33 @@ s ([#238](https://github.com/open-telemetry/opentelemetry-python/pull/238)) ### Removed + - Remove monotonic and absolute metric instruments ([#410](https://github.com/open-telemetry/opentelemetry-python/pull/410)) ## [0.3a0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.3.0) - 2019-12-11 ### Added + - Add metrics exporters ([#192](https://github.com/open-telemetry/opentelemetry-python/pull/192)) - Implement extract and inject support for HTTP_HEADERS and TEXT_MAP formats ([#256](https://github.com/open-telemetry/opentelemetry-python/pull/256)) ### Changed + - Multiple tracing API/SDK changes - Multiple metrics API/SDK changes ### Removed + - Remove option to create unstarted spans from API ([#290](https://github.com/open-telemetry/opentelemetry-python/pull/290)) ## [0.2a0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.2.0) - 2019-10-29 ### Added + - W3C TraceContext fixes and compliance tests ([#228](https://github.com/open-telemetry/opentelemetry-python/pull/228)) - Sampler API/SDK @@ -953,6 +1015,7 @@ s - Initial release: opentelemetry-ext-jaeger, opentelemetry-opentracing-shim ### Changed + - Multiple metrics API/SDK changes - Multiple tracing API/SDK changes - Multiple context API changes @@ -961,4 +1024,5 @@ s ## [0.1a0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.1.0) - 2019-09-30 ### Added + - Initial release api/sdk diff --git a/opentelemetry-api/setup.cfg b/opentelemetry-api/setup.cfg index 6a0fa67a704..95c2092cb9f 100644 --- a/opentelemetry-api/setup.cfg +++ b/opentelemetry-api/setup.cfg @@ -56,7 +56,7 @@ opentelemetry_context = opentelemetry_tracer_provider = default_tracer_provider = opentelemetry.trace:NoOpTracerProvider opentelemetry_meter_provider = - default_meter_provider = opentelemetry._metrics:_DefaultMeterProvider + default_meter_provider = opentelemetry._metrics:NoOpMeterProvider opentelemetry_propagator = tracecontext = opentelemetry.trace.propagation.tracecontext:TraceContextTextMapPropagator baggage = opentelemetry.baggage.propagation:W3CBaggagePropagator diff --git a/opentelemetry-api/src/opentelemetry/_metrics/__init__.py b/opentelemetry-api/src/opentelemetry/_metrics/__init__.py index 54281de9537..4fd4b22988c 100644 --- a/opentelemetry-api/src/opentelemetry/_metrics/__init__.py +++ b/opentelemetry-api/src/opentelemetry/_metrics/__init__.py @@ -69,7 +69,7 @@ def get_meter( pass -class _DefaultMeterProvider(MeterProvider): +class NoOpMeterProvider(MeterProvider): def get_meter( self, name, @@ -77,7 +77,7 @@ def get_meter( schema_url=None, ) -> "Meter": super().get_meter(name, version=version, schema_url=schema_url) - return _DefaultMeter(name, version=version, schema_url=schema_url) + return NoOpMeter(name, version=version, schema_url=schema_url) class _ProxyMeterProvider(MeterProvider): @@ -346,7 +346,7 @@ def create_observable_up_down_counter( return proxy -class _DefaultMeter(Meter): +class NoOpMeter(Meter): def create_counter(self, name, unit="", description="") -> Counter: super().create_counter(name, unit=unit, description=description) return DefaultCounter(name, unit=unit, description=description) diff --git a/opentelemetry-api/tests/metrics/test_instruments.py b/opentelemetry-api/tests/metrics/test_instruments.py index f3a79aec462..b97a1640bd5 100644 --- a/opentelemetry-api/tests/metrics/test_instruments.py +++ b/opentelemetry-api/tests/metrics/test_instruments.py @@ -16,7 +16,7 @@ from inspect import Signature, isabstract, signature from unittest import TestCase -from opentelemetry._metrics import Meter, _DefaultMeter +from opentelemetry._metrics import Meter, NoOpMeter from opentelemetry._metrics.instrument import ( Counter, DefaultCounter, @@ -47,7 +47,7 @@ def test_create_counter(self): """ self.assertTrue( - isinstance(_DefaultMeter("name").create_counter("name"), Counter) + isinstance(NoOpMeter("name").create_counter("name"), Counter) ) def test_api_counter_abstract(self): @@ -117,7 +117,7 @@ def callback(): self.assertTrue( isinstance( - _DefaultMeter("name").create_observable_counter( + NoOpMeter("name").create_observable_counter( "name", callback() ), ObservableCounter, @@ -211,9 +211,7 @@ def test_create_histogram(self): """ self.assertTrue( - isinstance( - _DefaultMeter("name").create_histogram("name"), Histogram - ) + isinstance(NoOpMeter("name").create_histogram("name"), Histogram) ) def test_api_histogram_abstract(self): @@ -287,9 +285,7 @@ def callback(): self.assertTrue( isinstance( - _DefaultMeter("name").create_observable_gauge( - "name", callback() - ), + NoOpMeter("name").create_observable_gauge("name", callback()), ObservableGauge, ) ) @@ -379,7 +375,7 @@ def test_create_up_down_counter(self): self.assertTrue( isinstance( - _DefaultMeter("name").create_up_down_counter("name"), + NoOpMeter("name").create_up_down_counter("name"), UpDownCounter, ) ) @@ -464,7 +460,7 @@ def callback(): self.assertTrue( isinstance( - _DefaultMeter("name").create_observable_up_down_counter( + NoOpMeter("name").create_observable_up_down_counter( "name", callback() ), ObservableUpDownCounter, diff --git a/opentelemetry-api/tests/metrics/test_meter_provider.py b/opentelemetry-api/tests/metrics/test_meter_provider.py index e2a19968107..17325c4c03a 100644 --- a/opentelemetry-api/tests/metrics/test_meter_provider.py +++ b/opentelemetry-api/tests/metrics/test_meter_provider.py @@ -20,8 +20,8 @@ from opentelemetry import _metrics as metrics from opentelemetry._metrics import ( - _DefaultMeter, - _DefaultMeterProvider, + NoOpMeter, + NoOpMeterProvider, _ProxyMeter, _ProxyMeterProvider, get_meter_provider, @@ -108,7 +108,7 @@ def test_get_meter_parameters(self): Test that get_meter accepts name, version and schema_url """ try: - _DefaultMeterProvider().get_meter( + NoOpMeterProvider().get_meter( "name", version="version", schema_url="schema_url" ) except Exception as error: @@ -125,15 +125,15 @@ def test_invalid_name(self): Test that a message is logged reporting the specified value for the fallback meter is invalid. """ - meter = _DefaultMeterProvider().get_meter("") + meter = NoOpMeterProvider().get_meter("") - self.assertTrue(isinstance(meter, _DefaultMeter)) + self.assertTrue(isinstance(meter, NoOpMeter)) self.assertEqual(meter.name, "") - meter = _DefaultMeterProvider().get_meter(None) + meter = NoOpMeterProvider().get_meter(None) - self.assertTrue(isinstance(meter, _DefaultMeter)) + self.assertTrue(isinstance(meter, NoOpMeter)) self.assertEqual(meter.name, None) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py index 56b0ad704f5..626806cee27 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/__init__.py @@ -19,7 +19,7 @@ from opentelemetry._metrics import Meter as APIMeter from opentelemetry._metrics import MeterProvider as APIMeterProvider -from opentelemetry._metrics import _DefaultMeter +from opentelemetry._metrics import NoOpMeter from opentelemetry._metrics.instrument import Counter as APICounter from opentelemetry._metrics.instrument import Histogram as APIHistogram from opentelemetry._metrics.instrument import ( @@ -221,7 +221,7 @@ def get_meter( _logger.warning( "A shutdown `MeterProvider` can not provide a `Meter`" ) - return _DefaultMeter(name, version=version, schema_url=schema_url) + return NoOpMeter(name, version=version, schema_url=schema_url) info = InstrumentationInfo(name, version, schema_url) with self._meter_lock: