Skip to content

[v7] Deprecated Enums Removal #4888

Description

@AbhiPrasad

Problem Statement

Last December, we made some efforts to deprecate enums as they add excess bundle size. We plan to remove these in v7.

Here is a list of them, alongside things we must consider.

Solution Brainstorm

Will be deleted

Status

b177690

export type EventStatus =
  /** The status could not be determined. */
  | 'unknown'
  /** The event was skipped due to configuration or callbacks. */
  | 'skipped'
  /** The event was sent to Sentry successfully. */
  | 'rate_limit'
  /** The client is currently rate limited and will try again later. */
  | 'invalid'
  /** The event could not be processed. */
  | 'failed'
  /** A server-side error occurred during submission. */
  | 'success';

This is an internally used enum, so we can delete this without much repercussions.

SessionStatus

https://github.com/getsentry/sentry-javascript/blob/master/packages/types/src/sessionstatus.ts

export enum SessionStatus {
  /** JSDoc */
  Ok = 'ok',
  /** JSDoc */
  Exited = 'exited',
  /** JSDoc */
  Crashed = 'crashed',
  /** JSDoc */
  Abnormal = 'abnormal',
}

An internal enum, we can delete!

RequestSessionStatus

export enum RequestSessionStatus {
/** JSDoc /
Ok = 'ok',
/
* JSDoc /
Errored = 'errored',
/
* JSDoc */
Crashed = 'crashed',
}

An internal enum, we can delete!

Up for debate

Severity

export enum Severity {
  /** JSDoc */
  Fatal = 'fatal',
  /** JSDoc */
  Error = 'error',
  /** JSDoc */
  Warning = 'warning',
  /** JSDoc */
  Log = 'log',
  /** JSDoc */
  Info = 'info',
  /** JSDoc */
  Debug = 'debug',
  /** JSDoc */
  Critical = 'critical',
}

The Severity enum was removed in dd3aa70, but was later undeprecated in #4412.

The Severity enum is part of the public API - captureMessage call, so possibly would require a lot of user facing changes (they have to go in and change a bunch of methods). Do we decide to still move on with removing the enum?

public captureMessage(message: string, level?: Severity, hint?: EventHint): string {

SpanStatus

https://github.com/getsentry/sentry-javascript/blob/master/packages/tracing/src/spanstatus.ts

export enum SpanStatus {
  /** The operation completed successfully. */
  Ok = 'ok',
  /** Deadline expired before operation could complete. */
  DeadlineExceeded = 'deadline_exceeded',
  /** 401 Unauthorized (actually does mean unauthenticated according to RFC 7235) */
  Unauthenticated = 'unauthenticated',
  /** 403 Forbidden */
  PermissionDenied = 'permission_denied',
  /** 404 Not Found. Some requested entity (file or directory) was not found. */
  NotFound = 'not_found',
  /** 429 Too Many Requests */
  ResourceExhausted = 'resource_exhausted',
  /** Client specified an invalid argument. 4xx. */
  InvalidArgument = 'invalid_argument',
  /** 501 Not Implemented */
  Unimplemented = 'unimplemented',
  /** 503 Service Unavailable */
  Unavailable = 'unavailable',
  /** Other/generic 5xx. */
  InternalError = 'internal_error',
  /** Unknown. Any non-standard HTTP status code. */
  UnknownError = 'unknown_error',
  /** The operation was cancelled (typically by the user). */
  Cancelled = 'cancelled',
  /** Already exists (409) */
  AlreadyExists = 'already_exists',
  /** Operation was rejected because the system is not in a state required for the operation's */
  FailedPrecondition = 'failed_precondition',
  /** The operation was aborted, typically due to a concurrency issue. */
  Aborted = 'aborted',
  /** Operation was attempted past the valid range. */
  OutOfRange = 'out_of_range',
  /** Unrecoverable data loss or corruption */
  DataLoss = 'data_loss',
}

SpanStatus is another that has big savings if deleted, but provides a high amount of UX because it allows user's to see what exactly to set status to. We use it all around the docs (see the first example in https://docs.sentry.io/platforms/javascript/performance/instrumentation/custom-instrumentation/). Should we delete this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions