Skip to content

Commit

Permalink
feat(tracing): Add GB unit to device memory tag value (#4935)
Browse files Browse the repository at this point in the history
Since tag values are always strings, it'll be useful to attach units to the `deviceMemory` tag. Since `navigator.deviceMemory` are approximate in gigabytes, we can suffix the tag value with " GB".

Reference: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/deviceMemory
  • Loading branch information
dashed authored and lobsterkatie committed Apr 26, 2022
1 parent 9f3253d commit 1660047
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/tracing/src/browser/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class MetricsInstrumentation {
}

if (isMeasurementValue(navigator.deviceMemory)) {
transaction.setTag('deviceMemory', String(navigator.deviceMemory));
transaction.setTag('deviceMemory', `${navigator.deviceMemory} GB`);
}

if (isMeasurementValue(navigator.hardwareConcurrency)) {
Expand Down

0 comments on commit 1660047

Please sign in to comment.