-
Notifications
You must be signed in to change notification settings - Fork 16
feat(decoder): Add support for Structured CLP IR streams but without log-level filtering. #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5a751bd
11e16d5
826057f
e68a907
7aaedb5
2df1e9c
e0bdb68
479fd71
29d85a6
023e345
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,12 +53,13 @@ const convertToLogLevelValue = (field: JsonValue | undefined): LOG_LEVEL => { | |
* - the timestamp's value is an unsupported type. | ||
* - the timestamp's value is not a valid dayjs timestamp. | ||
*/ | ||
const convertToDayjsTimestamp = (field: JsonValue | undefined): dayjs.Dayjs => { | ||
const convertToDayjsTimestamp = (field: JsonValue | bigint | undefined): dayjs.Dayjs => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also how do u feel about this file to utils? Since it is shared by both IR and Json now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right that's an issue... Just to understand why we need the mitigation, where are we using json.parse with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially also in json decoder if logs have an bigint? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. omg...
funny finding: https://www.github.com/nlohmann/json/issues/1708 -> https://www.github.com/nlohmann/json/pull/1722 Let's discuss the issue with the clp core people before we make changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed offline, calling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be tracked at #116 |
||
// If the field is an invalid type, then set the timestamp to `INVALID_TIMESTAMP_VALUE`. | ||
// NOTE: dayjs surprisingly thinks `undefined` is a valid date. See | ||
// https://day.js.org/docs/en/parse/now#docsNav | ||
if (("string" !== typeof field && | ||
"number" !== typeof field) || | ||
"number" !== typeof field && | ||
"bigint" !== typeof field) || | ||
"undefined" === typeof field | ||
) { | ||
// `INVALID_TIMESTAMP_VALUE` is a valid dayjs date. Another potential option is | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,20 +8,16 @@ interface LogEventCount { | |
} | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Description intentionally omitted. |
||
* Options for the JSONL decoder. | ||
* | ||
* @property formatString The format string to use to serialize records as plain text. | ||
* @property logLevelKey The key of the kv-pair that contains the log level in every record. | ||
* @property timestampKey The key of the kv-pair that contains the timestamp in every record. | ||
*/ | ||
interface JsonlDecoderOptionsType { | ||
interface DecoderOptions { | ||
formatString: string, | ||
logLevelKey: string, | ||
timestampKey: string, | ||
} | ||
|
||
type DecoderOptionsType = JsonlDecoderOptionsType; | ||
|
||
/** | ||
* Type of the decoded log event. We use an array rather than object so that it's easier to return | ||
* results from WASM-based decoders. | ||
|
@@ -31,7 +27,7 @@ type DecoderOptionsType = JsonlDecoderOptionsType; | |
* @property level | ||
* @property number | ||
*/ | ||
type DecodeResultType = [string, number, number, number]; | ||
type DecodeResult = [string, bigint, number, number]; | ||
|
||
/** | ||
* Mapping between an index in the filtered log events collection to an index in the unfiltered log | ||
|
@@ -85,7 +81,7 @@ interface Decoder { | |
* @param options | ||
* @return Whether the options were successfully set. | ||
*/ | ||
setFormatterOptions(options: DecoderOptionsType): boolean; | ||
setFormatterOptions(options: DecoderOptions): boolean; | ||
|
||
/** | ||
* Decodes log events in the range `[beginIdx, endIdx)` of the filtered or unfiltered | ||
|
@@ -101,15 +97,14 @@ interface Decoder { | |
beginIdx: number, | ||
endIdx: number, | ||
useFilter: boolean | ||
): Nullable<DecodeResultType[]>; | ||
): Nullable<DecodeResult[]>; | ||
} | ||
|
||
export type { | ||
ActiveLogCollectionEventIdx, | ||
Decoder, | ||
DecodeResultType, | ||
DecoderOptionsType, | ||
DecodeResult, | ||
DecoderOptions, | ||
FilteredLogEventMap, | ||
JsonlDecoderOptionsType, | ||
LogEventCount, | ||
}; |
Uh oh!
There was an error while loading. Please reload this page.