-
Notifications
You must be signed in to change notification settings - Fork 7
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
Extract emb.type to separate source file #518
Conversation
8de9fb4
to
1644d1b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #518 +/- ##
==========================================
+ Coverage 79.29% 79.33% +0.03%
==========================================
Files 390 391 +1
Lines 10752 10761 +9
Branches 1599 1599
==========================================
+ Hits 8526 8537 +11
+ Misses 1580 1578 -2
Partials 646 646
|
@@ -0,0 +1,38 @@ | |||
package io.embrace.android.embracesdk.arch.schema | |||
|
|||
internal object EmbType { |
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.
wouldn't be better to use a Sealed Class in case we need to evaluate the type at some point?
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.
This is a good point. I was focused on not being able to extend enum classes in Kotlin but forgot sealed classes are an option here. I'll update the PR
/** | ||
* Keys that track how fast a time interval is. Only applies to spans. | ||
*/ | ||
internal enum class Performance : TelemetryType |
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.
We don't have types and description here... I assume it's going to be added later.
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.
There are no subtypes now so this is probably fine until we do
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.
LGTM
@@ -0,0 +1,38 @@ | |||
package io.embrace.android.embracesdk.arch.schema | |||
|
|||
internal object EmbType { |
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.
We want the name to be lower-case in the payload - I can't find a way to override name
, so I used typeName
before. Is there a way to do that so the default enum name would just work?
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.
I'm not sure I follow. This class doesn't serialize/deserialize JSON, it just holds data that is passed to other classes that do.
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.
Looks good. I can refactor EmbraceAttributes.Type
to refer to this when it's in
1644d1b
to
b4d2c94
Compare
Goal
Extracts the possible values for
emb.type
into a separate source file. I have organised these as enums implementing a common interface to get a bit of type safety rather than throwing strings around everywhere.#519 also takes this further with a POC for the rest of the strings.