-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: parse log severity number/array of object attributes + setup li…
…nting
- Loading branch information
Showing
26 changed files
with
326 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@hyperdx/node-opentelemetry': minor | ||
--- | ||
|
||
feat: use getSeverityNumber and parseLogAttributes for logger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...de-opentelemetry/__tests__/logger.test.ts → ...pentelemetry/src/__tests__/logger.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { init, initSDK, shutdown } from '../otel'; | ||
|
||
describe('otel', () => { | ||
it('can sucessively shutdown without initialization', () => { | ||
shutdown(); | ||
shutdown(); | ||
}); | ||
|
||
it('should be able to initialize the SDK with initSDK', async () => { | ||
initSDK({ | ||
apiKey: 'blabla', | ||
advancedNetworkCapture: true, | ||
consoleCapture: true, | ||
}); | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
|
||
shutdown(); | ||
}); | ||
|
||
it('should be able to initialize the SDK with init', async () => { | ||
init({ | ||
apiKey: 'blabla', | ||
}); | ||
|
||
await new Promise((resolve) => setTimeout(resolve, 1000)); | ||
|
||
shutdown(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...emetry/__tests__/instrumentations.test.ts → ...ations/__tests__/instrumentations.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/node-opentelemetry/src/otel-logger/__tests__/__snapshots__/index.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`otel-logger getSeverityNumber 1`] = ` | ||
{ | ||
"alert": 22, | ||
"debug": 5, | ||
"emerg": 23, | ||
"error": 17, | ||
"info": 9, | ||
"verbose": 6, | ||
"warn": 13, | ||
"warning": 13, | ||
} | ||
`; | ||
|
||
exports[`otel-logger parseLogAttributes 1`] = ` | ||
{ | ||
"a": 1, | ||
"b": "2", | ||
"c": "[{"d":3}]", | ||
"e": [ | ||
1, | ||
2, | ||
3, | ||
], | ||
"f": [ | ||
"a", | ||
"b", | ||
"c", | ||
], | ||
"g": { | ||
"h": "i", | ||
}, | ||
} | ||
`; |
31 changes: 31 additions & 0 deletions
31
packages/node-opentelemetry/src/otel-logger/__tests__/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { getSeverityNumber, parseLogAttributes } from '..'; | ||
|
||
describe('otel-logger', () => { | ||
it('getSeverityNumber', () => { | ||
expect({ | ||
alert: getSeverityNumber('alert'), | ||
debug: getSeverityNumber('debug'), | ||
emerg: getSeverityNumber('emerg'), | ||
error: getSeverityNumber('error'), | ||
info: getSeverityNumber('info'), | ||
verbose: getSeverityNumber('verbose'), | ||
warn: getSeverityNumber('warn'), | ||
warning: getSeverityNumber('warning'), | ||
}).toMatchSnapshot(); | ||
}); | ||
|
||
it('parseLogAttributes', () => { | ||
expect( | ||
parseLogAttributes({ | ||
a: 1, | ||
b: '2', | ||
c: [{ d: 3 }], | ||
e: [1, 2, 3], | ||
f: ['a', 'b', 'c'], | ||
g: { | ||
h: 'i', | ||
}, | ||
}), | ||
).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.