Skip to content

Commit 9434d49

Browse files
committed
add session aggregate typing
1 parent f3ee326 commit 9434d49

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

packages/core/src/baseclient.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Integration,
1111
IntegrationClass,
1212
NewTransport,
13+
SessionAggregates,
1314
Severity,
1415
SeverityLevel,
1516
Transport,
@@ -186,7 +187,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
186187
if (!(typeof session.release === 'string')) {
187188
IS_DEBUG_BUILD && logger.warn('Discarded session because of missing or non-string release');
188189
} else {
189-
this._sendSession(session);
190+
this.sendSession(session);
190191
// After sending, we set init false to indicate it's not the first occurrence
191192
session.update({ init: false });
192193
}
@@ -271,7 +272,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
271272
/**
272273
* @inheritDoc
273274
*/
274-
public sendSession(session: Session): void {
275+
public sendSession(session: Session | SessionAggregates): void {
275276
if (this._dsn) {
276277
const [env] = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);
277278
this.sendEnvelope(env);
@@ -324,12 +325,6 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
324325
}
325326
}
326327

327-
/** Deliver captured session to Sentry */
328-
// TODO(v7): should this be deleted?
329-
protected _sendSession(session: Session): void {
330-
this.sendSession(session);
331-
}
332-
333328
/**
334329
* Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying
335330
* "no" (resolving to `false`) in order to give the client a chance to potentially finish first.

packages/hub/src/sessionflusher.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,14 @@ export class SessionFlusher implements SessionFlusherLike {
2727
this._sessionAttrs = attrs;
2828
}
2929

30-
/** Sends session aggregates to Transport */
31-
public sendSessionAggregates(sessionAggregates: SessionAggregates): void {
32-
void this._client.sendSession(sessionAggregates).then(null, reason => {
33-
IS_DEBUG_BUILD && logger.error('Error while sending session:', reason);
34-
});
35-
}
36-
3730
/** Checks if `pendingAggregates` has entries, and if it does flushes them by calling `sendSessions` */
3831
public flush(): void {
3932
const sessionAggregates = this.getSessionAggregates();
4033
if (sessionAggregates.aggregates.length === 0) {
4134
return;
4235
}
4336
this._pendingAggregates = {};
44-
this.sendSessionAggregates(sessionAggregates);
37+
this._client.sendSession(sessionAggregates);
4538
}
4639

4740
/** Massages the entries in `pendingAggregates` and returns aggregated sessions */

0 commit comments

Comments
 (0)