@datadog/webpack-plugin 0.0.13-0 → 0.0.13-2
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.
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.js +43 -43
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +43 -43
- package/dist/src/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/src/index.d.ts
CHANGED
|
@@ -6,15 +6,15 @@ interface GetPluginsOptions {
|
|
|
6
6
|
appKey: string;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
declare const CONFIG_KEY: "telemetry";
|
|
11
|
-
|
|
12
9
|
interface Metric {
|
|
13
10
|
metric: string;
|
|
14
11
|
type: 'count' | 'size' | 'duration';
|
|
15
12
|
value: number;
|
|
16
13
|
tags: string[];
|
|
17
14
|
}
|
|
15
|
+
|
|
16
|
+
declare const CONFIG_KEY: "telemetry";
|
|
17
|
+
|
|
18
18
|
type Filter = (metric: Metric) => Metric | null;
|
|
19
19
|
interface DatadogOptions {
|
|
20
20
|
apiKey?: string;
|
package/dist/src/index.js
CHANGED
|
@@ -3058,6 +3058,48 @@ const getContext = (args) => {
|
|
|
3058
3058
|
value: typeof arg === "string" ? arg : void 0
|
|
3059
3059
|
}));
|
|
3060
3060
|
};
|
|
3061
|
+
const filterTreeMetrics = (metric) => (
|
|
3062
|
+
// Remove tree metrics because way too verbose
|
|
3063
|
+
!/modules\.tree\.(count|size)$/.test(metric.metric) ? metric : null
|
|
3064
|
+
);
|
|
3065
|
+
const filterSourcemapsAndNodeModules = (metric) => metric.tags.some(
|
|
3066
|
+
(tag) => (
|
|
3067
|
+
// Remove sourcemaps.
|
|
3068
|
+
/^assetName:.*\.map$/.test(tag) || // Remove third parties.
|
|
3069
|
+
/^moduleName:\/node_modules/.test(tag)
|
|
3070
|
+
)
|
|
3071
|
+
) ? null : metric;
|
|
3072
|
+
const filterMetricsOnThreshold = (metric) => {
|
|
3073
|
+
const thresholds = {
|
|
3074
|
+
size: 1e5,
|
|
3075
|
+
count: 10,
|
|
3076
|
+
duration: 1e3
|
|
3077
|
+
};
|
|
3078
|
+
if (/(entries|loaders|warnings|errors)\.count$/.test(metric.metric)) {
|
|
3079
|
+
thresholds.count = 0;
|
|
3080
|
+
}
|
|
3081
|
+
if (/(modules\.(dependencies|dependents)$)/.test(metric.metric)) {
|
|
3082
|
+
thresholds.count = 30;
|
|
3083
|
+
}
|
|
3084
|
+
if (/modules\.tree\.count$/.test(metric.metric)) {
|
|
3085
|
+
thresholds.count = 150;
|
|
3086
|
+
}
|
|
3087
|
+
if (/modules\.tree\.size$/.test(metric.metric)) {
|
|
3088
|
+
thresholds.size = 15e5;
|
|
3089
|
+
}
|
|
3090
|
+
if (/entries\.size$/.test(metric.metric)) {
|
|
3091
|
+
thresholds.size = 0;
|
|
3092
|
+
}
|
|
3093
|
+
if (/entries\.modules\.count$/.test(metric.metric)) {
|
|
3094
|
+
thresholds.count = 0;
|
|
3095
|
+
}
|
|
3096
|
+
return metric.value > thresholds[metric.type] ? metric : null;
|
|
3097
|
+
};
|
|
3098
|
+
const defaultTelemetryFilters = [
|
|
3099
|
+
filterTreeMetrics,
|
|
3100
|
+
filterSourcemapsAndNodeModules,
|
|
3101
|
+
filterMetricsOnThreshold
|
|
3102
|
+
];
|
|
3061
3103
|
|
|
3062
3104
|
const outputFiles = async (context, options) => {
|
|
3063
3105
|
const { report, metrics, bundler } = context;
|
|
@@ -5026,48 +5068,6 @@ var templates = (chalk, tmp) => {
|
|
|
5026
5068
|
var chalkExports = chalk$1.exports;
|
|
5027
5069
|
var chalk = /*@__PURE__*/getDefaultExportFromCjs(chalkExports);
|
|
5028
5070
|
|
|
5029
|
-
const filterTreeMetrics = (metric) => (
|
|
5030
|
-
// Remove tree metrics because way too verbose
|
|
5031
|
-
!/modules\.tree\.(count|size)$/.test(metric.metric) ? metric : null
|
|
5032
|
-
);
|
|
5033
|
-
const filterSourcemapsAndNodeModules = (metric) => metric.tags.some(
|
|
5034
|
-
(tag) => (
|
|
5035
|
-
// Remove sourcemaps.
|
|
5036
|
-
/^assetName:.*\.map$/.test(tag) || // Remove third parties.
|
|
5037
|
-
/^moduleName:\/node_modules/.test(tag)
|
|
5038
|
-
)
|
|
5039
|
-
) ? null : metric;
|
|
5040
|
-
const filterMetricsOnThreshold = (metric) => {
|
|
5041
|
-
const thresholds = {
|
|
5042
|
-
size: 1e5,
|
|
5043
|
-
count: 10,
|
|
5044
|
-
duration: 1e3
|
|
5045
|
-
};
|
|
5046
|
-
if (/(entries|loaders|warnings|errors)\.count$/.test(metric.metric)) {
|
|
5047
|
-
thresholds.count = 0;
|
|
5048
|
-
}
|
|
5049
|
-
if (/(modules\.(dependencies|dependents)$)/.test(metric.metric)) {
|
|
5050
|
-
thresholds.count = 30;
|
|
5051
|
-
}
|
|
5052
|
-
if (/modules\.tree\.count$/.test(metric.metric)) {
|
|
5053
|
-
thresholds.count = 150;
|
|
5054
|
-
}
|
|
5055
|
-
if (/modules\.tree\.size$/.test(metric.metric)) {
|
|
5056
|
-
thresholds.size = 15e5;
|
|
5057
|
-
}
|
|
5058
|
-
if (/entries\.size$/.test(metric.metric)) {
|
|
5059
|
-
thresholds.size = 0;
|
|
5060
|
-
}
|
|
5061
|
-
if (/entries\.modules\.count$/.test(metric.metric)) {
|
|
5062
|
-
thresholds.count = 0;
|
|
5063
|
-
}
|
|
5064
|
-
return metric.value > thresholds[metric.type] ? metric : null;
|
|
5065
|
-
};
|
|
5066
|
-
const defaultFilters = [
|
|
5067
|
-
filterTreeMetrics,
|
|
5068
|
-
filterSourcemapsAndNodeModules,
|
|
5069
|
-
filterMetricsOnThreshold
|
|
5070
|
-
];
|
|
5071
5071
|
const getMetric = (metric, opts) => ({
|
|
5072
5072
|
type: "gauge",
|
|
5073
5073
|
tags: [...metric.tags, ...opts.tags],
|
|
@@ -5084,7 +5084,7 @@ const getOptionsDD = (opt) => {
|
|
|
5084
5084
|
tags: options.datadog?.tags || [],
|
|
5085
5085
|
endPoint: options.datadog?.endPoint || "app.datadoghq.com",
|
|
5086
5086
|
prefix: options.datadog?.prefix || "",
|
|
5087
|
-
filters: options.datadog?.filters ||
|
|
5087
|
+
filters: options.datadog?.filters || defaultTelemetryFilters
|
|
5088
5088
|
};
|
|
5089
5089
|
};
|
|
5090
5090
|
|