-
Notifications
You must be signed in to change notification settings - Fork 33
Capture Destination Metadata #73
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
Conversation
// the userId tied to the event | ||
abstract var userId: String | ||
|
||
abstract var _metadata: DestinationMetadata |
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.
an unrelated but more for maintainability question: should we only use abstract for EventType
and mark all the other fields as lateinit
? because all the other fields have the same implementation in the subclasses. if they're not abstract, we will have less redundant code
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.
Oh i didnt realize fields in an abstract class can be set as lateinit
. That sounds like a good idea maybe. But I think that change goes beyond the scope of this PR. I will address those in another one after tho
fun upload(apiHost: String): Connection { | ||
val connection: HttpURLConnection = openConnection("https://$apiHost/batch") | ||
val connection: HttpURLConnection = openConnection("https://$apiHost/b") | ||
connection.setRequestProperty("Content-Type", "text/plain") |
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.
seems to be redundant, since createPostConnection
internally set this to gzip
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.
Content-Encoding
is being set to gzip, this is Content-Type
which I believe has a different meaning
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.
ah. I read too fast. thought they are both Content-Type
|
||
internal fun HttpURLConnection.createPostConnection(): Connection { | ||
val outputStream: OutputStream | ||
setRequestProperty("Content-Encoding", "gzip") |
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.
any benefits to move this line from upload
to here?
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.
just felt logically connected to the next line, that actually does the gzip encoding, so I moved it here
86a0c61
to
1118ce5
Compare
Codecov Report
@@ Coverage Diff @@
## main #73 +/- ##
============================================
+ Coverage 57.56% 57.88% +0.31%
- Complexity 416 426 +10
============================================
Files 67 69 +2
Lines 7204 7296 +92
Branches 690 708 +18
============================================
+ Hits 4147 4223 +76
Misses 2549 2549
- Partials 508 524 +16
Continue to review full report at Codecov.
|
_metadata
info for Segment to handle delivery of events to cloud/device destinationsintegrations
object being used by customers to control delivery/batch
to/b
endpointwriteKey
field to the batch event file