Skip to content

Add missing measurements units#1033

Merged
marandaneto merged 3 commits into
mainfrom
fix/add-missing-measurements
Oct 3, 2022
Merged

Add missing measurements units#1033
marandaneto merged 3 commits into
mainfrom
fix/add-missing-measurements

Conversation

@marandaneto

@marandaneto marandaneto commented Sep 30, 2022

Copy link
Copy Markdown
Contributor

📜 Description

Not as nice as SentryMeasurementUnit.duration.milliSecond as some other languages, but it's a limitation of the enum type in Dart in the current min. supported version, we can refactor that in the future.

Changing it to a plain String would be a breaking change and would have a poor UX because we'd need to document all the possible values.

The current limitation is that you can only set the unit with one of the enum values, which is well covered for most of the cases.
In case somebody wants to use their own metric unit, it's currently not supported, we can refactor this and bump the Dart version if needed.

💡 Motivation and Context

Reason: getsentry/sentry-java#2260 (comment)

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

Comment on lines +5 to +6
/// This is a singe enum because Enhanced Enums in Dart is only available
/// in newer versions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Limitation before Dart 2.17 and we cannot do breaking changes just yet.
It's either this or an open String, but this has better UX, so users don't need to find out the units by themselves via docs.

@codecov-commenter

codecov-commenter commented Sep 30, 2022

Copy link
Copy Markdown

Codecov Report

Base: 90.26% // Head: 90.48% // Increases project coverage by +0.21% 🎉

Coverage data is based on head (fad9d52) compared to base (812d379).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1033      +/-   ##
==========================================
+ Coverage   90.26%   90.48%   +0.21%     
==========================================
  Files         114      114              
  Lines        3556     3572      +16     
==========================================
+ Hits         3210     3232      +22     
+ Misses        346      340       -6     
Impacted Files Coverage Δ
dart/lib/src/sentry_measurement_unit.dart 100.00% <100.00%> (+60.00%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@philipphofmann philipphofmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe there is a different way of fixing it.

Comment thread dart/lib/src/sentry_measurement_unit.dart
@marandaneto
marandaneto merged commit 97a76ac into main Oct 3, 2022
@marandaneto
marandaneto deleted the fix/add-missing-measurements branch October 3, 2022 08:23

@philipphofmann philipphofmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, as discussed on a call with @marandaneto, that Dart doesn't offer inheritance for enums or method overloads, and that's why we put all types into one enum.

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.

4 participants