adminQuotas.tsx 1.9 KB

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