diff --git a/CHANGELOG-FRONTIER.md b/CHANGELOG-FRONTIER.md index 5205499f0d..89f4732f99 100644 --- a/CHANGELOG-FRONTIER.md +++ b/CHANGELOG-FRONTIER.md @@ -1,3 +1,11 @@ +## 8.19.0 + +- Render the primary Grail tag values on `window.dtinfo`, next to `appName`, so a per-frontend Dynatrace RUM capture rule can copy them onto user events as `event_properties.*` + - `window.dtinfo.sid` is `//` from `FS_BLUEPRINT_NAME`, `FS_SYSTEM_NAME` and `FS_SERVICE_NAME`, derived as `@fs/startup` 4.4.0 derives it for the dyno's processes so RUM and back-end records match. It stops at the first missing or malformed segment and is not set when the blueprint is missing + - `window.dtinfo.environment` is `FS_ENVIRONMENT_NAME`, or else `FS_SYSTEM_NAME` mapped `int→dev`, `beta→test`, `prod→prod`. An unmapped system leaves it unset rather than mislabelled. `TARGET_ENV` is never read + - Each global is set only when its value is non-empty, in the same unconditional block as `appName` (not behind `NODE_ENV` or the RUM flag) + - Each frontend still needs its own capture rule per key before the values reach Grail. `fsetgrp_id` is not rendered yet: the project group is not on the Heroku deploy path + ## 8.17.0 - Migrate to the Dynatrace New RUM Experience (RUM on Grail) and load the agent `async` diff --git a/package-lock.json b/package-lock.json index ebd31e8ccd..e0df2d0a8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37140,7 +37140,7 @@ }, "packages/react-scripts": { "name": "@fs/react-scripts", - "version": "8.17.0", + "version": "8.19.0", "license": "MIT", "dependencies": { "@babel/core": "^7.16.0", diff --git a/packages/react-scripts/layout/views/layout.ejs b/packages/react-scripts/layout/views/layout.ejs index ba4c9ef91f..9fca8f92fd 100644 --- a/packages/react-scripts/layout/views/layout.ejs +++ b/packages/react-scripts/layout/views/layout.ejs @@ -68,8 +68,25 @@ // unconditionally and as early as possible. Both RUM Classic and the New RUM Experience can // read it via their own (separately configured) capture rules; gating it on the agent being // loaded meant the async treatments never set it at all. + // Keys: appName, sid (`//`) and environment (dev|test|prod), the + // primary Grail tag values, derived exactly as @fs/startup derives them for the dyno's + // processes so RUM events and back-end records match. Each frontend needs its own capture + // rule per key to copy it onto events. sid and environment come from the FS_* config vars + // only (never TARGET_ENV); a sid is positional, so it stops at the first missing or malformed + // segment; an unmapped system leaves environment unset rather than mislabelled. if (!window.dtinfo) window.dtinfo = {} window.dtinfo.appName = SERVER_DATA.appName + <% + const dtinfoSidSegments = [] + for (const segment of [process.env.FS_BLUEPRINT_NAME, process.env.FS_SYSTEM_NAME, process.env.FS_SERVICE_NAME]) { + if (!segment || !/^[a-z](?:[-a-z0-9]*[a-z0-9])?$/.test(segment)) break + dtinfoSidSegments.push(segment) + } + const dtinfoSid = dtinfoSidSegments.join('/') + const dtinfoEnvironment = process.env.FS_ENVIRONMENT_NAME || ({ int: 'dev', beta: 'test', prod: 'prod' })[process.env.FS_SYSTEM_NAME] || '' + %> + <% if (dtinfoSid) { %>window.dtinfo.sid = "<%= dtinfoSid %>"<% } %> + <% if (dtinfoEnvironment) { %>window.dtinfo.environment = "<%= dtinfoEnvironment %>"<% } %> // enableManualPageDetection is a RUM Classic API with no New RUM equivalent — New RUM models // navigations / page summaries / view summaries instead. Defer it until dtrum exists rather diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 588c4b1238..fb271dccbb 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,6 +1,6 @@ { "name": "@fs/react-scripts", - "version": "8.17.0", + "version": "8.19.0", "upstreamVersion": "5.0.1", "description": "Configuration and scripts for Create React App.", "repository": {