You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When migrating from analytics-java to analytics-kotlin, I noticed a significant difference in how the context is handled in transmitted messages.
In analytics-kotlin, the ContextPlugin populates a context field in every BaseEvent.
In contrast, analytics-java uses the batch-level context for properties like library and instanceId, as described in the Segment HTTP API docs.
This leads to increased payload size, especially when custom application information is added to the context, which is problematic given the batch size limits and the fact that all events are persisted.
Describe the solution you'd like
I would like to see an option in analytics-kotlin to support batch-level context, similar to analytics-java, so that shared context properties do not need to be duplicated in every event within a batch.
Describe alternatives you've considered
As far as I recall, there is no explicit Batch entity in the analytics-kotlin library; the concept of a batch only materializes when the first message is appended to the temporary files for persistence.
Additional context
The default context size is already non-trivial:
This grows further with custom context. Since batch size is limited and all events are persisted, supporting batch-level context could help optimize payload size and storage.
Additional request
For the same reason, it would also be beneficial to remove unnecessary empty attributes from the payload. For example:
Is this something that should be handled in a Plugin using JsonUtils.updateJsonObject with a remove operation, or is there a recommended approach for cleaning up these empty fields before sending events?
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
When migrating from
analytics-java
toanalytics-kotlin
, I noticed a significant difference in how thecontext
is handled in transmitted messages.analytics-kotlin
, theContextPlugin
populates acontext
field in everyBaseEvent
.analytics-java
uses the batch-levelcontext
for properties likelibrary
andinstanceId
, as described in the Segment HTTP API docs.This leads to increased payload size, especially when custom application information is added to the context, which is problematic given the batch size limits and the fact that all events are persisted.
Describe the solution you'd like
I would like to see an option in
analytics-kotlin
to support batch-level context, similar toanalytics-java
, so that shared context properties do not need to be duplicated in every event within a batch.Describe alternatives you've considered
As far as I recall, there is no explicit Batch entity in the analytics-kotlin library; the concept of a batch only materializes when the first message is appended to the temporary files for persistence.
Additional context
The default context size is already non-trivial:
This grows further with custom context. Since batch size is limited and all events are persisted, supporting batch-level context could help optimize payload size and storage.
Additional request
For the same reason, it would also be beneficial to remove unnecessary empty attributes from the payload. For example:
Is this something that should be handled in a Plugin using
JsonUtils.updateJsonObject
with a remove operation, or is there a recommended approach for cleaning up these empty fields before sending events?The text was updated successfully, but these errors were encountered: