-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Add types for logs protocol and envelope (#15530)
ref #15526 Based on the work in #15442, we add definitions for the logs protocol and envelope to the JavaScript SDKs. Relay data category: https://github.com/getsentry/relay/blob/e36886a98c89af645e5c0d2109657deafa25d902/relay-server/src/envelope.rs#L182 Relay log protocol: https://github.com/getsentry/relay/blob/ad04adf6d6756c4e36328c8217bea0ee01f289ec/relay-event-schema/src/protocol/ourlog.rs#L12
- Loading branch information
1 parent
f024ccf
commit d12c192
Showing
4 changed files
with
74 additions
and
1 deletion.
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
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,64 @@ | ||
export type LogSeverityLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal' | 'critical'; | ||
|
||
export type LogAttributeValueType = | ||
| { | ||
stringValue: string; | ||
} | ||
| { | ||
intValue: number; | ||
} | ||
| { | ||
boolValue: boolean; | ||
} | ||
| { | ||
doubleValue: number; | ||
}; | ||
|
||
export type LogAttribute = { | ||
key: string; | ||
value: LogAttributeValueType; | ||
}; | ||
|
||
export interface Log { | ||
/** | ||
* The severity level of the log. | ||
* | ||
* Allowed values are, from highest to lowest: | ||
* `critical`, `fatal`, `error`, `warn`, `info`, `debug`, `trace`. | ||
* | ||
* The log level changes how logs are filtered and displayed. | ||
* Critical level logs are emphasized more than trace level logs. | ||
*/ | ||
severityText?: LogSeverityLevel; | ||
|
||
/** | ||
* The severity number - generally higher severity are levels like 'error' and lower are levels like 'debug' | ||
*/ | ||
severityNumber?: number; | ||
|
||
/** | ||
* The trace ID for this log | ||
*/ | ||
traceId?: string; | ||
|
||
/** | ||
* The message to be logged - for example, 'hello world' would become a log like '[INFO] hello world' | ||
*/ | ||
body: { | ||
stringValue: string; | ||
}; | ||
|
||
/** | ||
* Arbitrary structured data that stores information about the log - e.g., userId: 100. | ||
*/ | ||
attributes?: LogAttribute[]; | ||
|
||
/** | ||
* This doesn't have to be explicitly specified most of the time. If you need to set it, the value | ||
* is the number of seconds since midnight on January 1, 1970 ("unix epoch time") | ||
* | ||
* @summary A timestamp representing when the log occurred. | ||
* @link https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/#:~:text=is%20info.-,timestamp,-(recommended) | ||
*/ | ||
timeUnixNano?: string; | ||
} |
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