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

feat(sdk-metrics)!: drop deprecated type field on MetricDescriptor #5291

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chancancode
Copy link
Contributor

@chancancode chancancode commented Dec 20, 2024

Which problem is this PR solving?

Drop deprecated type field on MetricDescriptor

Fixes #3439
Fixes #5266 (review) (@pichlermarc)

Short description of the changes

Move the field to the internal InstrumentDescriptor type and keep it for internal use.

See also: #5266 (comment)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • npm compile
  • npm lint
  • npm test:*

Checklist:

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

Move the field to the internal `InstrumentDescriptor` type and keep
it for internal use.

Fixes open-telemetry#3439
@chancancode chancancode requested a review from a team as a code owner December 20, 2024 19:17
@@ -7,6 +7,8 @@ All notable changes to experimental packages in this project will be documented

### :boom: Breaking Change

* feat(exporter-prometheus)!, feat(shim-opencensus)!: drop support for the deprecated `type` field on `MetricDescriptor` [#5291](https://github.com/open-telemetry/opentelemetry-js/pull/5291)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not exactly sure what to say here, there is probably more to say, since, as the test shown this change can have noticeable impact

!name.endsWith('_total') &&
data.dataPointType === DataPointType.SUM &&
data.isMonotonic
) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.62%. Comparing base (90afa28) to head (bf47aa2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5291   +/-   ##
=======================================
  Coverage   94.62%   94.62%           
=======================================
  Files         323      323           
  Lines        8068     8071    +3     
  Branches     1637     1640    +3     
=======================================
+ Hits         7634     7637    +3     
  Misses        434      434           
Files with missing lines Coverage Δ
...ry-exporter-prometheus/src/PrometheusSerializer.ts 95.10% <100.00%> (+0.10%) ⬆️
...l/packages/shim-opencensus/src/metric-transform.ts 98.38% <ø> (ø)
packages/sdk-metrics/src/InstrumentDescriptor.ts 100.00% <ø> (ø)
...sdk-metrics/src/aggregator/ExponentialHistogram.ts 98.15% <ø> (ø)
packages/sdk-metrics/src/aggregator/Histogram.ts 92.20% <ø> (ø)
packages/sdk-metrics/src/aggregator/LastValue.ts 100.00% <100.00%> (ø)
packages/sdk-metrics/src/aggregator/Sum.ts 100.00% <100.00%> (ø)
packages/sdk-metrics/src/aggregator/types.ts 100.00% <ø> (ø)
packages/sdk-metrics/src/export/MetricData.ts 100.00% <ø> (ø)

'metric_observable_counter{key1="attributeValue1"} 20',
'# HELP metric_observable_counter_total a test description',
'# TYPE metric_observable_counter_total counter',
'metric_observable_counter_total{key1="attributeValue1"} 20',
'',
]);
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pichlermarc I think this is the natural conclusion of your proposed check right? (or– did I misunderstood your comment and flipped the check?)

@@ -374,6 +380,9 @@ describe('Instruments', () => {
unit: '',
type: InstrumentType.HISTOGRAM,
valueType: ValueType.INT,
advice: {
explicitBucketBoundaries: [1, 9, 100],
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous test should have this but left it out due to it not being enforced by the type. Internally that went to assertPartialDeepStrictEqual and that was only checking everything appears here (expected) is present and === on the actual, but not the other way around.

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.

Instrument descriptor semantics are unclear when using views
1 participant