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

Merged
merged 1 commit into from
Jan 8, 2025

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

Sorry, something went wrong.

@chancancode chancancode requested a review from a team as a code owner December 20, 2024 19:17
!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.63%. Comparing base (04e74d7) to head (c297da7).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5291      +/-   ##
==========================================
+ Coverage   94.62%   94.63%   +0.01%     
==========================================
  Files         323      323              
  Lines        8068     8071       +3     
  Branches     1637     1640       +3     
==========================================
+ Hits         7634     7638       +4     
+ Misses        434      433       -1     
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% <ø> (ø)

... and 1 file with indirect coverage changes

'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?)

Copy link
Member

Choose a reason for hiding this comment

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

yes that's correct. 🙂
I think the previous behavior was actually incorrect and should've included the suffix.

@@ -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.

@chancancode chancancode force-pushed the rm-metric-descriptor-type branch from bf47aa2 to cbfee05 Compare January 7, 2025 21:01
@chancancode
Copy link
Contributor Author

@pichlermarc rebased, and friendly ping :)

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

Looks great, thank you 🙂

'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
Member

Choose a reason for hiding this comment

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

yes that's correct. 🙂
I think the previous behavior was actually incorrect and should've included the suffix.

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

Fixes open-telemetry#3439
@chancancode chancancode force-pushed the rm-metric-descriptor-type branch from 7be3799 to c297da7 Compare January 8, 2025 16:58
@chancancode
Copy link
Contributor Author

@pichlermarc applied the suggestion and rebased away the conflict

@pichlermarc pichlermarc added this pull request to the merge queue Jan 8, 2025
Merged via the queue into open-telemetry:main with commit 3b56060 Jan 8, 2025
18 checks passed

Choose a reason for hiding this comment

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

  • - - [ ]

Sorry, something went wrong.

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
3 participants