Merge branch 'docs-header-fix' into 'main'
[ProtonMail-WebClient.git] / packages / docs-core / lib / Realtime / ConnectionCloseMetrics.ts
blob7f130fd450b96042687dcf590f57c812834aecb2
1 import { ConnectionCloseReason } from '@proton/docs-proto'
2 import type { HttpsProtonMeDocsRealtimeDisconnectErrorTotalV1SchemaJson } from '@proton/metrics/types/docs_realtime_disconnect_error_total_v1.schema'
4 export const ConnectionCloseMetrics: Record<
5   number,
6   HttpsProtonMeDocsRealtimeDisconnectErrorTotalV1SchemaJson['Labels']['type']
7 > = {
8   [ConnectionCloseReason.CODES.NORMAL_CLOSURE]: 'normal_closure',
9   [ConnectionCloseReason.CODES.GOING_AWAY]: 'going_away',
10   [ConnectionCloseReason.CODES.PROTOCOL_ERROR]: 'protocol_error',
11   [ConnectionCloseReason.CODES.UNSUPPORTED_DATA]: 'unsupported_data',
12   [ConnectionCloseReason.CODES.NO_STATUS_RECEIVED]: 'no_status_received',
13   [ConnectionCloseReason.CODES.ABNORMAL_CLOSURE]: 'abnormal_closure',
14   [ConnectionCloseReason.CODES.INVALID_FRAME_PAYLOAD_DATA]: 'invalid_frame_payload_data',
15   [ConnectionCloseReason.CODES.POLICY_VIOLATION]: 'policy_violation',
16   [ConnectionCloseReason.CODES.MESSAGE_TOO_BIG]: 'message_too_big',
17   [ConnectionCloseReason.CODES.MISSING_EXTENSION]: 'missing_extension',
18   [ConnectionCloseReason.CODES.INTERNAL_ERROR]: 'internal_error',
19   [ConnectionCloseReason.CODES.SERVICE_RESTART]: 'service_restart',
20   [ConnectionCloseReason.CODES.TRY_AGAIN_LATER]: 'try_again_later',
21   [ConnectionCloseReason.CODES.BAD_GATEWAY]: 'bad_gateway',
22   [ConnectionCloseReason.CODES.TLS_HANDSHAKE]: 'tls_handshake',
23   [ConnectionCloseReason.CODES.STALE_COMMIT_ID]: 'stale_commit_id',
24   [ConnectionCloseReason.CODES.DOCUMENT_NOT_FOUND]: 'document_not_found',
25   [ConnectionCloseReason.CODES.INVALID_PARAMETERS]: 'invalid_parameters',
26   [ConnectionCloseReason.CODES.UNAUTHORIZED]: 'unauthorized',
27   [ConnectionCloseReason.CODES.TIMEOUT]: 'timeout',
28   [ConnectionCloseReason.CODES.DOCUMENT_TIMEOUT]: 'document_timeout',
29   [ConnectionCloseReason.CODES.LEFT]: 'left',
30   [ConnectionCloseReason.CODES.TRAFFIC_ABUSE_MAX_BANDWIDTH]: 'traffic_abuse_max_bandwidth',
31   [ConnectionCloseReason.CODES.TRAFFIC_ABUSE_MAX_DU_SIZE]: 'traffic_abuse_max_du_size',
32   [ConnectionCloseReason.CODES.KILL_SWITCH_ENABLED]: 'kill_switch_enabled',
33   [ConnectionCloseReason.CODES.DOCUMENT_CAPACITY_REACHED]: 'document_capacity_reached',
34   [ConnectionCloseReason.CODES.DOCUMENT_RECREATING]: 'document_recreating',