constants.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. Object.defineProperty(exports, '__esModule', { value: true });
  2. const COUNTER_METRIC_TYPE = 'c' ;
  3. const GAUGE_METRIC_TYPE = 'g' ;
  4. const SET_METRIC_TYPE = 's' ;
  5. const DISTRIBUTION_METRIC_TYPE = 'd' ;
  6. /**
  7. * Normalization regex for metric names and metric tag names.
  8. *
  9. * This enforces that names and tag keys only contain alphanumeric characters,
  10. * underscores, forward slashes, periods, and dashes.
  11. *
  12. * See: https://develop.sentry.dev/sdk/metrics/#normalization
  13. */
  14. const NAME_AND_TAG_KEY_NORMALIZATION_REGEX = /[^a-zA-Z0-9_/.-]+/g;
  15. /**
  16. * Normalization regex for metric tag values.
  17. *
  18. * This enforces that values only contain words, digits, or the following
  19. * special characters: _:/@.{}[\]$-
  20. *
  21. * See: https://develop.sentry.dev/sdk/metrics/#normalization
  22. */
  23. const TAG_VALUE_NORMALIZATION_REGEX = /[^\w\d\s_:/@.{}[\]$-]+/g;
  24. /**
  25. * This does not match spec in https://develop.sentry.dev/sdk/metrics
  26. * but was chosen to optimize for the most common case in browser environments.
  27. */
  28. const DEFAULT_BROWSER_FLUSH_INTERVAL = 5000;
  29. /**
  30. * SDKs are required to bucket into 10 second intervals (rollup in seconds)
  31. * which is the current lower bound of metric accuracy.
  32. */
  33. const DEFAULT_FLUSH_INTERVAL = 10000;
  34. /**
  35. * The maximum number of metrics that should be stored in memory.
  36. */
  37. const MAX_WEIGHT = 10000;
  38. exports.COUNTER_METRIC_TYPE = COUNTER_METRIC_TYPE;
  39. exports.DEFAULT_BROWSER_FLUSH_INTERVAL = DEFAULT_BROWSER_FLUSH_INTERVAL;
  40. exports.DEFAULT_FLUSH_INTERVAL = DEFAULT_FLUSH_INTERVAL;
  41. exports.DISTRIBUTION_METRIC_TYPE = DISTRIBUTION_METRIC_TYPE;
  42. exports.GAUGE_METRIC_TYPE = GAUGE_METRIC_TYPE;
  43. exports.MAX_WEIGHT = MAX_WEIGHT;
  44. exports.NAME_AND_TAG_KEY_NORMALIZATION_REGEX = NAME_AND_TAG_KEY_NORMALIZATION_REGEX;
  45. exports.SET_METRIC_TYPE = SET_METRIC_TYPE;
  46. exports.TAG_VALUE_NORMALIZATION_REGEX = TAG_VALUE_NORMALIZATION_REGEX;
  47. //# sourceMappingURL=constants.js.map