Skip to content

Commit

Permalink
add visibility into file contents
Browse files Browse the repository at this point in the history
  • Loading branch information
twitchyvr committed Nov 19, 2023
1 parent f23a9a6 commit 0abc4a7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ module.exports = async function (context, req) {

// Process telemetry
const telemetry = new Telemetry(telemetryData)

console.log('Telemetry headers:', telemetry.headers)
console.log(telemetry.header)

// Example: Create a summary or extract specific data from telemetry
Expand Down
10 changes: 9 additions & 1 deletion src/telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ class Telemetry {
try {
this.headers = telemetryHeader
this.diskHeaders = diskSubHeader
this.sessionInfo = yaml.load(sessionInfo)
try {
const yamlString = sessionInfo.toString()
console.log('Raw YAML:', yamlString)
this.sessionInfo = yaml.load(sessionInfo)
} catch (error) {
console.error('Error parsing YAML:', error)
this.sessionInfo = {}
}
} catch (error) {
console.error('Error loading YAML content:', error)
this.sessionInfo = {}
Expand Down Expand Up @@ -62,6 +69,7 @@ class Telemetry {
const sessionId = this.sessionInfo && this.sessionInfo.WeekendInfo && this.sessionInfo.WeekendInfo.SessionID
? this.sessionInfo.WeekendInfo.SessionID
: defaultId
console.log('Session ID:', sessionId)
const subSessionId = this.sessionInfo && this.sessionInfo.WeekendInfo && this.sessionInfo.WeekendInfo.SubSessionID
? this.sessionInfo.WeekendInfo.SubSessionID
: defaultId
Expand Down
13 changes: 11 additions & 2 deletions src/utils/telemetry-file-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,18 @@ const diskSubHeaderFromFileDescriptor = fd =>
readFileToBuffer(fd, DISK_SUB_HEADER_SIZE_IN_BYTES, HEADER_SIZE_IN_BYTES)
.then(DiskSubHeader.fromBuffer)

/**
const sessionInfoStringFromFileDescriptor = (fd, telemetryHeader) =>
readFileToBuffer(fd, telemetryHeader.sessionInfoOffset, telemetryHeader.sessionInfoLength)
.then(x => x.toString('ascii'))
readFileToBuffer(fd, telemetryHeader.sessionInfoOffset, telemetryHeader.sessionInfoLength)
.then(x => x.toString('ascii'))
*/

const sessionInfoStringFromFileDescriptor = (fd, telemetryHeader) => {
return readFileToBuffer(fd, telemetryHeader.sessionInfoOffset, telemetryHeader.sessionInfoLength)
.then(buffer => {
return buffer.toString('utf8'); // encode as utf-8
})
}

const varHeadersFromFileDescriptor = (fd, telemetryHeader) => {
const numberOfVariables = telemetryHeader.numVars
Expand Down

0 comments on commit 0abc4a7

Please sign in to comment.