Skip to content

Commit

Permalink
ARC Matheiu
Browse files Browse the repository at this point in the history
  • Loading branch information
usmanmani1122 committed Dec 6, 2024
1 parent 0aaa4c6 commit 5eff6ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/telemetry/src/context-aware-slog-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export const makeSlogSender = async options => {
* @param {import('./context-aware-slog.js').Slog} slog
*/
const slogSender = slog => {
const { timestamp: time, ...rest } = contextualSlogProcessor(slog);
const contextualizedSlog = contextualSlogProcessor(slog);

// eslint-disable-next-line prefer-template
stream.write(serializeSlogObj({ time, ...rest }) + '\n').catch(() => {});
stream.write(serializeSlogObj(contextualizedSlog) + '\n').catch(() => {});
};

return Object.assign(slogSender, {
Expand Down
10 changes: 5 additions & 5 deletions packages/telemetry/src/context-aware-slog.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ export const makeContextualSlogProcessor = (

/**
* @param {Slog} slog
* @returns {{ attributes: T & LogAttributes, body: Partial<Slog>; timestamp: Slog['time'] }}
* @returns {{ attributes: T & LogAttributes, body: Partial<Slog>; time: Slog['time'] }}
*/
const slogProcessor = ({ monotime, time: timestamp, ...body }) => {
const slogProcessor = ({ monotime, time, ...body }) => {
const finalBody = { ...body };

/** @type {{'crank.syscallNum'?: Slog['syscallNum']}} */
Expand Down Expand Up @@ -321,13 +321,13 @@ export const makeContextualSlogProcessor = (

const logAttributes = {
...staticContext,
'process.uptime': monotime,
...initContext, // Optional prelude
...blockContext, // Block is the first level of execution nesting
...triggerContext, // run and trigger info is nested next
...crankContext, // Finally cranks are the last level of nesting
...replayContext, // Replay is a substitute for crank context during vat page in
...eventLogAttributes,
'process.uptime': monotime,
};

/**
Expand Down Expand Up @@ -377,9 +377,9 @@ export const makeContextualSlogProcessor = (
}

return {
attributes: /** @type {T & LogAttributes} */ (logAttributes),
body: finalBody,
timestamp,
attributes: /** @type {T & LogAttributes} */ (logAttributes),
time,
};
};

Expand Down
4 changes: 2 additions & 2 deletions packages/telemetry/src/otel-context-aware-slog.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ export const makeSlogSender = async options => {
* @param {import('./context-aware-slog.js').Slog} slog
*/
const slogSender = slog => {
const { timestamp, ...logRecord } = contextualSlogProcessor(slog);
const { time, ...logRecord } = contextualSlogProcessor(slog);

const [secondsStr, fractionStr] = String(timestamp).split('.');
const [secondsStr, fractionStr] = String(time).split('.');
const seconds = parseInt(secondsStr, 10);
const nanoSeconds = parseInt(
(fractionStr || String(0)).padEnd(9, String(0)).slice(0, 9),
Expand Down

0 comments on commit 5eff6ba

Please sign in to comment.