mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
fix fmt
This commit is contained in:
parent
9fe998a43d
commit
03f9c36f06
@ -191,19 +191,24 @@ router.post(
|
||||
|
||||
req.body = req.body.toJSON();
|
||||
|
||||
const resourceLogs = req.body['resourceLogs'] as JSONArray;
|
||||
const resourceLogs: JSONArray = req.body[
|
||||
'resourceLogs'
|
||||
] as JSONArray;
|
||||
|
||||
const dbLogs: Array<Log> = [];
|
||||
|
||||
for (const resourceLog of resourceLogs) {
|
||||
const scopeLogs = resourceLog['scopeLogs'] as JSONArray;
|
||||
const scopeLogs: JSONArray = resourceLog[
|
||||
'scopeLogs'
|
||||
] as JSONArray;
|
||||
|
||||
for (const scopeLog of scopeLogs) {
|
||||
|
||||
const logRecords = scopeLog['logRecords'] as JSONArray;
|
||||
const logRecords: JSONArray = scopeLog[
|
||||
'logRecords'
|
||||
] as JSONArray;
|
||||
|
||||
for (const log of logRecords) {
|
||||
const dbLog = new Log();
|
||||
const dbLog: Log = new Log();
|
||||
|
||||
/*
|
||||
Example:
|
||||
@ -225,26 +230,25 @@ router.post(
|
||||
dbLog.serviceId = ObjectID.getZeroObjectID();
|
||||
|
||||
dbLog.timeUnixNano = log['timeUnixNano'] as number;
|
||||
dbLog.time = OneUptimeDate.fromUnixNano(log['timeUnixNano'] as number);
|
||||
dbLog.time = OneUptimeDate.fromUnixNano(
|
||||
log['timeUnixNano'] as number
|
||||
);
|
||||
dbLog.severityNumber = log['severityNumber'] as string;
|
||||
dbLog.severityText = log['severityText'] as string;
|
||||
|
||||
const logBody: JSONObject = log['body'] as JSONObject;
|
||||
|
||||
|
||||
dbLog.body = logBody['stringValue'] as string;
|
||||
|
||||
dbLog.traceId = log['traceId'] as string;
|
||||
dbLog.spanId = log['spanId'] as string;
|
||||
|
||||
|
||||
// We need to convert this to date.
|
||||
const attributes: JSONArray = log[
|
||||
'attributes'
|
||||
] as JSONArray;
|
||||
|
||||
if (attributes) {
|
||||
|
||||
const dbattributes: Array<KeyValueNestedModel> = [];
|
||||
|
||||
for (const attribute of attributes) {
|
||||
@ -274,9 +278,7 @@ router.post(
|
||||
}
|
||||
|
||||
dbLogs.push(dbLog);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ export default class Log extends AnalyticsBaseModel {
|
||||
type: TableColumnType.ObjectID,
|
||||
}),
|
||||
|
||||
|
||||
new AnalyticsTableColumn({
|
||||
key: 'time',
|
||||
title: 'Time',
|
||||
@ -46,7 +45,6 @@ export default class Log extends AnalyticsBaseModel {
|
||||
type: TableColumnType.Number,
|
||||
}),
|
||||
|
||||
|
||||
new AnalyticsTableColumn({
|
||||
key: 'severityText',
|
||||
title: 'Severity Text',
|
||||
@ -63,7 +61,6 @@ export default class Log extends AnalyticsBaseModel {
|
||||
type: TableColumnType.Text,
|
||||
}),
|
||||
|
||||
|
||||
new AnalyticsTableColumn({
|
||||
key: 'attributes',
|
||||
title: 'Attributes',
|
||||
@ -157,7 +154,6 @@ export default class Log extends AnalyticsBaseModel {
|
||||
this.setColumnValue('severityNumber', v);
|
||||
}
|
||||
|
||||
|
||||
public get attributes(): Array<KeyValueNestedModel> | undefined {
|
||||
return this.getColumnValue('attributes') as
|
||||
| Array<KeyValueNestedModel>
|
||||
|
Loading…
Reference in New Issue
Block a user