Skip to content

Commit b24213e

Browse files
committed
chore: refactor constant names
1 parent c9a30e7 commit b24213e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utils/InstabugUtils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,19 @@ export const generateTracePartialId = () => {
149149
export const generateW3CHeader = (networkStartTime: number) => {
150150
const { hexStringPartialId, numberPartilId } = generateTracePartialId();
151151

152+
const TRACESTATE = '4942472d';
153+
const VERSION = '00';
154+
const TRACE_FLAG = '01';
155+
152156
const timestampInSeconds = Math.floor(networkStartTime.valueOf() / 1000);
153157
const hexaDigitsTimestamp = timestampInSeconds.toString(16).toLowerCase();
154158
const traceId = `${hexaDigitsTimestamp}${hexStringPartialId}${hexaDigitsTimestamp}${hexStringPartialId}`;
155-
const parentId = `4942472d${hexStringPartialId}`;
159+
const parentId = `${TRACESTATE}${hexStringPartialId}`;
156160

157161
return {
158162
timestampInSeconds,
159163
partialId: numberPartilId,
160-
w3cHeader: `00-${traceId}-${parentId}-01`,
164+
w3cHeader: `${VERSION}-${traceId}-${parentId}-${TRACE_FLAG}`,
161165
};
162166
};
163167

0 commit comments

Comments
 (0)