2023-10-01 11:46:51 +00:00
|
|
|
import AnalyticsBaseModel from 'Common/AnalyticsModels/BaseModel';
|
2023-08-22 08:37:39 +00:00
|
|
|
import AnalyticsTableColumn from 'Common/Types/AnalyticsDatabase/TableColumn';
|
2023-10-18 12:59:19 +00:00
|
|
|
import TableColumnType from 'Common/Types/AnalyticsDatabase/TableColumnType';
|
2023-08-22 08:37:39 +00:00
|
|
|
import AnalyticsTableEngine from 'Common/Types/AnalyticsDatabase/AnalyticsTableEngine';
|
2023-10-03 12:29:12 +00:00
|
|
|
import ObjectID from 'Common/Types/ObjectID';
|
2023-10-18 16:28:49 +00:00
|
|
|
import KeyValueNestedModel from './NestedModels/KeyValueNestedModel';
|
2023-08-21 16:23:19 +00:00
|
|
|
|
|
|
|
export default class Log extends AnalyticsBaseModel {
|
|
|
|
public constructor() {
|
|
|
|
super({
|
2023-10-18 12:59:19 +00:00
|
|
|
tableName: 'Log',
|
2023-08-21 16:23:19 +00:00
|
|
|
tableEngine: AnalyticsTableEngine.MergeTree,
|
2023-10-01 13:52:56 +00:00
|
|
|
singularName: 'Log',
|
|
|
|
pluralName: 'Logs',
|
2023-08-21 16:23:19 +00:00
|
|
|
tableColumns: [
|
|
|
|
new AnalyticsTableColumn({
|
|
|
|
key: 'projectId',
|
|
|
|
title: 'Project ID',
|
|
|
|
description: 'ID of project',
|
|
|
|
required: true,
|
|
|
|
type: TableColumnType.ObjectID,
|
|
|
|
}),
|
2023-10-02 11:13:37 +00:00
|
|
|
|
2023-08-21 16:23:19 +00:00
|
|
|
new AnalyticsTableColumn({
|
2023-10-18 12:59:19 +00:00
|
|
|
key: 'serviceId',
|
|
|
|
title: 'Service ID',
|
|
|
|
description: 'ID of the Service which created the log',
|
2023-08-21 16:23:19 +00:00
|
|
|
required: true,
|
|
|
|
type: TableColumnType.ObjectID,
|
|
|
|
}),
|
2023-10-02 11:13:37 +00:00
|
|
|
|
2023-08-21 16:23:19 +00:00
|
|
|
new AnalyticsTableColumn({
|
2023-10-23 14:17:25 +00:00
|
|
|
key: 'time',
|
|
|
|
title: 'Time',
|
|
|
|
description: 'When was the log created?',
|
2023-10-18 16:28:49 +00:00
|
|
|
required: true,
|
2023-10-23 14:17:25 +00:00
|
|
|
type: TableColumnType.Date,
|
2023-10-18 16:28:49 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
new AnalyticsTableColumn({
|
2023-10-23 14:17:25 +00:00
|
|
|
key: 'timeUnixNano',
|
|
|
|
title: 'Time (in Unix Nano)',
|
2023-10-02 11:13:37 +00:00
|
|
|
description: 'When was the log created?',
|
|
|
|
required: true,
|
2023-10-24 09:56:41 +00:00
|
|
|
type: TableColumnType.LongNumber,
|
2023-10-02 11:13:37 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
new AnalyticsTableColumn({
|
2023-10-18 16:28:49 +00:00
|
|
|
key: 'severityText',
|
|
|
|
title: 'Severity Text',
|
|
|
|
description: 'Log Severity Text',
|
2023-10-02 11:13:37 +00:00
|
|
|
required: true,
|
2023-10-18 12:59:19 +00:00
|
|
|
type: TableColumnType.Text,
|
2023-10-02 11:13:37 +00:00
|
|
|
}),
|
2023-10-18 16:28:49 +00:00
|
|
|
|
|
|
|
new AnalyticsTableColumn({
|
|
|
|
key: 'severityNumber',
|
|
|
|
title: 'Severity Number',
|
|
|
|
description: 'Log Severity Number',
|
|
|
|
required: true,
|
2023-10-23 14:17:25 +00:00
|
|
|
type: TableColumnType.Text,
|
2023-10-18 16:28:49 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
new AnalyticsTableColumn({
|
|
|
|
key: 'attributes',
|
|
|
|
title: 'Attributes',
|
|
|
|
description: 'Attributes',
|
|
|
|
required: false,
|
|
|
|
type: TableColumnType.NestedModel,
|
2023-10-18 16:44:54 +00:00
|
|
|
nestedModel: new KeyValueNestedModel(),
|
2023-10-18 16:28:49 +00:00
|
|
|
}),
|
|
|
|
|
|
|
|
new AnalyticsTableColumn({
|
|
|
|
key: 'traceId',
|
|
|
|
title: 'Trace ID',
|
|
|
|
description: 'ID of the trace',
|
|
|
|
required: false,
|
|
|
|
type: TableColumnType.Text,
|
|
|
|
}),
|
|
|
|
|
|
|
|
new AnalyticsTableColumn({
|
|
|
|
key: 'spanId',
|
|
|
|
title: 'Span ID',
|
|
|
|
description: 'ID of the span',
|
|
|
|
required: false,
|
|
|
|
type: TableColumnType.Text,
|
|
|
|
}),
|
2023-10-23 14:17:25 +00:00
|
|
|
|
|
|
|
new AnalyticsTableColumn({
|
|
|
|
key: 'body',
|
|
|
|
title: 'Log Body',
|
|
|
|
description: 'Body of the Log',
|
|
|
|
required: false,
|
|
|
|
type: TableColumnType.Text,
|
|
|
|
}),
|
2023-08-21 16:23:19 +00:00
|
|
|
],
|
2023-10-18 16:28:49 +00:00
|
|
|
primaryKeys: ['projectId', 'serviceId', 'time'],
|
2023-08-22 08:37:39 +00:00
|
|
|
});
|
2023-08-21 16:23:19 +00:00
|
|
|
}
|
2023-10-02 11:13:37 +00:00
|
|
|
|
2023-10-18 16:28:49 +00:00
|
|
|
public get projectId(): ObjectID | undefined {
|
|
|
|
return this.getColumnValue('projectId') as ObjectID | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
public set projectId(v: ObjectID | undefined) {
|
|
|
|
this.setColumnValue('projectId', v);
|
2023-10-02 11:13:37 +00:00
|
|
|
}
|
2023-10-18 16:28:49 +00:00
|
|
|
|
|
|
|
public get serviceId(): ObjectID | undefined {
|
|
|
|
return this.getColumnValue('serviceId') as ObjectID | undefined;
|
2023-10-02 11:13:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-18 16:28:49 +00:00
|
|
|
public set serviceId(v: ObjectID | undefined) {
|
|
|
|
this.setColumnValue('serviceId', v);
|
2023-10-02 11:13:37 +00:00
|
|
|
}
|
2023-10-18 16:28:49 +00:00
|
|
|
|
|
|
|
public get name(): string | undefined {
|
|
|
|
return this.getColumnValue('name') as string | undefined;
|
2023-10-02 11:13:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-18 16:28:49 +00:00
|
|
|
public set body(v: string | undefined) {
|
|
|
|
this.setColumnValue('body', v);
|
2023-10-02 11:13:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-18 16:28:49 +00:00
|
|
|
public get time(): Date | undefined {
|
|
|
|
return this.getColumnValue('time') as Date | undefined;
|
2023-10-02 11:13:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-18 16:28:49 +00:00
|
|
|
public set time(v: Date | undefined) {
|
|
|
|
this.setColumnValue('time', v);
|
2023-10-02 11:13:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-23 14:17:25 +00:00
|
|
|
public get timeUnixNano(): number | undefined {
|
|
|
|
return this.getColumnValue('timeUnixNano') as number | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
public set timeUnixNano(v: number | undefined) {
|
|
|
|
this.setColumnValue('timeUnixNano', v);
|
|
|
|
}
|
|
|
|
|
2023-10-18 16:28:49 +00:00
|
|
|
public get severityText(): string | undefined {
|
|
|
|
return this.getColumnValue('severityText') as string | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
public set severityText(v: string | undefined) {
|
|
|
|
this.setColumnValue('severityText', v);
|
|
|
|
}
|
|
|
|
|
2023-10-23 14:17:25 +00:00
|
|
|
public get severityNumber(): string | undefined {
|
|
|
|
return this.getColumnValue('severityNumber') as string | undefined;
|
2023-10-02 11:13:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-23 14:17:25 +00:00
|
|
|
public set severityNumber(v: string | undefined) {
|
2023-10-18 16:28:49 +00:00
|
|
|
this.setColumnValue('severityNumber', v);
|
2023-10-02 11:13:37 +00:00
|
|
|
}
|
|
|
|
|
2023-10-18 16:28:49 +00:00
|
|
|
public get attributes(): Array<KeyValueNestedModel> | undefined {
|
2023-10-18 16:44:54 +00:00
|
|
|
return this.getColumnValue('attributes') as
|
|
|
|
| Array<KeyValueNestedModel>
|
|
|
|
| undefined;
|
2023-10-18 16:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public set attributes(v: Array<KeyValueNestedModel> | undefined) {
|
|
|
|
this.setColumnValue('attributes', v);
|
|
|
|
}
|
|
|
|
|
|
|
|
public get traceId(): string | undefined {
|
|
|
|
return this.getColumnValue('traceId') as string | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
public set traceId(v: string | undefined) {
|
|
|
|
this.setColumnValue('traceId', v);
|
|
|
|
}
|
|
|
|
|
|
|
|
public get spanId(): string | undefined {
|
|
|
|
return this.getColumnValue('spanId') as string | undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
public set spanId(v: string | undefined) {
|
|
|
|
this.setColumnValue('spanId', v);
|
|
|
|
}
|
2023-08-22 08:37:39 +00:00
|
|
|
}
|