metrics.tsx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import {DateString} from 'sentry/types/core';
  2. export type MetricsType = 'set' | 'counter' | 'distribution' | 'numeric';
  3. export type MetricsOperation =
  4. | 'sum'
  5. | 'count_unique'
  6. | 'avg'
  7. | 'count'
  8. | 'max'
  9. | 'p50'
  10. | 'p75'
  11. | 'p95'
  12. | 'p99';
  13. export type MetricsApiRequestMetric = {
  14. field: string;
  15. query: string;
  16. groupBy?: string[];
  17. };
  18. export type MetricsApiRequestQuery = MetricsApiRequestMetric & {
  19. interval: string;
  20. end?: DateString;
  21. environment?: string[];
  22. includeSeries?: number;
  23. includeTotals?: number;
  24. orderBy?: string;
  25. per_page?: number;
  26. project?: number[];
  27. star?: DateString;
  28. statsPeriod?: string;
  29. useNewMetricsLayer?: boolean;
  30. };
  31. export type MetricsApiResponse = {
  32. end: string;
  33. groups: MetricsGroup[];
  34. intervals: string[];
  35. meta: MetricsMeta[];
  36. query: string;
  37. start: string;
  38. };
  39. export type MetricsGroup = {
  40. by: Record<string, string>;
  41. series: Record<string, Array<number | null>>;
  42. totals: Record<string, number | null>;
  43. };
  44. export type MetricsTagCollection = Record<string, MetricsTag>;
  45. export type MetricsTag = {
  46. key: string;
  47. };
  48. export type MetricsTagValue = {
  49. key: string;
  50. value: string;
  51. };
  52. export type MetricsMeta = {
  53. mri: string;
  54. name: string;
  55. operations: MetricsOperation[];
  56. type: MetricsType; // TODO(ddm): I think this is wrong, api returns "c" instead of "counter"
  57. unit: string;
  58. };
  59. export type MetricsMetaCollection = Record<string, MetricsMeta>;