open-telemetry / opentelemetry-php

The OpenTelemetry PHP Library
https://opentelemetry.io/docs/instrumentation/php/
Apache License 2.0
752 stars 186 forks source link

Remove `MeterInterface::isEnabled()` and recreate metric streams on config re-enabling #1387

Closed Nevay closed 1 month ago

Nevay commented 1 month ago

Removes MeterInterface::isEnabled() as it is not part of the spec, metrics API uses Instrument::isEnabled() instead.

Also resolves https://github.com/open-telemetry/opentelemetry-php/pull/1353#discussion_r1688754362 by dropping/recreating metric streams on configuration change.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 44.21053% with 53 lines in your changes missing coverage. Please review.

Project coverage is 73.79%. Comparing base (3be58cf) to head (4af833c). Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/SDK/Metrics/Meter.php 54.41% 31 Missing :warning:
src/SDK/Metrics/MetricRegistry/MetricRegistry.php 0.00% 11 Missing :warning:
src/SDK/Metrics/MetricReader/ExportingReader.php 28.57% 10 Missing :warning:
src/SDK/Metrics/RegisteredInstrument.php 0.00% 1 Missing :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387/graphs/tree.svg?width=650&height=150&src=pr&token=OE661REHqm&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry)](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) ```diff @@ Coverage Diff @@ ## main #1387 +/- ## ============================================ - Coverage 74.16% 73.79% -0.38% - Complexity 2666 2672 +6 ============================================ Files 385 386 +1 Lines 7636 7650 +14 ============================================ - Hits 5663 5645 -18 - Misses 1973 2005 +32 ``` | [Flag](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [8.1](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `73.43% <44.21%> (-0.24%)` | :arrow_down: | | [8.2](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `73.67% <44.21%> (-0.29%)` | :arrow_down: | | [8.3](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `73.73% <44.21%> (-0.32%)` | :arrow_down: | | [8.4](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | `73.68% <44.21%> (-0.22%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | Coverage Δ | | |---|---|---| | [src/API/Metrics/LateBindingMeter.php](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&filepath=src%2FAPI%2FMetrics%2FLateBindingMeter.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL0FQSS9NZXRyaWNzL0xhdGVCaW5kaW5nTWV0ZXIucGhw) | `17.64% <ø> (+1.85%)` | :arrow_up: | | [src/API/Metrics/Noop/NoopMeter.php](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&filepath=src%2FAPI%2FMetrics%2FNoop%2FNoopMeter.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL0FQSS9NZXRyaWNzL05vb3AvTm9vcE1ldGVyLnBocA==) | `0.00% <ø> (ø)` | | | [src/SDK/Metrics/Instrument.php](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&filepath=src%2FSDK%2FMetrics%2FInstrument.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL1NESy9NZXRyaWNzL0luc3RydW1lbnQucGhw) | `0.00% <ø> (ø)` | | | [src/SDK/Metrics/MeterProvider.php](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&filepath=src%2FSDK%2FMetrics%2FMeterProvider.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL1NESy9NZXRyaWNzL01ldGVyUHJvdmlkZXIucGhw) | `91.83% <ø> (ø)` | | | [...c/SDK/Metrics/MetricFactory/StreamMetricSource.php](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&filepath=src%2FSDK%2FMetrics%2FMetricFactory%2FStreamMetricSource.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL1NESy9NZXRyaWNzL01ldHJpY0ZhY3RvcnkvU3RyZWFtTWV0cmljU291cmNlLnBocA==) | `100.00% <ø> (+13.33%)` | :arrow_up: | | [src/SDK/Metrics/ObservableInstrumentTrait.php](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&filepath=src%2FSDK%2FMetrics%2FObservableInstrumentTrait.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL1NESy9NZXRyaWNzL09ic2VydmFibGVJbnN0cnVtZW50VHJhaXQucGhw) | `87.50% <ø> (+4.16%)` | :arrow_up: | | [src/SDK/Metrics/SynchronousInstrumentTrait.php](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&filepath=src%2FSDK%2FMetrics%2FSynchronousInstrumentTrait.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL1NESy9NZXRyaWNzL1N5bmNocm9ub3VzSW5zdHJ1bWVudFRyYWl0LnBocA==) | `86.66% <100.00%> (-2.23%)` | :arrow_down: | | [src/SDK/Metrics/RegisteredInstrument.php](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&filepath=src%2FSDK%2FMetrics%2FRegisteredInstrument.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL1NESy9NZXRyaWNzL1JlZ2lzdGVyZWRJbnN0cnVtZW50LnBocA==) | `0.00% <0.00%> (ø)` | | | [src/SDK/Metrics/MetricReader/ExportingReader.php](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&filepath=src%2FSDK%2FMetrics%2FMetricReader%2FExportingReader.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL1NESy9NZXRyaWNzL01ldHJpY1JlYWRlci9FeHBvcnRpbmdSZWFkZXIucGhw) | `73.43% <28.57%> (-0.41%)` | :arrow_down: | | [src/SDK/Metrics/MetricRegistry/MetricRegistry.php](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree&filepath=src%2FSDK%2FMetrics%2FMetricRegistry%2FMetricRegistry.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry#diff-c3JjL1NESy9NZXRyaWNzL01ldHJpY1JlZ2lzdHJ5L01ldHJpY1JlZ2lzdHJ5LnBocA==) | `74.41% <0.00%> (-0.31%)` | :arrow_down: | | ... and [1 more](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) | | ... and [5 files with indirect coverage changes](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry). Last update [3be58cf...4af833c](https://app.codecov.io/gh/open-telemetry/opentelemetry-php/pull/1387?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=open-telemetry).