Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add session.change event #1042
Add session.change event #1042
Changes from all commits
8b1f026
dbd78c0
e621e8b
1a70aa9
e10d226
87371fd
a6821af
002ef31
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Should we allow
session.id
to be null to denote the change resulting in a session expiring but no new session beginning?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.
Maybe. What's the use case? Session end? Seems like we could have a separate event then, keeping parity with a hypothetical session start event.
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.
The use case is when the "change" doesn't lead to a new session - just the ending of the previous one, like when there is a requirement for a new session that is not fulfilled.
For instance, if a session times out, but the app is in the background, and no telemetry will be recorded while that is the case, do we want to generate a new
session.id
?An alternative is to use some non-null stub to indicate that there's no session, e.g. empty-string. If we go down that route, we should define what that non-null stub should be.
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.
Ok, thanks for clarifying. I think I better understand now where you are coming from.
What this feels like is that both @bidetofevil and @scheler are suggesting changes to this event in order to allow 3 different semantics within one single event: "session start", "session change", and "session end". In order to facilitate this, you've suggested changes that, in my opinion, complicate things.
By allowing either field to be null/absent, the receiver then needs to check these states:
and then we would also require wording to require at least one of them, so that both can't be blank.
I'd prefer not to mess with any of that and just have clear, simple, single-semantic events. So if/when we need a session start event, let's spec that separately. Similary, a session-end event that has no successive session could also be spec'd 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.
I agree with having separated events for single cases like session change/end/start.
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.
Yeah, that sounds good. Breaking that out makes it clear what a backend should do when they receive one of those events. These are 3 different state changes so having separate events make sense.
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.
The wording
session.change
indicates there is another event to represent when a new session starts. However, there is no such event currently. I suggest we call thissession.start
or justsession
, and this event MUST includesession.id
and MAY includesession.previous_id
when applicable.Structurally, this event should be described using the Events format. See https://github.com/open-telemetry/semantic-conventions/blob/main/docs/mobile/events.md for an example.
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.
That's a bit of a stretch to me, but is probably highlighting the fact that a larger spec around session handling might be missing. It's perfectly reasonable to also have other telemetry include the session without a session start event, IMO.
Yeah, I think this demonstrates that what you're suggesting is semantically something different than what I was trying to define here.
Agreed, however there's no precedent for an empty body. Maybe you're suggesting that this event should have those attributes as body fields instead?
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.
Given that there's no notion of a session right now beyond that all signals that contain the same
session.id
attribute with a given value conceptually belong to the same session, having this to signal that the previously setsession.id
is no longer valid seems reasonable to have even if there's no equivalentsession.start
event.The latter would be useful if there was additional metadata attached to said session, but in the absence of that, I don't think we necessarily need that. Or if we do, it should be part of a different proposal to define what a session is and how it relates to signals.
Also, +1 on making this an Event and have these be defined as body fields.
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.
Ok so I'm not opposed to using body fields, but if we have previously standardized on "
session.id
is an attribute that gets slapped onto all client telemetry, we either need to make an exception for this specific event (eg. "The session attribute isn't here because it's in the body") or we need to exclude it from the body, which means there's just the one
session.previous.id` in the body).I thought both of these options were more confusing than just having attributes.
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.
Sorry if what I will say is completely dumb, but reading the changes and the discussions here I'm thinking: What if we only have
session.start
andsession.end
? And to signal a "change in session", we emit asession.end
and asession.start
having asession.previous_id
? Then when a new start event doesn't have thesession.previous_id
we know it's a brand new session, and when we have the attribute it indicates a change. Was this option discussed?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.
It wasn't discussed. That approach sounds viable as well, although it has two minor concerns for me, neither of which is a deal-breaker:
session.previous_id
in the start case already suggests that the prior session is ending (or has just ended)In any case, it seems that folks are thinking more in terms of start/stop than "change", so I'll mark this one draft and write up another PR that tries this. Thanks for the suggestions folks.
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.
Perhaps we are overloading the meaning of
session.id
then. The one in attributes indicates what session this event belongs to, while for the proposed body field, it's the NEW sessionId being introduced - so it might make more sense assession.new_id
or something?FWIW, I also agree that making this event "atomic" to express both the end and beginning at the same time is a good idea, in case the telemetry comes in out of order, or just delayed, which will happen pretty frequently).