@adobe/spacecat-shared-rum-api-client 2.43.1 → 2.44.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.
- package/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/src/client.js +2 -0
- package/src/common/rum-bundler-client.js +3 -1
- package/src/functions/total-metrics.js +26 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [@adobe/spacecat-shared-rum-api-client-v2.44.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.44.0...@adobe/spacecat-shared-rum-api-client-v2.44.1) (2026-07-24)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* add domain and summary to RUM bundle failure logs (rum-api-client) ([#1841](https://github.com/adobe/spacecat-shared/issues/1841)) ([d70bfa5](https://github.com/adobe/spacecat-shared/commit/d70bfa584d035f5234b5abb276c842af10848a46))
|
|
6
|
+
|
|
7
|
+
## [@adobe/spacecat-shared-rum-api-client-v2.44.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.43.1...@adobe/spacecat-shared-rum-api-client-v2.44.0) (2026-06-26)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **rum:** scope latest-metrics RUM to locale path prefix ([#1707](https://github.com/adobe/spacecat-shared/issues/1707)) ([77cdb33](https://github.com/adobe/spacecat-shared/commit/77cdb33d7f55a9bff795b768621ec70830b2cba3))
|
|
12
|
+
|
|
1
13
|
## [@adobe/spacecat-shared-rum-api-client-v2.43.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v2.43.0...@adobe/spacecat-shared-rum-api-client-v2.43.1) (2026-06-15)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -140,6 +140,7 @@ export default class RUMAPIClient {
|
|
|
140
140
|
...opts,
|
|
141
141
|
domainkey,
|
|
142
142
|
checkpoints,
|
|
143
|
+
queryType: query,
|
|
143
144
|
}, this.log);
|
|
144
145
|
|
|
145
146
|
this.log.debug(`Query "${query}" fetched ${bundles.length} bundles`); // maybe even remove?
|
|
@@ -175,6 +176,7 @@ export default class RUMAPIClient {
|
|
|
175
176
|
...opts,
|
|
176
177
|
domainkey,
|
|
177
178
|
checkpoints: [...allCheckpoints],
|
|
179
|
+
queryType: queries.join(','),
|
|
178
180
|
}, this.log);
|
|
179
181
|
|
|
180
182
|
const results = {};
|
|
@@ -262,6 +262,7 @@ async function fetchBundles(opts, log) {
|
|
|
262
262
|
filterBotTraffic = true,
|
|
263
263
|
startTime,
|
|
264
264
|
endTime,
|
|
265
|
+
queryType,
|
|
265
266
|
} = opts;
|
|
266
267
|
|
|
267
268
|
if (!hasText(domain) || !hasText(domainkey)) {
|
|
@@ -290,7 +291,7 @@ async function fetchBundles(opts, log) {
|
|
|
290
291
|
return response.json();
|
|
291
292
|
} else {
|
|
292
293
|
const failedUrl = response.url || chunk[index];
|
|
293
|
-
log.warn(`Skipping response at index ${index}: status ${response.status} - url: ${sanitizeURL(failedUrl)}`);
|
|
294
|
+
log.warn(`Skipping response at index ${index}: status ${response.status} for domain: ${domain} - url: ${sanitizeURL(failedUrl)}`);
|
|
294
295
|
failedUrls.push(failedUrl);
|
|
295
296
|
return null;
|
|
296
297
|
}
|
|
@@ -316,6 +317,7 @@ async function fetchBundles(opts, log) {
|
|
|
316
317
|
|
|
317
318
|
// Add failedUrls to opts object for access by callers
|
|
318
319
|
if (failedUrls.length > 0) {
|
|
320
|
+
log.warn(`[RUM] ${failedUrls.length}/${urls.length} bundle requests failed for domain: ${domain}${queryType ? ` (query: ${queryType})` : ''}`);
|
|
319
321
|
// eslint-disable-next-line no-param-reassign
|
|
320
322
|
opts.failedUrls = failedUrls;
|
|
321
323
|
}
|
|
@@ -13,9 +13,33 @@
|
|
|
13
13
|
import { DataChunks, series } from '@adobe/rum-distiller';
|
|
14
14
|
import { loadBundles } from '../utils.js';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Checks whether a bundle URL falls under a given path prefix.
|
|
18
|
+
* Boundary-safe: prefix '/de' matches '/de' and '/de/...' but NOT '/design'.
|
|
19
|
+
* @param {string} url - Bundle URL.
|
|
20
|
+
* @param {string} prefix - Normalized path prefix (e.g. '/de').
|
|
21
|
+
* @returns {boolean} True if the URL's path is at or under the prefix.
|
|
22
|
+
*/
|
|
23
|
+
function matchesPathPrefix(url, prefix) {
|
|
24
|
+
try {
|
|
25
|
+
const { pathname } = new URL(url);
|
|
26
|
+
const path = pathname !== '/' ? pathname.replace(/\/+$/, '') : '/';
|
|
27
|
+
return path === prefix || path.startsWith(`${prefix}/`);
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function handler(bundles, opts = {}) {
|
|
34
|
+
// Locale-specific sites (e.g. https://example.com/de) have no domain key of their
|
|
35
|
+
// own — RUM is fetched for the main domain, then narrowed to the locale subtree here.
|
|
36
|
+
const { pathPrefix } = opts;
|
|
37
|
+
const scopedBundles = pathPrefix
|
|
38
|
+
? bundles.filter((b) => b?.url && matchesPathPrefix(b.url, pathPrefix))
|
|
39
|
+
: bundles;
|
|
40
|
+
|
|
17
41
|
const dataChunks = new DataChunks();
|
|
18
|
-
loadBundles(
|
|
42
|
+
loadBundles(scopedBundles, dataChunks);
|
|
19
43
|
dataChunks.addSeries('traffic_domain', series.pageViews);
|
|
20
44
|
dataChunks.addSeries('clicks', (bundle) => (bundle.events.some((e) => e.checkpoint === 'click')
|
|
21
45
|
? bundle.weight
|