mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 07:10:53 +00:00
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { JSONArray, JSONObject } from 'Common/Types/JSON';
|
|
import KeyValueNestedModel from 'Model/AnalyticsModels/NestedModels/KeyValueNestedModel';
|
|
|
|
export default class OTelIngestService {
|
|
public static getKeyValues(items: JSONArray): Array<KeyValueNestedModel> {
|
|
// We need to convert this to date.
|
|
const attributes: JSONArray = items;
|
|
|
|
if (attributes) {
|
|
const dbattributes: Array<KeyValueNestedModel> = [];
|
|
|
|
for (const attribute of attributes) {
|
|
const dbattribute: KeyValueNestedModel =
|
|
new KeyValueNestedModel();
|
|
dbattribute.key = attribute['key'] as string;
|
|
|
|
const value: JSONObject = attribute['value'] as JSONObject;
|
|
|
|
if (value['stringValue']) {
|
|
dbattribute.stringValue = value['stringValue'] as string;
|
|
}
|
|
|
|
if (value['intValue']) {
|
|
dbattribute.numberValue = value['intValue'] as number;
|
|
}
|
|
dbattributes.push(dbattribute);
|
|
}
|
|
|
|
return dbattributes;
|
|
}
|
|
|
|
return [];
|
|
}
|
|
}
|