Skip to content
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(metrics-sdk): rename InstrumentationLibrary -> InstrumentationScope #2959

Conversation

pichlermarc
Copy link
Member

@pichlermarc pichlermarc commented May 10, 2022

Which problem is this PR solving?

The spec renamed InstrumentationLibrary to InstrumentationScope. This PR renames InstrumentationLibrary to InstrumentationScope to match the spec (Metrics ONLY)

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • breaking change for experimental packages

How Has This Been Tested?

  • Unit Tests

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added updated
  • Documentation has been updated

@pichlermarc pichlermarc changed the title refactor(metrics-sdk): rename InstrumenationLibrary -> InstrumenationScope refactor(metrics-sdk): rename InstrumentationLibrary -> InstrumentationScope May 10, 2022
@codecov
Copy link

codecov bot commented May 10, 2022

Codecov Report

Merging #2959 (f37bc81) into main (4c99541) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2959   +/-   ##
=======================================
  Coverage   92.78%   92.78%           
=======================================
  Files         183      183           
  Lines        5921     5921           
  Branches     1257     1257           
=======================================
  Hits         5494     5494           
  Misses        427      427           
Impacted Files Coverage Δ
...elemetry-sdk-metrics-base/src/export/MetricData.ts 100.00% <ø> (ø)
...-metrics-base/src/state/TemporalMetricProcessor.ts 97.91% <ø> (ø)
...ry-exporter-prometheus/src/PrometheusSerializer.ts 95.12% <100.00%> (ø)
...metrics-base/src/state/MeterProviderSharedState.ts 100.00% <100.00%> (ø)
...try-sdk-metrics-base/src/state/MeterSharedState.ts 97.50% <100.00%> (ø)
...etry-sdk-metrics-base/src/state/MetricCollector.ts 100.00% <100.00%> (ø)
...ckages/opentelemetry-sdk-metrics-base/src/utils.ts 100.00% <100.00%> (ø)
...elemetry-sdk-metrics-base/src/view/ViewRegistry.ts 100.00% <100.00%> (ø)
.../packages/otlp-transformer/src/metrics/internal.ts 98.07% <100.00%> (ø)

@pichlermarc pichlermarc marked this pull request as ready for review May 10, 2022 15:00
@pichlermarc pichlermarc requested a review from a team May 10, 2022 15:00
CHANGELOG.md Outdated
@@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
* feat: warn when hooked module is already loaded [#2926](https://github.com/open-telemetry/opentelemetry-js/pull/2926) @nozik
* feat: implement OSDetector [#2927](https://github.com/open-telemetry/opentelemetry-js/pull/2927) @rauno56
* feat: implement HostDetector [#2921](https://github.com/open-telemetry/opentelemetry-js/pull/2921) @rauno56
* refactor(metrics-sdk): rename InstrumentationLibrary -> InstrumentationScope [#2959](https://github.com/open-telemetry/opentelemetry-js/pull/2959) @pichlermarc
Copy link
Member

@legendecas legendecas May 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two CHANGELOG files: one in the root directory and one in the exprimental/. I find that people tend to overlook the one in the experimental/ directory. Maybe we should merge those two.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also picked the wrong one more than once. 😅

However, I added this entry in both CHANGELOG.md files intentionally as it adds InstrumentationScope to @opentelemetry/core (enhancement for stable), but also changes field names in the Metrics SDK (breaking for experimental).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case you should modify both changelog files like you did.

There are two CHANGELOG files: one in the root directory and one in the exprimental/. I find that people tend to overlook the one in the experimental/ directory. Maybe we should merge those two.

I thought about this, but I think it makes for a confusing changelog file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* refactor(metrics-sdk): rename InstrumentationLibrary -> InstrumentationScope [#2959](https://github.com/open-telemetry/opentelemetry-js/pull/2959) @pichlermarc
* `@opentelemetry/core`: add InstrumentationScope [#2959](https://github.com/open-telemetry/opentelemetry-js/pull/2959) @pichlermarc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the changelog entry for stable in b5296d9 🙂

Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big PR but most renames like this are. LGTM and I don't think any were missed.

CHANGELOG.md Outdated
@@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
* feat: warn when hooked module is already loaded [#2926](https://github.com/open-telemetry/opentelemetry-js/pull/2926) @nozik
* feat: implement OSDetector [#2927](https://github.com/open-telemetry/opentelemetry-js/pull/2927) @rauno56
* feat: implement HostDetector [#2921](https://github.com/open-telemetry/opentelemetry-js/pull/2921) @rauno56
* refactor(metrics-sdk): rename InstrumentationLibrary -> InstrumentationScope [#2959](https://github.com/open-telemetry/opentelemetry-js/pull/2959) @pichlermarc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case you should modify both changelog files like you did.

There are two CHANGELOG files: one in the root directory and one in the exprimental/. I find that people tend to overlook the one in the experimental/ directory. Maybe we should merge those two.

I thought about this, but I think it makes for a confusing changelog file.

CHANGELOG.md Outdated
@@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
* feat: warn when hooked module is already loaded [#2926](https://github.com/open-telemetry/opentelemetry-js/pull/2926) @nozik
* feat: implement OSDetector [#2927](https://github.com/open-telemetry/opentelemetry-js/pull/2927) @rauno56
* feat: implement HostDetector [#2921](https://github.com/open-telemetry/opentelemetry-js/pull/2921) @rauno56
* refactor(metrics-sdk): rename InstrumentationLibrary -> InstrumentationScope [#2959](https://github.com/open-telemetry/opentelemetry-js/pull/2959) @pichlermarc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* refactor(metrics-sdk): rename InstrumentationLibrary -> InstrumentationScope [#2959](https://github.com/open-telemetry/opentelemetry-js/pull/2959) @pichlermarc
* `@opentelemetry/core`: add InstrumentationScope [#2959](https://github.com/open-telemetry/opentelemetry-js/pull/2959) @pichlermarc

Copy link
Member

@legendecas legendecas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Just a minor naming question.

@@ -56,14 +56,14 @@ export interface HistogramMetricData extends BaseMetricData {
*/
export type MetricData = SingularMetricData | HistogramMetricData;

export interface InstrumentationLibraryMetrics {
instrumentationLibrary: InstrumentationLibrary;
export interface ScopeMetrics {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is InstrumentationScopeMetrics a name to be considered? Although it is somewhat verbose, we are not introducing any new term in the case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I found that this is the name in the OTLP proto.

Copy link
Member Author

@pichlermarc pichlermarc May 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I found that this is the name in the OTLP proto.

I considered InstrumentationScopeMetrics at first, but I think having this to as close as possible to the OTLP proto would make sense. 🙂

I checked the other language SDKs but there does not seem to be a consensus on what to call it. Java uses this MetricData to send to the Exporter, .NET does not map the concept directly, and Python is currently in the process of changing it to ScopeMetrics. If that Python PR merges, we will have consistent naming across Python, and JS and proto. 🙂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine if we're matching the proto

@legendecas legendecas merged commit 97bc632 into open-telemetry:main May 11, 2022
@dyladan dyladan deleted the rename-instrumentation-library branch May 11, 2022 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants