datadog-frontend-toolkit 1.0.33 → 1.0.35
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/cjs/resources/ResourceProvisioner.js +37 -7
- package/dist/cjs/resources/ResourceProvisioner.js.map +1 -1
- package/dist/cjs/resources/templates/dashboard.js +39 -32
- package/dist/cjs/resources/templates/dashboard.js.map +1 -1
- package/dist/cjs/resources/templates/slos.js +54 -6
- package/dist/cjs/resources/templates/slos.js.map +1 -1
- package/dist/cli/commands/setup.js +2 -6
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/esm/resources/ResourceProvisioner.js +38 -8
- package/dist/esm/resources/ResourceProvisioner.js.map +1 -1
- package/dist/esm/resources/templates/dashboard.js +39 -32
- package/dist/esm/resources/templates/dashboard.js.map +1 -1
- package/dist/esm/resources/templates/slos.js +53 -6
- package/dist/esm/resources/templates/slos.js.map +1 -1
- package/dist/resources/ResourceProvisioner.js +37 -7
- package/dist/resources/ResourceProvisioner.js.map +1 -1
- package/dist/resources/templates/dashboard.js +39 -32
- package/dist/resources/templates/dashboard.js.map +1 -1
- package/dist/resources/templates/slos.js +54 -6
- package/dist/resources/templates/slos.js.map +1 -1
- package/dist/types/resources/ResourceProvisioner.d.ts +5 -0
- package/dist/types/resources/ResourceProvisioner.d.ts.map +1 -1
- package/dist/types/resources/templates/dashboard.d.ts.map +1 -1
- package/dist/types/resources/templates/slos.d.ts +20 -2
- package/dist/types/resources/templates/slos.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* SLO templates for Datadog API provisioning.
|
|
4
|
-
* Uses metric-based SLOs with RUM
|
|
5
|
-
*
|
|
4
|
+
* Uses metric-based SLOs with custom RUM-generated metrics.
|
|
5
|
+
*
|
|
6
|
+
* Required generated metrics (created automatically by the toolkit):
|
|
7
|
+
* - rum.frontend_toolkit.api_total — count of XHR/fetch resources
|
|
8
|
+
* - rum.frontend_toolkit.api_errors — count of XHR/fetch resources with status >= 400
|
|
9
|
+
* - rum.frontend_toolkit.good_lcp — count of views with LCP < 2.5 s
|
|
6
10
|
*/
|
|
7
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RUM_METRIC_DEFINITIONS = void 0;
|
|
8
13
|
exports.buildSloTemplates = buildSloTemplates;
|
|
14
|
+
exports.RUM_METRIC_DEFINITIONS = [
|
|
15
|
+
{
|
|
16
|
+
id: 'rum.frontend_toolkit.api_total',
|
|
17
|
+
event_type: 'resource',
|
|
18
|
+
filter: '@resource.type:(xhr OR fetch)',
|
|
19
|
+
group_by: [
|
|
20
|
+
{ path: 'service', tag_name: 'service' },
|
|
21
|
+
{ path: 'env', tag_name: 'env' },
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'rum.frontend_toolkit.api_errors',
|
|
26
|
+
event_type: 'resource',
|
|
27
|
+
filter: '@resource.type:(xhr OR fetch) @resource.status_code:>=400',
|
|
28
|
+
group_by: [
|
|
29
|
+
{ path: 'service', tag_name: 'service' },
|
|
30
|
+
{ path: 'env', tag_name: 'env' },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'rum.frontend_toolkit.good_lcp',
|
|
35
|
+
event_type: 'view',
|
|
36
|
+
filter: '@view.largest_contentful_paint:<2500000000',
|
|
37
|
+
group_by: [
|
|
38
|
+
{ path: 'service', tag_name: 'service' },
|
|
39
|
+
{ path: 'env', tag_name: 'env' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
];
|
|
9
43
|
function buildSloTemplates(service, env, _monitorIds, team) {
|
|
10
44
|
const tags = [
|
|
11
45
|
`service:${service}`,
|
|
@@ -15,12 +49,12 @@ function buildSloTemplates(service, env, _monitorIds, team) {
|
|
|
15
49
|
];
|
|
16
50
|
return [
|
|
17
51
|
{
|
|
18
|
-
name: `${service} (${env}) -
|
|
19
|
-
description: 'Measures
|
|
52
|
+
name: `${service} (${env}) - API Availability`,
|
|
53
|
+
description: 'Measures API request availability as the ratio of successful API calls (XHR/fetch with status < 400) to total API calls. Pattern: good = total − errors. Managed by datadog-frontend-toolkit.',
|
|
20
54
|
type: 'metric',
|
|
21
55
|
query: {
|
|
22
|
-
numerator: `sum:rum.
|
|
23
|
-
denominator: `sum:rum.
|
|
56
|
+
numerator: `sum:rum.frontend_toolkit.api_total{service:${service},env:${env}}.as_count() - sum:rum.frontend_toolkit.api_errors{service:${service},env:${env}}.as_count()`,
|
|
57
|
+
denominator: `sum:rum.frontend_toolkit.api_total{service:${service},env:${env}}.as_count()`,
|
|
24
58
|
},
|
|
25
59
|
thresholds: [
|
|
26
60
|
{ timeframe: '7d', target: 99.5, warning: 99.9 },
|
|
@@ -28,6 +62,20 @@ function buildSloTemplates(service, env, _monitorIds, team) {
|
|
|
28
62
|
],
|
|
29
63
|
tags,
|
|
30
64
|
},
|
|
65
|
+
{
|
|
66
|
+
name: `${service} (${env}) - Core Web Vitals (LCP)`,
|
|
67
|
+
description: 'Measures the percentage of page views with good Largest Contentful Paint (< 2.5 s). Target aligned with Google Core Web Vitals "good" threshold (75 %). Managed by datadog-frontend-toolkit.',
|
|
68
|
+
type: 'metric',
|
|
69
|
+
query: {
|
|
70
|
+
numerator: `sum:rum.frontend_toolkit.good_lcp{service:${service},env:${env}}.as_count()`,
|
|
71
|
+
denominator: `sum:rum.measure.view{service:${service},env:${env}}.as_count()`,
|
|
72
|
+
},
|
|
73
|
+
thresholds: [
|
|
74
|
+
{ timeframe: '7d', target: 75, warning: 90 },
|
|
75
|
+
{ timeframe: '30d', target: 75, warning: 90 },
|
|
76
|
+
],
|
|
77
|
+
tags,
|
|
78
|
+
},
|
|
31
79
|
];
|
|
32
80
|
}
|
|
33
81
|
//# sourceMappingURL=slos.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slos.js","sourceRoot":"","sources":["../../../src/resources/templates/slos.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"slos.js","sourceRoot":"","sources":["../../../src/resources/templates/slos.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAuDH,8CA6CC;AA3EY,QAAA,sBAAsB,GAA0B;IAC3D;QACE,EAAE,EAAE,gCAAgC;QACpC,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,+BAA+B;QACvC,QAAQ,EAAE;YACR,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;YACxC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;SACjC;KACF;IACD;QACE,EAAE,EAAE,iCAAiC;QACrC,UAAU,EAAE,UAAU;QACtB,MAAM,EAAE,2DAA2D;QACnE,QAAQ,EAAE;YACR,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;YACxC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;SACjC;KACF;IACD;QACE,EAAE,EAAE,+BAA+B;QACnC,UAAU,EAAE,MAAM;QAClB,MAAM,EAAE,4CAA4C;QACpD,QAAQ,EAAE;YACR,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE;YACxC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;SACjC;KACF;CACF,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,OAAe,EACf,GAAW,EACX,WAA2C,EAC3C,IAAa;IAEb,MAAM,IAAI,GAAG;QACX,WAAW,OAAO,EAAE;QACpB,OAAO,GAAG,EAAE;QACZ,kCAAkC;QAClC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAClC,CAAC;IAEF,OAAO;QACL;YACE,IAAI,EAAE,GAAG,OAAO,KAAK,GAAG,sBAAsB;YAC9C,WAAW,EACT,+LAA+L;YACjM,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE;gBACL,SAAS,EAAE,8CAA8C,OAAO,QAAQ,GAAG,8DAA8D,OAAO,QAAQ,GAAG,cAAc;gBACzK,WAAW,EAAE,8CAA8C,OAAO,QAAQ,GAAG,cAAc;aAC5F;YACD,UAAU,EAAE;gBACV,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;gBAChD,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;aAClD;YACD,IAAI;SACL;QACD;YACE,IAAI,EAAE,GAAG,OAAO,KAAK,GAAG,2BAA2B;YACnD,WAAW,EACT,8LAA8L;YAChM,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE;gBACL,SAAS,EAAE,6CAA6C,OAAO,QAAQ,GAAG,cAAc;gBACxF,WAAW,EAAE,gCAAgC,OAAO,QAAQ,GAAG,cAAc;aAC9E;YACD,UAAU,EAAE;gBACV,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;gBAC5C,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;aAC9C;YACD,IAAI;SACL;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -40,6 +40,11 @@ export declare class ResourceProvisioner {
|
|
|
40
40
|
private findExistingDashboard;
|
|
41
41
|
private findExistingMonitor;
|
|
42
42
|
private findExistingSlo;
|
|
43
|
+
/**
|
|
44
|
+
* Ensures the RUM-generated metrics required by the SLOs exist.
|
|
45
|
+
* Creates them via POST /api/v2/rum/config/metrics; silently ignores 409 (already exists).
|
|
46
|
+
*/
|
|
47
|
+
private ensureRumMetrics;
|
|
43
48
|
private apiRequest;
|
|
44
49
|
}
|
|
45
50
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceProvisioner.d.ts","sourceRoot":"","sources":["../../../src/resources/ResourceProvisioner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAM1D,UAAU,kBAAkB;IAC1B,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzD,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACrC,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAID;;;;;;;;GAQG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,EAAE,kBAAkB;IAMtC;;;OAGG;IACG,SAAS,CACb,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ResourceProvisioner.d.ts","sourceRoot":"","sources":["../../../src/resources/ResourceProvisioner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAM1D,UAAU,kBAAkB;IAC1B,UAAU,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzD,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACrC,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAID;;;;;;;;GAQG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,EAAE,kBAAkB;IAMtC;;;OAGG;IACG,SAAS,CACb,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,kBAAkB,CAAC;YAsChB,kBAAkB;YA8BlB,iBAAiB;YAkDjB,aAAa;YAqDb,qBAAqB;YA6BrB,mBAAmB;YAqCnB,eAAe;IAkC7B;;;OAGG;YACW,gBAAgB;YAyBhB,UAAU;CAwCzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../../../src/resources/templates/dashboard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../../../src/resources/templates/dashboard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgwB1G"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SLO templates for Datadog API provisioning.
|
|
3
|
-
* Uses metric-based SLOs with RUM
|
|
4
|
-
*
|
|
3
|
+
* Uses metric-based SLOs with custom RUM-generated metrics.
|
|
4
|
+
*
|
|
5
|
+
* Required generated metrics (created automatically by the toolkit):
|
|
6
|
+
* - rum.frontend_toolkit.api_total — count of XHR/fetch resources
|
|
7
|
+
* - rum.frontend_toolkit.api_errors — count of XHR/fetch resources with status >= 400
|
|
8
|
+
* - rum.frontend_toolkit.good_lcp — count of views with LCP < 2.5 s
|
|
5
9
|
*/
|
|
6
10
|
export interface SloTemplate {
|
|
7
11
|
name: string;
|
|
@@ -18,6 +22,20 @@ export interface SloTemplate {
|
|
|
18
22
|
}>;
|
|
19
23
|
tags: string[];
|
|
20
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Definitions for the RUM-generated metrics the SLOs depend on.
|
|
27
|
+
* Each entry maps to a POST /api/v2/rum/config/metrics call.
|
|
28
|
+
*/
|
|
29
|
+
export interface RumMetricDefinition {
|
|
30
|
+
id: string;
|
|
31
|
+
event_type: string;
|
|
32
|
+
filter: string;
|
|
33
|
+
group_by: Array<{
|
|
34
|
+
path: string;
|
|
35
|
+
tag_name: string;
|
|
36
|
+
}>;
|
|
37
|
+
}
|
|
38
|
+
export declare const RUM_METRIC_DEFINITIONS: RumMetricDefinition[];
|
|
21
39
|
export declare function buildSloTemplates(service: string, env: string, _monitorIds: {
|
|
22
40
|
id: number;
|
|
23
41
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slos.d.ts","sourceRoot":"","sources":["../../../../src/resources/templates/slos.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"slos.d.ts","sourceRoot":"","sources":["../../../../src/resources/templates/slos.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE;QACN,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,UAAU,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3E,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,sBAAsB,EAAE,mBAAmB,EA4BvD,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,WAAW,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAC3C,IAAI,CAAC,EAAE,MAAM,GACZ,WAAW,EAAE,CAwCf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "datadog-frontend-toolkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"description": "Enterprise-grade, framework-agnostic frontend observability toolkit for Datadog. Auto-instruments RUM, Logs, Error Tracking, Performance Monitoring, and provisions Dashboards, Monitors & SLOs.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|