adminQuotas.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import {Fragment} from 'react';
  2. import TextField from 'sentry/components/forms/fields/textField';
  3. import InternalStatChart from 'sentry/components/internalStatChart';
  4. import {Panel, PanelBody, PanelHeader} from 'sentry/components/panels';
  5. import {t} from 'sentry/locale';
  6. import AsyncView from 'sentry/views/asyncView';
  7. type Config = {
  8. backend: string;
  9. options: Record<string, string>;
  10. };
  11. type State = AsyncView['state'] & {
  12. config: Config;
  13. resolution: string;
  14. since: number;
  15. };
  16. export default class AdminQuotas extends AsyncView<{}, State> {
  17. getDefaultState() {
  18. return {
  19. ...super.getDefaultState(),
  20. since: new Date().getTime() / 1000 - 3600 * 24 * 7,
  21. resolution: '1h',
  22. };
  23. }
  24. getEndpoints(): ReturnType<AsyncView['getEndpoints']> {
  25. return [['config', '/internal/quotas/']];
  26. }
  27. renderBody() {
  28. const {config} = this.state;
  29. return (
  30. <Fragment>
  31. <h3>Quotas</h3>
  32. <Panel>
  33. <PanelHeader>{t('Config')}</PanelHeader>
  34. <PanelBody withPadding>
  35. <TextField
  36. name="backend"
  37. value={config.backend}
  38. label="Backend"
  39. disabled
  40. inline={false}
  41. stacked
  42. />
  43. <TextField
  44. name="rateLimit"
  45. value={config.options['system.rate-limit']}
  46. label="Rate Limit"
  47. disabled
  48. inline={false}
  49. stacked
  50. />
  51. </PanelBody>
  52. </Panel>
  53. <Panel>
  54. <PanelHeader>{t('Total Events')}</PanelHeader>
  55. <PanelBody withPadding>
  56. <InternalStatChart
  57. since={this.state.since}
  58. resolution={this.state.resolution}
  59. stat="events.total"
  60. label="Events"
  61. />
  62. </PanelBody>
  63. </Panel>
  64. <Panel>
  65. <PanelHeader>{t('Dropped Events')}</PanelHeader>
  66. <PanelBody withPadding>
  67. <InternalStatChart
  68. since={this.state.since}
  69. resolution={this.state.resolution}
  70. stat="events.dropped"
  71. label="Events"
  72. />
  73. </PanelBody>
  74. </Panel>
  75. </Fragment>
  76. );
  77. }
  78. }