* Send a session or session aggregrates to Sentry.
(session: Session | SessionAggregates)
| 573 | * Send a session or session aggregrates to Sentry. |
| 574 | */ |
| 575 | public sendSession(session: Session | SessionAggregates): void { |
| 576 | // Backfill release and environment on session |
| 577 | const { release: clientReleaseOption, environment: clientEnvironmentOption = DEFAULT_ENVIRONMENT } = this._options; |
| 578 | if ('aggregates' in session) { |
| 579 | const sessionAttrs = session.attrs || {}; |
| 580 | if (!sessionAttrs.release && !clientReleaseOption) { |
| 581 | DEBUG_BUILD && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR); |
| 582 | return; |
| 583 | } |
| 584 | sessionAttrs.release = sessionAttrs.release || clientReleaseOption; |
| 585 | sessionAttrs.environment = sessionAttrs.environment || clientEnvironmentOption; |
| 586 | session.attrs = sessionAttrs; |
| 587 | } else { |
| 588 | if (!session.release && !clientReleaseOption) { |
| 589 | DEBUG_BUILD && debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR); |
| 590 | return; |
| 591 | } |
| 592 | session.release = session.release || clientReleaseOption; |
| 593 | session.environment = session.environment || clientEnvironmentOption; |
| 594 | } |
| 595 | |
| 596 | this.emit('beforeSendSession', session); |
| 597 | |
| 598 | const env = createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel); |
| 599 | |
| 600 | // sendEnvelope should not throw |
| 601 | // eslint-disable-next-line @typescript-eslint/no-floating-promises |
| 602 | this.sendEnvelope(env); |
| 603 | } |
| 604 | |
| 605 | /** |
| 606 | * Record on the client that an event got dropped (ie, an event that will not be sent to Sentry). |
nothing calls this directly
no test coverage detected