-
Notifications
You must be signed in to change notification settings - Fork 833
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
feat(opentelemetry-api-metrics): Adding generics to create{metricType}
#3170
Conversation
|
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!
Would you mind adding type conformance tests like https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-sdk-trace-base/test/common/Sampler.test.ts#L39?
experimental/packages/opentelemetry-api-metrics/src/types/Metric.ts
Outdated
Show resolved
Hide resolved
Do you mean to check every implementation of every Metric type (Counter, Histogram, etc ...)? The error should be in "compile time", so I am not sure how to test it. I understand that the example test checks the values are the expected type, no? |
You can use the |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3170 +/- ##
=======================================
Coverage 93.30% 93.30%
=======================================
Files 203 203
Lines 6606 6606
Branches 1389 1389
=======================================
Hits 6164 6164
Misses 442 442
|
experimental/packages/opentelemetry-api-metrics/src/NoopMeter.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-metrics/src/types/Meter.ts
Outdated
Show resolved
Hide resolved
Any update on @legendecas's comments here? |
Removed the NOOP generic and added the tests. |
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.
Overall LGTM. Thank you for working on this. Just a few nits.
experimental/packages/opentelemetry-api-metrics/test/types/Metric.test.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-metrics/src/types/ObservableResult.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-metrics/src/types/ObservableResult.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-metrics/src/types/Meter.ts
Outdated
Show resolved
Hide resolved
experimental/packages/opentelemetry-api-metrics/test/types/Metric.test.ts
Outdated
Show resolved
Hide resolved
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!
Linter is complaining. A format is required. |
Re-ran tests. Flaky test should be fixed by https://github.com/open-telemetry/opentelemetry-js/pull/3242/files |
Which problem is this PR solving?
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes #3151
Short description of the changes
Added generic to
create{metricType}
methods a the types or the metrics.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
create{metricType}
, it doesn't require labels as a must.create{metricType}
with labels, the labels are a must.Checklist: