constants.js 1.5 KB

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