| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407 |
- import { Auth, Realtime, Storage } from 'icons'
- import { ActivityIcon, DatabaseIcon, HeartIcon, ServerIcon } from 'lucide-react'
- import { ReactNode } from 'react'
- export type Metric = {
- key: string
- label: string
- provider?: string
- category?: MetricCategory
- id?: string
- }
- type MetricCategory = {
- label: string
- icon: (className?: string) => ReactNode
- key: string
- }
- export const METRIC_CATEGORIES = {
- API: {
- label: 'All API usage',
- icon: (className?: string) => <ActivityIcon size={16} className={className} />,
- key: 'api',
- },
- API_DATABASE: {
- label: 'Database API',
- icon: (className?: string) => <DatabaseIcon size={16} className={className} />,
- key: 'api_database',
- },
- API_AUTH: {
- label: 'Authentication',
- icon: (className?: string) => <Auth size={16} className={className} />,
- key: 'api_auth',
- },
- API_STORAGE: {
- label: 'Storage',
- icon: (className?: string) => <Storage size={16} className={className} />,
- key: 'api_storage',
- },
- API_REALTIME: {
- label: 'Realtime',
- icon: (className?: string) => <Realtime size={16} className={className} />,
- key: 'api_realtime',
- },
- INSTANCE: {
- label: 'Instance health',
- icon: (className?: string) => <HeartIcon size={16} className={className} />,
- key: 'instance',
- },
- SUPAVISOR: {
- label: 'Supavisor',
- icon: (className?: string) => <ServerIcon size={16} className={className} />,
- key: 'supavisor',
- },
- }
- // [Joshen] Eventually we can remove some charts here from DEPRECATED_REPORTS from Reports.constants.ts
- export const METRICS: Metric[] = [
- {
- key: 'avg_cpu_usage',
- label: 'Average CPU % Usage',
- provider: 'infra-monitoring',
- category: METRIC_CATEGORIES.INSTANCE,
- },
- {
- key: 'max_cpu_usage',
- label: 'Max CPU % Usage',
- provider: 'infra-monitoring',
- category: METRIC_CATEGORIES.INSTANCE,
- },
- {
- key: 'disk_io_consumption',
- label: 'Disk IO % Consumed',
- provider: 'infra-monitoring',
- category: METRIC_CATEGORIES.INSTANCE,
- },
- {
- key: 'disk_io_budget',
- label: 'Disk IO % Remaining',
- provider: 'infra-monitoring',
- category: METRIC_CATEGORIES.INSTANCE,
- },
- {
- key: 'ram_usage',
- label: 'Memory % Usage',
- provider: 'infra-monitoring',
- category: METRIC_CATEGORIES.INSTANCE,
- },
- {
- key: 'total_realtime_egress',
- label: 'Realtime Connection Egress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API,
- },
- {
- key: 'total_realtime_requests',
- label: 'Realtime Connection Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_REALTIME,
- },
- {
- key: 'total_realtime_ingress',
- label: 'Realtime Connection Ingress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_REALTIME,
- },
- /**
- * API
- */
- {
- key: 'total_rest_ingress',
- label: 'API Ingress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_DATABASE,
- },
- {
- key: 'total_rest_egress',
- label: 'API Egress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_DATABASE,
- },
- {
- key: 'total_rest_requests',
- label: 'API Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_DATABASE,
- },
- {
- key: 'total_rest_get_requests',
- label: 'API GET Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_DATABASE,
- },
- {
- key: 'total_rest_post_requests',
- label: 'API POST Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_DATABASE,
- },
- {
- key: 'total_rest_patch_requests',
- label: 'API PATCH Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_DATABASE,
- },
- {
- key: 'total_rest_delete_requests',
- label: 'API DELETE Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_DATABASE,
- },
- {
- key: 'total_rest_options_requests',
- label: 'API OPTIONS Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_DATABASE,
- },
- /**
- * Auth
- */
- {
- key: 'total_auth_billing_period_mau',
- label: 'Auth Monthly Active User',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_AUTH,
- },
- {
- key: 'total_auth_billing_period_sso_mau',
- label: 'Auth Monthly Active SSO User',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_AUTH,
- },
- {
- key: 'total_auth_ingress',
- label: 'Auth Ingress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_AUTH,
- },
- {
- key: 'total_auth_egress',
- label: 'Auth Egress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_AUTH,
- },
- {
- key: 'total_auth_requests',
- label: 'Auth Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_AUTH,
- },
- {
- key: 'total_auth_get_requests',
- label: 'Auth GET Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_AUTH,
- },
- {
- key: 'total_auth_post_requests',
- label: 'Auth POST Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_AUTH,
- },
- {
- key: 'total_auth_patch_requests',
- label: 'Auth PATCH Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_AUTH,
- },
- {
- key: 'total_auth_options_requests',
- label: 'Auth OPTIONS Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_AUTH,
- },
- /**
- * Storage
- */
- {
- key: 'total_storage_ingress',
- label: 'Storage Ingress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_STORAGE,
- },
- {
- key: 'total_storage_egress',
- label: 'Storage Egress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_STORAGE,
- },
- {
- key: 'total_storage_image_render_count',
- label: 'Storage Image Transformations',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_STORAGE,
- },
- {
- key: 'total_storage_requests',
- label: 'Storage Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_STORAGE,
- },
- {
- key: 'total_storage_get_requests',
- label: 'Storage GET Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_STORAGE,
- },
- {
- key: 'total_storage_post_requests',
- label: 'Storage POST Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_STORAGE,
- },
- {
- key: 'total_storage_delete_requests',
- label: 'Storage DELETE Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_STORAGE,
- },
- {
- key: 'total_storage_options_requests',
- label: 'Storage OPTIONS Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_STORAGE,
- },
- {
- key: 'total_auth_delete_requests',
- label: 'Auth DELETE Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_AUTH,
- },
- {
- key: 'total_egress',
- label: 'All Egress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API,
- },
- {
- key: 'total_get_requests',
- label: 'All GET Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API,
- },
- {
- key: 'total_cached_egress',
- label: 'All Cached Egress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_STORAGE,
- },
- {
- key: 'total_storage_patch_requests',
- label: 'Storage PATCH Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API_STORAGE,
- },
- {
- key: 'total_requests',
- label: 'All Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API,
- },
- {
- key: 'total_patch_requests',
- label: 'All PATCH Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API,
- },
- {
- key: 'total_post_requests',
- label: 'All POST Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API,
- },
- {
- key: 'total_ingress',
- label: 'All Ingress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API,
- },
- {
- key: 'total_delete_requests',
- label: 'All DELETE Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API,
- },
- {
- key: 'total_options_requests',
- label: 'All OPTIONS Requests',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.API,
- },
- /** Supavisor */
- {
- key: 'total_supavisor_egress_bytes',
- label: 'Shared Pooler Egress',
- provider: 'daily-stats',
- category: METRIC_CATEGORIES.SUPAVISOR,
- },
- ]
- export const TIME_PERIODS_BILLING = [
- {
- key: 'currentBillingCycle',
- label: 'Current billing cycle',
- interval: '1d',
- },
- {
- key: 'previousBillingCycle',
- label: 'Previous billing cycle',
- interval: '1d',
- },
- ]
- export const TIME_PERIODS_REPORTS = [
- {
- key: '7d',
- label: 'Last 7 days',
- interval: '1d',
- },
- {
- key: '30d',
- label: 'Last 30 days',
- interval: '1d',
- },
- {
- key: 'startMonth',
- label: 'This month',
- interval: '1d',
- },
- ]
- export const TIME_PERIODS_INFRA = [
- {
- key: '10m',
- label: 'Last 10 minutes',
- },
- {
- key: '30m',
- label: 'Last 30 minutes',
- },
- {
- key: '1h',
- label: 'Last hour',
- },
- {
- key: '3h',
- label: 'Last 3 hours',
- },
- {
- key: '1d',
- label: 'Last 24 hours',
- },
- {
- key: '7d',
- label: 'Last 7 days',
- },
- ]
|