Skip to content

Commit

Permalink
Session start and end events (#1091)
Browse files Browse the repository at this point in the history
Co-authored-by: Joao Grassi <[email protected]>
Co-authored-by: Liudmila Molkova <[email protected]>
  • Loading branch information
3 people authored Aug 1, 2024
1 parent 798e939 commit 93cc98b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .chloggen/session_start_end_event.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use this changelog template to create an entry for release notes.
#
# If your change doesn't affect end users you should instead start
# your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: 'enhancement'

# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
component: 'session'

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add new experimental `session.start` and `session.end` events

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
# The values here must be integers.
issues: [1091]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
39 changes: 38 additions & 1 deletion docs/general/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ the Logs, Events, and Spans generated during the Session's lifecycle.

When a session reaches end of life, typically due to user inactivity or session timeout, a new session identifier
will be assigned. The previous session identifier may be provided by the instrumentation so that telemetry
backends can link the two sessions.
backends can link the two sessions (see [Session Start Event](#session-start-event) below).

## Attributes

Expand All @@ -35,4 +35,41 @@ backends can link the two sessions.
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

## Session Events

### Session Start Event

![Experimental](https://img.shields.io/badge/-experimental-blue)

`event.name` MUST be`session.start`

For instrumentation that tracks user behavior during user sessions, a `session.start` event MUST be emitted
every time a session is created. When a new session is created as a continuation of a prior session,
the `session.previous_id` SHOULD be included in the event. The values of `session.id` and `session.previous_id`
MUST be different.

When the `session.start` event contains both `session.id` and `session.previous_id` fields, the event then implies
that the previous session has ended. If the session ID in `session.previous_id` has not yet ended via explicit
`session.end` event, then the consumer SHOULD treat this continuation event as semantically equivalent to
`session.end(session.previous_id)` and `session.start(session.id)`.

| Body field | Type | Description | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---------------------------------------------------------------|--------|------------------------------------------------------|-------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|
| [`session.id`](/docs/attributes-registry/session.md) | string | The ID of the new session being started. | `Required` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`session.previous_id`](/docs/attributes-registry/session.md) | string | The previous `session.id` for this user, when known. | `Conditionally Required` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

### Session End Event

![Experimental](https://img.shields.io/badge/-experimental-blue)

`event.name` MUST be `session.end`

For instrumentation that tracks user behavior during user sessions, a `session.end` event SHOULD be emitted
every time a session ends. When a session ends and continues as a new session, this event SHOULD be
emitted prior to the `session.start` event.

| Body field | Type | Description | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---------------------------------------------------------------|--------|----------------------------------------|--------------------------|------------------------------------------------------------------|
| [`session.id`](/docs/attributes-registry/session.md) | string | The ID of the new session being ended. | `Required` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status

0 comments on commit 93cc98b

Please sign in to comment.