@datadog/esbuild-plugin 0.0.13-0 → 0.0.13-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3034,6 +3034,48 @@ const getContext = (args) => {
3034
3034
  value: typeof arg === "string" ? arg : void 0
3035
3035
  }));
3036
3036
  };
3037
+ const filterTreeMetrics = (metric) => (
3038
+ // Remove tree metrics because way too verbose
3039
+ !/modules\.tree\.(count|size)$/.test(metric.metric) ? metric : null
3040
+ );
3041
+ const filterSourcemapsAndNodeModules = (metric) => metric.tags.some(
3042
+ (tag) => (
3043
+ // Remove sourcemaps.
3044
+ /^assetName:.*\.map$/.test(tag) || // Remove third parties.
3045
+ /^moduleName:\/node_modules/.test(tag)
3046
+ )
3047
+ ) ? null : metric;
3048
+ const filterMetricsOnThreshold = (metric) => {
3049
+ const thresholds = {
3050
+ size: 1e5,
3051
+ count: 10,
3052
+ duration: 1e3
3053
+ };
3054
+ if (/(entries|loaders|warnings|errors)\.count$/.test(metric.metric)) {
3055
+ thresholds.count = 0;
3056
+ }
3057
+ if (/(modules\.(dependencies|dependents)$)/.test(metric.metric)) {
3058
+ thresholds.count = 30;
3059
+ }
3060
+ if (/modules\.tree\.count$/.test(metric.metric)) {
3061
+ thresholds.count = 150;
3062
+ }
3063
+ if (/modules\.tree\.size$/.test(metric.metric)) {
3064
+ thresholds.size = 15e5;
3065
+ }
3066
+ if (/entries\.size$/.test(metric.metric)) {
3067
+ thresholds.size = 0;
3068
+ }
3069
+ if (/entries\.modules\.count$/.test(metric.metric)) {
3070
+ thresholds.count = 0;
3071
+ }
3072
+ return metric.value > thresholds[metric.type] ? metric : null;
3073
+ };
3074
+ const defaultTelemetryFilters = [
3075
+ filterTreeMetrics,
3076
+ filterSourcemapsAndNodeModules,
3077
+ filterMetricsOnThreshold
3078
+ ];
3037
3079
 
3038
3080
  const outputFiles = async (context, options) => {
3039
3081
  const { report, metrics, bundler } = context;
@@ -5002,48 +5044,6 @@ var templates = (chalk, tmp) => {
5002
5044
  var chalkExports = chalk$1.exports;
5003
5045
  var chalk = /*@__PURE__*/getDefaultExportFromCjs(chalkExports);
5004
5046
 
5005
- const filterTreeMetrics = (metric) => (
5006
- // Remove tree metrics because way too verbose
5007
- !/modules\.tree\.(count|size)$/.test(metric.metric) ? metric : null
5008
- );
5009
- const filterSourcemapsAndNodeModules = (metric) => metric.tags.some(
5010
- (tag) => (
5011
- // Remove sourcemaps.
5012
- /^assetName:.*\.map$/.test(tag) || // Remove third parties.
5013
- /^moduleName:\/node_modules/.test(tag)
5014
- )
5015
- ) ? null : metric;
5016
- const filterMetricsOnThreshold = (metric) => {
5017
- const thresholds = {
5018
- size: 1e5,
5019
- count: 10,
5020
- duration: 1e3
5021
- };
5022
- if (/(entries|loaders|warnings|errors)\.count$/.test(metric.metric)) {
5023
- thresholds.count = 0;
5024
- }
5025
- if (/(modules\.(dependencies|dependents)$)/.test(metric.metric)) {
5026
- thresholds.count = 30;
5027
- }
5028
- if (/modules\.tree\.count$/.test(metric.metric)) {
5029
- thresholds.count = 150;
5030
- }
5031
- if (/modules\.tree\.size$/.test(metric.metric)) {
5032
- thresholds.size = 15e5;
5033
- }
5034
- if (/entries\.size$/.test(metric.metric)) {
5035
- thresholds.size = 0;
5036
- }
5037
- if (/entries\.modules\.count$/.test(metric.metric)) {
5038
- thresholds.count = 0;
5039
- }
5040
- return metric.value > thresholds[metric.type] ? metric : null;
5041
- };
5042
- const defaultFilters = [
5043
- filterTreeMetrics,
5044
- filterSourcemapsAndNodeModules,
5045
- filterMetricsOnThreshold
5046
- ];
5047
5047
  const getMetric = (metric, opts) => ({
5048
5048
  type: "gauge",
5049
5049
  tags: [...metric.tags, ...opts.tags],
@@ -5060,7 +5060,7 @@ const getOptionsDD = (opt) => {
5060
5060
  tags: options.datadog?.tags || [],
5061
5061
  endPoint: options.datadog?.endPoint || "app.datadoghq.com",
5062
5062
  prefix: options.datadog?.prefix || "",
5063
- filters: options.datadog?.filters || defaultFilters
5063
+ filters: options.datadog?.filters || defaultTelemetryFilters
5064
5064
  };
5065
5065
  };
5066
5066