Skip to content

Commit e2615ce

Browse files
committed
Add session length to Glean config object
1 parent 28bb74c commit e2615ce

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

glean/src/core/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export interface ConfigurationInterface {
5555
readonly enableAutoElementClickEvents?: boolean,
5656
// Experimentation identifier to be set in all pings
5757
experimentationId?: string,
58+
// Allow the client to explicitly define the length of a session in MINUTES.
59+
readonly sessionLengthInMinutesOverride?: number,
5860
}
5961

6062
// Important: the `Configuration` should only be used internally by the Glean singleton.
@@ -69,6 +71,7 @@ export class Configuration implements ConfigurationInterface {
6971
readonly enableAutoPageLoadEvents?: boolean;
7072
readonly enableAutoElementClickEvents?: boolean;
7173
experimentationId?: string;
74+
readonly sessionLengthInMinutesOverride?: number;
7275

7376
// Debug configuration.
7477
debug: DebugOptions;
@@ -85,6 +88,7 @@ export class Configuration implements ConfigurationInterface {
8588
this.enableAutoPageLoadEvents = config?.enableAutoPageLoadEvents;
8689
this.enableAutoElementClickEvents = config?.enableAutoElementClickEvents;
8790
this.experimentationId = config?.experimentationId;
91+
this.sessionLengthInMinutesOverride = config?.sessionLengthInMinutesOverride;
8892

8993
this.debug = {};
9094

glean/src/core/internal_metrics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export class CoreMetrics {
211211
if (existingSessionId) {
212212
try {
213213
// If the session has timed out, then we create a new session.
214-
if (isSessionInactive()) {
214+
if (isSessionInactive(Context.config.sessionLengthInMinutesOverride)) {
215215
this.generateNewSession();
216216
}
217217
} catch (e) {

0 commit comments

Comments
 (0)