Skip to content

Commit

Permalink
we have some working output
Browse files Browse the repository at this point in the history
  • Loading branch information
twitchyvr committed Nov 20, 2023
1 parent 13b12ad commit 84efee0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ module.exports = async function (context, req) {
uniqueId: telemetry.uniqueId(),
header: telemetry.headers, // Assuming this contains the parsed header data
sessionInfo: telemetry.sessionInfo, // Contains the parsed YAML session info
varHeaders: telemetry.varHeaders, // Assuming this method returns the variable headers
telemetryData: telemetry.getTelemetryDataSummary()
varHeaders: telemetry.varHeaders // Assuming this method returns the variable headers
// Add a method to extract summarized telemetry data
// telemetryData: telemetry.getTelemetryDataSummary()
// You can add more methods as needed to extract different parts of the telemetry data
}

// Response
Expand Down
13 changes: 13 additions & 0 deletions src/utils/telemetry-file-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,27 @@ const sessionInfoStringFromFileDescriptor = (fd, telemetryHeader) => {
}

const varHeadersFromFileDescriptor = (fd, telemetryHeader) => {
// Add logging
console.log('Num vars:', telemetryHeader.numVars)
if (!isNumber(telemetryHeader.numVars, 'numVars')) {
return Promise.reject(new Error('Invalid number of variables (numVars)'))
}

const numberOfVariables = telemetryHeader.numVars
const startPosition = telemetryHeader.varHeaderOffset

// Add check before using in buffer size
if (!isNumber(numberOfVariables)) {
return Promise.reject(new Error('Invalid numVars'))
}

const fullBufferSize = numberOfVariables * VAR_HEADER_SIZE_IN_BYTES

// Add check before passing to read buffer
if (!isNumber(fullBufferSize)) {
return Promise.reject(new Error('Invalid buffer size'))
}

return readFileToBuffer(fd, startPosition, fullBufferSize)
.then(buffer => {
return R.range(0, numberOfVariables).map(count => {
Expand Down

0 comments on commit 84efee0

Please sign in to comment.