-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(sdk-metrics) Swap workaround types for @otel/api types #5254
Conversation
|
* | ||
* This is intentionally not using the API's type as it's only available from @opentelemetry/api 1.7.0 and up. | ||
* In SDK 2.0 we'll be able to bump the minimum API version and remove this workaround. | ||
* @experimental |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kept the @experimental
tag since the upstream type is itself @experimental
. If it's not worth it I can also just remove the doc comment altogether.
FWIW, the entire InstrumentDescriptor
interface is marked as @deprecated
in sdk-metrics/index.ts
in favor of MetricDescriptor
, which does not have this field. But since @pichlermarc opened #5224 pretty recently, I assume the intention is to still keep this and carry it forward into 2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it experimental is good - we'll bump it to stable in a separate issue. 👍
The InstrumentDescriptor
is marked as deprecated as we will stop exporting it. Most properties will move to a MetricDescriptor
and InstrumentDescriptor
will extend it for internal use. Issue to follow.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #5254 +/- ##
==========================================
+ Coverage 94.56% 94.57% +0.01%
==========================================
Files 316 316
Lines 8037 8037
Branches 1628 1628
==========================================
+ Hits 7600 7601 +1
+ Misses 437 436 -1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @chancancode, thank you for your contribution 🙂 This looks great already 🙌
Only a changelog entry in CHANGELOG_NEXT.md
is missing then we can get this merged. 🙂
* | ||
* This is intentionally not using the API's type as it's only available from @opentelemetry/api 1.7.0 and up. | ||
* In SDK 2.0 we'll be able to bump the minimum API version and remove this workaround. | ||
* @experimental |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it experimental is good - we'll bump it to stable in a separate issue. 👍
The InstrumentDescriptor
is marked as deprecated as we will stop exporting it. Most properties will move to a MetricDescriptor
and InstrumentDescriptor
will extend it for internal use. Issue to follow.
3f2a9fa
to
230d3eb
Compare
@pichlermarc Should be good to go now. Categorized it as a refactor since these types are internal and the replacements are expected to be compatible. Since I have the context open now, wouldn't mind working on that next refactor, my understanding is (on the
If that sounds good, let me know, save you from creating an issue for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for working on this 🙂
That sounds great 🙌 |
@@ -23,6 +23,7 @@ | |||
|
|||
### :house: (Internal) | |||
|
|||
* refactor(sdk-metrics): remove `Gauge` and `MetricAdvice` workaround types in favor of the upstream `@opentelemetry/api` types [#5254](https://github.com/open-telemetry/opentelemetry-js/pull/5254) @chancancode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah there still needs to be an entry to breaking
as we drop support for old API versions 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, that's right, fixed!
230d3eb
to
16b6389
Compare
The internal `Gauge` and the unnamed `MetricAdvice` types were introduced in the 1.0 series when the metrics package depended on an older version of the api package that didn't come with those types, so the interfaces were essentially vendored into the package for internal use. Now with the 2.0 release on the horrizon, we can bump the required version of @otel/api and is now safe to unvendor these types in favor of the official ones. This is not expected to have any impact on consumers as the types are intended to be compatible for the positions they were used in. However, the minimum requirement for the `@opentelemetry/api` peer dependency has been raised to 1.9.0. Fixes open-telemetry#5223 Fixes open-telemetry#5224
16b6389
to
fd2f57c
Compare
Which problem is this PR solving?
The internal
Gauge
and the unnamedMetricAdvice
types were introduced in the 1.0 series when the metrics package depended on an older version of the api package that didn't come with those types, so the interfaces were essentially vendored into the package for internal use.Now with the 2.0 release on the horrizon, we can bump the required version of @otel/api and is now safe to unvendor these types in favor of the official ones.
This is not expected to have any impact on consumers as the types are intended to be compatible for the positions they were used in.
However, the minimum requirement for the
@opentelemetry/api
peer dependency has been raised to 1.9.0.Fixes #5223
Fixes #5224
Short description of the changes
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist:
Unit tests have been addedN/A – type-only changes