diff --git a/Ingestor/API/OTelIngest.ts b/Ingestor/API/OTelIngest.ts index 1994a68d12..e164d777ad 100644 --- a/Ingestor/API/OTelIngest.ts +++ b/Ingestor/API/OTelIngest.ts @@ -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 = []; 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 = []; for (const attribute of attributes) { @@ -274,9 +278,7 @@ router.post( } dbLogs.push(dbLog); - } - } } diff --git a/Model/AnalyticsModels/Log.ts b/Model/AnalyticsModels/Log.ts index 46777f67f2..4d9aca012f 100644 --- a/Model/AnalyticsModels/Log.ts +++ b/Model/AnalyticsModels/Log.ts @@ -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 | undefined { return this.getColumnValue('attributes') as | Array