Closed justin-fiedler closed 3 months ago
IaC Misconfigurations | |
Vulnerabilities | |
Sensitive Data | |
Total | |
Secrets | |
I can see why
sessionId
is not guaranteed to be set afterisBuilt
as it's part of timeline. To fix this, instead of adding asession
property inAmplitude
, how about creating timeline inbuild()
? So that we don't need to support adding plugins to initial config which is needed to add properties to session events created during initialization.
Thanks @Mercy811, I tried moving the session creation into the Timeline.start() but then I need to pass in all the dependencies from Amplitude (configuration, storage, store). I think this implementation is a little cleaner given that. wdyt?
Not sure why the one test is failing. It passes on my local. Debugging it now.
To not pass all the dependencies Amplitude (configuration, storage, store), how about accessing them via
amplitude
as core timeline already has amplitude as its class property.
Thanks @Mercy811 that made it a lot cleaner.
Summary
Sessions are not working as expected with the Session Replay functionality.
The main issue I am trying to solve is ensuring that
amplitude.sessionId
is set afterisBuilt
which was not always the case until now.Additionally customers have asked for a way to listen to session changes without requiring session events. For this I updated the
ObservePlugin
to haveonSessionIdChanged()
callback that fires regardless of Session event tracking. Future versions of the Session Replay plugin can use this listener instead of listening for session events.Since Session events can now be fired on instantiation e.g.
val amp = Amplitude(...)
I also addedval amp = Amplitude(Configuration(plugins = listOf(..plugins that run on any events during init))
. This can be used to attach params to session start and other potential DET events.Full list of changes:
amplitude.sessionId
is ready beforeisBuilt
is completeObservePlugin.onSessionIdChanged
callbackChecklist