@oneuptime/common 7.0.2990 → 7.0.3010
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/ExceptionInstance.ts +488 -0
- package/Models/AnalyticsModels/Index.ts +2 -0
- package/Models/AnalyticsModels/Span.ts +2 -2
- package/Models/DatabaseModels/Index.ts +4 -0
- package/Models/DatabaseModels/TelemetryException.ts +978 -0
- package/Server/API/StatusAPI.ts +63 -51
- package/Server/EnvironmentConfig.ts +3 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.ts +93 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.ts +60 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.ts +17 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Infrastructure/Queue.ts +36 -1
- package/Server/Infrastructure/QueueWorker.ts +2 -2
- package/Server/Services/DatabaseService.ts +4 -5
- package/Server/Services/ExceptionInstanceService.ts +11 -0
- package/Server/Services/Index.ts +5 -0
- package/Server/Services/StatusPageDomainService.ts +118 -59
- package/Server/Services/TelemetryExceptionService.ts +10 -0
- package/Server/Types/Database/Permissions/Index.ts +1 -1
- package/Server/Types/Database/UpdateByID.ts +1 -1
- package/Server/Utils/Greenlock/Greenlock.ts +331 -204
- package/Server/Utils/Logger.ts +8 -2
- package/Server/Utils/Telemetry.ts +109 -25
- package/Types/Code/CodeType.ts +1 -0
- package/Types/Database/PartialEntity.ts +14 -1
- package/Types/Date.ts +9 -1
- package/Types/Icon/IconProp.ts +2 -0
- package/Types/Permission.ts +39 -0
- package/UI/Components/ActionCard/ActionCard.tsx +66 -0
- package/UI/Components/Alerts/Alert.tsx +69 -60
- package/UI/Components/Card/Card.tsx +1 -0
- package/UI/Components/Charts/ChartGroup/ChartGroup.tsx +4 -17
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +1005 -0
- package/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.ts +3 -0
- package/UI/Components/Charts/ChartLibrary/Utils/ChartColors.ts +117 -0
- package/UI/Components/Charts/ChartLibrary/Utils/Cx.ts +8 -0
- package/UI/Components/Charts/ChartLibrary/Utils/GetYAxisDomain.ts +15 -0
- package/UI/Components/Charts/ChartLibrary/Utils/HasOnlyOneValueForKey.ts +19 -0
- package/UI/Components/Charts/ChartLibrary/Utils/UseWindowOnResize.ts +17 -0
- package/UI/Components/Charts/Line/LineChart.tsx +58 -225
- package/UI/Components/Charts/Types/ChartCurve.ts +7 -0
- package/UI/Components/Charts/Types/DataPoint.ts +7 -0
- package/UI/Components/Charts/Types/SeriesPoint.ts +7 -0
- package/UI/Components/Charts/Types/SeriesPoints.ts +6 -0
- package/UI/Components/Charts/Types/XAxis/XAxis.ts +21 -0
- package/UI/Components/Charts/Types/XAxis/XAxisMaxMin.ts +3 -0
- package/UI/Components/Charts/Types/XAxis/XAxisPrecision.ts +26 -0
- package/UI/Components/Charts/Types/XAxis/XAxisType.ts +6 -0
- package/UI/Components/Charts/Types/XValue.ts +3 -0
- package/UI/Components/Charts/Types/YAxis/YAxis.ts +22 -0
- package/UI/Components/Charts/Types/YAxis/YAxisMaxMin.ts +3 -0
- package/UI/Components/Charts/Types/YAxis/YAxisType.ts +5 -0
- package/UI/Components/Charts/Types/YValue.ts +3 -0
- package/UI/Components/Charts/Utils/DataPoint.ts +188 -0
- package/UI/Components/Charts/Utils/XAxis.ts +267 -0
- package/UI/Components/Detail/Detail.tsx +6 -1
- package/UI/Components/GanttChart/Row/Row.tsx +4 -2
- package/UI/Components/GanttChart/Row/RowLabel.tsx +7 -3
- package/UI/Components/Icon/Icon.tsx +16 -0
- package/UI/Components/LogsViewer/LogsViewer.tsx +1 -1
- package/UI/Components/Types/FieldType.ts +1 -0
- package/UI/Config.ts +2 -0
- package/UI/Utils/Telemetry.ts +7 -2
- package/Utils/Crypto.ts +11 -0
- package/build/dist/Models/AnalyticsModels/ExceptionInstance.js +445 -0
- package/build/dist/Models/AnalyticsModels/ExceptionInstance.js.map +1 -0
- package/build/dist/Models/AnalyticsModels/Index.js +2 -0
- package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Span.js +2 -2
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/TelemetryException.js +1010 -0
- package/build/dist/Models/DatabaseModels/TelemetryException.js.map +1 -0
- package/build/dist/Server/API/StatusAPI.js +52 -44
- package/build/dist/Server/API/StatusAPI.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +1 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724610006927-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.js +26 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724613666632-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1724659071843-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Queue.js +20 -1
- package/build/dist/Server/Infrastructure/Queue.js.map +1 -1
- package/build/dist/Server/Infrastructure/QueueWorker.js +2 -2
- package/build/dist/Server/Infrastructure/QueueWorker.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/ExceptionInstanceService.js +9 -0
- package/build/dist/Server/Services/ExceptionInstanceService.js.map +1 -0
- package/build/dist/Server/Services/Index.js +4 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/StatusPageDomainService.js +101 -53
- package/build/dist/Server/Services/StatusPageDomainService.js.map +1 -1
- package/build/dist/Server/Services/TelemetryExceptionService.js +9 -0
- package/build/dist/Server/Services/TelemetryExceptionService.js.map +1 -0
- package/build/dist/Server/Types/Database/Permissions/Index.js.map +1 -1
- package/build/dist/Server/Utils/Greenlock/Greenlock.js +234 -157
- package/build/dist/Server/Utils/Greenlock/Greenlock.js.map +1 -1
- package/build/dist/Server/Utils/Logger.js +5 -1
- package/build/dist/Server/Utils/Logger.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry.js +63 -22
- package/build/dist/Server/Utils/Telemetry.js.map +1 -1
- package/build/dist/Types/Code/CodeType.js +1 -0
- package/build/dist/Types/Code/CodeType.js.map +1 -1
- package/build/dist/Types/Database/PartialEntity.js +3 -0
- package/build/dist/Types/Database/PartialEntity.js.map +1 -1
- package/build/dist/Types/Date.js +7 -1
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/Icon/IconProp.js +2 -0
- package/build/dist/Types/Icon/IconProp.js.map +1 -1
- package/build/dist/Types/Permission.js +33 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/UI/Components/ActionCard/ActionCard.js +27 -0
- package/build/dist/UI/Components/ActionCard/ActionCard.js.map +1 -0
- package/build/dist/UI/Components/Alerts/Alert.js +36 -45
- package/build/dist/UI/Components/Alerts/Alert.js.map +1 -1
- package/build/dist/UI/Components/Card/Card.js +1 -1
- package/build/dist/UI/Components/Card/Card.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js +4 -9
- package/build/dist/UI/Components/Charts/ChartGroup/ChartGroup.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +388 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js +2 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Types/ChartDataPoint.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/ChartColors.js +88 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/ChartColors.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/Cx.js +7 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/Cx.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/GetYAxisDomain.js +7 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/GetYAxisDomain.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/HasOnlyOneValueForKey.js +14 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/HasOnlyOneValueForKey.js.map +1 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/UseWindowOnResize.js +14 -0
- package/build/dist/UI/Components/Charts/ChartLibrary/Utils/UseWindowOnResize.js.map +1 -0
- package/build/dist/UI/Components/Charts/Line/LineChart.js +30 -136
- package/build/dist/UI/Components/Charts/Line/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Types/ChartCurve.js +8 -0
- package/build/dist/UI/Components/Charts/Types/ChartCurve.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/DataPoint.js +2 -0
- package/build/dist/UI/Components/Charts/Types/DataPoint.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/SeriesPoint.js +2 -0
- package/build/dist/UI/Components/Charts/Types/SeriesPoint.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/SeriesPoints.js +2 -0
- package/build/dist/UI/Components/Charts/Types/SeriesPoints.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxis.js +8 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxis.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisMaxMin.js +2 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisMaxMin.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisPrecision.js +27 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisPrecision.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisType.js +7 -0
- package/build/dist/UI/Components/Charts/Types/XAxis/XAxisType.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/XValue.js +2 -0
- package/build/dist/UI/Components/Charts/Types/XValue.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxis.js +8 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxis.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxisMaxMin.js +2 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxisMaxMin.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxisType.js +6 -0
- package/build/dist/UI/Components/Charts/Types/YAxis/YAxisType.js.map +1 -0
- package/build/dist/UI/Components/Charts/Types/YValue.js +2 -0
- package/build/dist/UI/Components/Charts/Types/YValue.js.map +1 -0
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js +109 -0
- package/build/dist/UI/Components/Charts/Utils/DataPoint.js.map +1 -0
- package/build/dist/UI/Components/Charts/Utils/XAxis.js +241 -0
- package/build/dist/UI/Components/Charts/Utils/XAxis.js.map +1 -0
- package/build/dist/UI/Components/Detail/Detail.js +5 -1
- package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
- package/build/dist/UI/Components/GanttChart/Row/Row.js +2 -2
- package/build/dist/UI/Components/GanttChart/Row/Row.js.map +1 -1
- package/build/dist/UI/Components/GanttChart/Row/RowLabel.js +3 -3
- package/build/dist/UI/Components/GanttChart/Row/RowLabel.js.map +1 -1
- package/build/dist/UI/Components/Icon/Icon.js +6 -0
- package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/Types/FieldType.js +1 -0
- package/build/dist/UI/Components/Types/FieldType.js.map +1 -1
- package/build/dist/UI/Config.js +1 -0
- package/build/dist/UI/Config.js.map +1 -1
- package/build/dist/UI/Utils/Telemetry.js +6 -3
- package/build/dist/UI/Utils/Telemetry.js.map +1 -1
- package/build/dist/Utils/Crypto.js +10 -0
- package/build/dist/Utils/Crypto.js.map +1 -0
- package/package.json +15 -13
- package/UI/Components/Charts/Bar/Bar.tsx +0 -0
- package/UI/Components/Charts/Base/BaseChart.tsx +0 -0
- package/UI/Components/Charts/Tooltip/Tooltip.tsx +0 -84
- package/build/dist/UI/Components/Charts/Bar/Bar.js +0 -2
- package/build/dist/UI/Components/Charts/Bar/Bar.js.map +0 -1
- package/build/dist/UI/Components/Charts/Base/BaseChart.js +0 -2
- package/build/dist/UI/Components/Charts/Base/BaseChart.js.map +0 -1
- package/build/dist/UI/Components/Charts/Tooltip/Tooltip.js +0 -34
- package/build/dist/UI/Components/Charts/Tooltip/Tooltip.js.map +0 -1
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import OpenTelemetryAPI, {
|
|
1
|
+
import OpenTelemetryAPI, {
|
|
2
|
+
// diag,
|
|
3
|
+
// DiagConsoleLogger,
|
|
4
|
+
// DiagLogLevel,
|
|
5
|
+
Meter,
|
|
6
|
+
} from "@opentelemetry/api";
|
|
2
7
|
import { Logger, logs } from "@opentelemetry/api-logs";
|
|
3
8
|
import {
|
|
4
9
|
Counter,
|
|
@@ -13,7 +18,10 @@ import { CompressionAlgorithm } from "@opentelemetry/otlp-exporter-base";
|
|
|
13
18
|
import { Resource } from "@opentelemetry/resources";
|
|
14
19
|
import {
|
|
15
20
|
BatchLogRecordProcessor,
|
|
21
|
+
ConsoleLogRecordExporter,
|
|
16
22
|
LoggerProvider,
|
|
23
|
+
LogRecordProcessor,
|
|
24
|
+
SimpleLogRecordProcessor,
|
|
17
25
|
} from "@opentelemetry/sdk-logs";
|
|
18
26
|
import {
|
|
19
27
|
MeterProvider,
|
|
@@ -21,18 +29,37 @@ import {
|
|
|
21
29
|
} from "@opentelemetry/sdk-metrics";
|
|
22
30
|
import * as opentelemetry from "@opentelemetry/sdk-node";
|
|
23
31
|
import { SpanExporter } from "@opentelemetry/sdk-trace-node";
|
|
24
|
-
import {
|
|
32
|
+
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
|
|
25
33
|
import URL from "Common/Types/API/URL";
|
|
26
34
|
import Dictionary from "Common/Types/Dictionary";
|
|
35
|
+
import { DisableTelemetry } from "../EnvironmentConfig";
|
|
36
|
+
import logger from "./Logger";
|
|
27
37
|
|
|
28
38
|
// Enable this line to see debug logs
|
|
29
39
|
// diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
|
|
30
40
|
|
|
41
|
+
export type Span = opentelemetry.api.Span;
|
|
42
|
+
export type SpanStatus = opentelemetry.api.SpanStatus;
|
|
43
|
+
export type SpanException = opentelemetry.api.Exception;
|
|
44
|
+
export type SpanOptions = opentelemetry.api.SpanOptions;
|
|
45
|
+
export type TelemetryLogger = Logger;
|
|
46
|
+
export type TelemetryAttributes = opentelemetry.api.Attributes;
|
|
47
|
+
export type TelemetryCounter = Counter<opentelemetry.api.Attributes>;
|
|
48
|
+
|
|
49
|
+
export enum SpanStatusCode {
|
|
50
|
+
UNSET = 0,
|
|
51
|
+
OK = 1,
|
|
52
|
+
ERROR = 2,
|
|
53
|
+
}
|
|
54
|
+
|
|
31
55
|
export default class Telemetry {
|
|
32
56
|
public static sdk: opentelemetry.NodeSDK | null = null;
|
|
33
57
|
public static logger: Logger | null = null;
|
|
34
58
|
public static meter: Meter | null = null;
|
|
35
59
|
public static meterProvider: MeterProvider | null = null;
|
|
60
|
+
public static loggerProvider: LoggerProvider | null = null;
|
|
61
|
+
public static metricReader: PeriodicExportingMetricReader | undefined;
|
|
62
|
+
public static serviceName: string | null = null;
|
|
36
63
|
|
|
37
64
|
public static getHeaders(): Dictionary<string> {
|
|
38
65
|
if (!process.env["OPENTELEMETRY_EXPORTER_OTLP_HEADERS"]) {
|
|
@@ -96,11 +123,19 @@ export default class Telemetry {
|
|
|
96
123
|
|
|
97
124
|
public static getResource(data: { serviceName: string }): Resource {
|
|
98
125
|
return new Resource({
|
|
99
|
-
[
|
|
126
|
+
[ATTR_SERVICE_NAME]: data.serviceName,
|
|
100
127
|
});
|
|
101
128
|
}
|
|
102
129
|
|
|
103
|
-
public static init(data: {
|
|
130
|
+
public static init(data: {
|
|
131
|
+
serviceName: string;
|
|
132
|
+
}): opentelemetry.NodeSDK | null {
|
|
133
|
+
this.serviceName = data.serviceName;
|
|
134
|
+
|
|
135
|
+
if (DisableTelemetry) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
|
|
104
139
|
if (!this.sdk) {
|
|
105
140
|
const headers: Dictionary<string> = this.getHeaders();
|
|
106
141
|
|
|
@@ -108,8 +143,6 @@ export default class Telemetry {
|
|
|
108
143
|
|
|
109
144
|
let traceExporter: SpanExporter | undefined = undefined;
|
|
110
145
|
|
|
111
|
-
let metricReader: PeriodicExportingMetricReader | undefined = undefined;
|
|
112
|
-
|
|
113
146
|
if (this.getOltpTracesEndpoint() && hasHeaders) {
|
|
114
147
|
traceExporter = new OTLPTraceExporter({
|
|
115
148
|
url: this.getOltpTracesEndpoint()!.toString(),
|
|
@@ -119,7 +152,7 @@ export default class Telemetry {
|
|
|
119
152
|
}
|
|
120
153
|
|
|
121
154
|
if (this.getOltpMetricsEndpoint() && hasHeaders) {
|
|
122
|
-
metricReader = new PeriodicExportingMetricReader({
|
|
155
|
+
this.metricReader = new PeriodicExportingMetricReader({
|
|
123
156
|
exporter: new OTLPMetricExporter({
|
|
124
157
|
url: this.getOltpMetricsEndpoint()!.toString(),
|
|
125
158
|
headers: headers,
|
|
@@ -128,12 +161,16 @@ export default class Telemetry {
|
|
|
128
161
|
});
|
|
129
162
|
}
|
|
130
163
|
|
|
131
|
-
|
|
164
|
+
this.loggerProvider = new LoggerProvider({
|
|
132
165
|
resource: this.getResource({
|
|
133
166
|
serviceName: data.serviceName,
|
|
134
167
|
}),
|
|
135
168
|
});
|
|
136
169
|
|
|
170
|
+
let logRecordProcessor: LogRecordProcessor = new SimpleLogRecordProcessor(
|
|
171
|
+
new ConsoleLogRecordExporter(),
|
|
172
|
+
);
|
|
173
|
+
|
|
137
174
|
if (this.getOltpLogsEndpoint() && hasHeaders) {
|
|
138
175
|
const logExporter: OTLPLogExporter = new OTLPLogExporter({
|
|
139
176
|
url: this.getOltpLogsEndpoint()!.toString(),
|
|
@@ -141,39 +178,43 @@ export default class Telemetry {
|
|
|
141
178
|
compression: CompressionAlgorithm.GZIP,
|
|
142
179
|
});
|
|
143
180
|
|
|
144
|
-
|
|
145
|
-
new BatchLogRecordProcessor(logExporter),
|
|
146
|
-
);
|
|
181
|
+
logRecordProcessor = new BatchLogRecordProcessor(logExporter);
|
|
147
182
|
}
|
|
148
183
|
|
|
149
|
-
|
|
184
|
+
this.loggerProvider.addLogRecordProcessor(logRecordProcessor);
|
|
185
|
+
|
|
186
|
+
logs.setGlobalLoggerProvider(this.loggerProvider);
|
|
150
187
|
|
|
151
188
|
const nodeSdkConfiguration: Partial<opentelemetry.NodeSDKConfiguration> =
|
|
152
189
|
{
|
|
153
190
|
idGenerator: new AWSXRayIdGenerator(),
|
|
154
|
-
instrumentations:
|
|
155
|
-
? [
|
|
156
|
-
// Add instrumentations here
|
|
157
|
-
]
|
|
158
|
-
: [],
|
|
191
|
+
instrumentations: [],
|
|
159
192
|
resource: this.getResource({
|
|
160
193
|
serviceName: data.serviceName,
|
|
161
194
|
}),
|
|
162
|
-
|
|
195
|
+
autoDetectResources: true,
|
|
163
196
|
};
|
|
164
197
|
|
|
165
198
|
if (traceExporter) {
|
|
166
199
|
nodeSdkConfiguration.traceExporter = traceExporter;
|
|
167
200
|
}
|
|
168
201
|
|
|
169
|
-
|
|
170
|
-
|
|
202
|
+
// We will skip this becasue we're attachng this metric reader to the meter provider later.
|
|
203
|
+
// if (this.metricReader) {
|
|
204
|
+
// nodeSdkConfiguration.metricReader = this.metricReader;
|
|
205
|
+
// }
|
|
206
|
+
|
|
207
|
+
if (logRecordProcessor) {
|
|
208
|
+
nodeSdkConfiguration.logRecordProcessor = logRecordProcessor;
|
|
171
209
|
}
|
|
172
210
|
|
|
173
211
|
const sdk: opentelemetry.NodeSDK = new opentelemetry.NodeSDK(
|
|
174
212
|
nodeSdkConfiguration,
|
|
175
213
|
);
|
|
176
214
|
|
|
215
|
+
this.getMeterProvider();
|
|
216
|
+
this.getMeter();
|
|
217
|
+
|
|
177
218
|
process.on("SIGTERM", () => {
|
|
178
219
|
sdk.shutdown().finally(() => {
|
|
179
220
|
return process.exit(0);
|
|
@@ -188,17 +229,23 @@ export default class Telemetry {
|
|
|
188
229
|
return this.sdk;
|
|
189
230
|
}
|
|
190
231
|
|
|
191
|
-
public static getLogger(): Logger {
|
|
192
|
-
if (!this.
|
|
193
|
-
|
|
232
|
+
public static getLogger(): Logger | null {
|
|
233
|
+
if (!this.loggerProvider) {
|
|
234
|
+
return null;
|
|
194
235
|
}
|
|
195
236
|
|
|
196
|
-
return this.
|
|
237
|
+
return this.loggerProvider.getLogger("default");
|
|
197
238
|
}
|
|
198
239
|
|
|
199
240
|
public static getMeterProvider(): MeterProvider {
|
|
200
241
|
if (!this.meterProvider) {
|
|
201
|
-
this.meterProvider = new MeterProvider(
|
|
242
|
+
this.meterProvider = new MeterProvider({
|
|
243
|
+
resource: this.getResource({
|
|
244
|
+
serviceName: this.serviceName || "default",
|
|
245
|
+
}),
|
|
246
|
+
readers: this.metricReader ? [this.metricReader] : [],
|
|
247
|
+
});
|
|
248
|
+
|
|
202
249
|
OpenTelemetryAPI.metrics.setGlobalMeterProvider(this.meterProvider);
|
|
203
250
|
}
|
|
204
251
|
|
|
@@ -279,4 +326,41 @@ export default class Telemetry {
|
|
|
279
326
|
|
|
280
327
|
return histogram;
|
|
281
328
|
}
|
|
329
|
+
|
|
330
|
+
public static getTracer(): opentelemetry.api.Tracer {
|
|
331
|
+
const tracer: opentelemetry.api.Tracer =
|
|
332
|
+
OpenTelemetryAPI.trace.getTracer("default");
|
|
333
|
+
return tracer;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
public static startActiveSpan<T>(data: {
|
|
337
|
+
name: string;
|
|
338
|
+
options?: SpanOptions | undefined;
|
|
339
|
+
fn: (span: Span) => T;
|
|
340
|
+
}): T {
|
|
341
|
+
const { name } = data;
|
|
342
|
+
|
|
343
|
+
return this.getTracer().startActiveSpan(name, data.options || {}, data.fn);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
public static recordExceptionMarkSpanAsErrorAndEndSpan(data: {
|
|
347
|
+
span: Span;
|
|
348
|
+
exception: unknown;
|
|
349
|
+
}): void {
|
|
350
|
+
const { span, exception } = data;
|
|
351
|
+
|
|
352
|
+
// log the exception as well
|
|
353
|
+
logger.error(exception);
|
|
354
|
+
|
|
355
|
+
span.recordException(exception as SpanException);
|
|
356
|
+
span.setStatus({
|
|
357
|
+
code: SpanStatusCode.ERROR,
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
this.endSpan(span);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
public static endSpan(span: Span): void {
|
|
364
|
+
span.end();
|
|
365
|
+
}
|
|
282
366
|
}
|
package/Types/Code/CodeType.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Make all properties in T optional. Deep version.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
type QueryDeepPartialEntity<T> = {
|
|
6
|
+
[P in keyof T]?:
|
|
7
|
+
| (T[P] extends Array<infer U>
|
|
8
|
+
? Array<QueryDeepPartialEntity<U>>
|
|
9
|
+
: T[P] extends ReadonlyArray<infer U>
|
|
10
|
+
? ReadonlyArray<QueryDeepPartialEntity<U>>
|
|
11
|
+
: QueryDeepPartialEntity<T[P]>)
|
|
12
|
+
| (() => string)
|
|
13
|
+
| null;
|
|
14
|
+
};
|
|
2
15
|
|
|
3
16
|
export default QueryDeepPartialEntity;
|
package/Types/Date.ts
CHANGED
|
@@ -9,10 +9,18 @@ import Timezone from "./Timezone";
|
|
|
9
9
|
export const Moment: typeof moment = moment;
|
|
10
10
|
|
|
11
11
|
export default class OneUptimeDate {
|
|
12
|
-
public
|
|
12
|
+
public static convertMinutesToMilliseconds(minutes: number): number {
|
|
13
|
+
return minutes * 60 * 1000;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public static getNanoSecondsFromSeconds(seconds: number): number {
|
|
13
17
|
return seconds * 1000 * 1000 * 1000;
|
|
14
18
|
}
|
|
15
19
|
|
|
20
|
+
public static now(): Date {
|
|
21
|
+
return this.getCurrentDate();
|
|
22
|
+
}
|
|
23
|
+
|
|
16
24
|
public static getDateFromYYYYMMDD(
|
|
17
25
|
year: string,
|
|
18
26
|
month: string,
|
package/Types/Icon/IconProp.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
enum IconProp {
|
|
2
2
|
Equals = "Equals",
|
|
3
|
+
Archive = "Archive",
|
|
3
4
|
File = "File",
|
|
4
5
|
Automation = "Automation",
|
|
5
6
|
Workflow = "Workflow",
|
|
@@ -15,6 +16,7 @@ enum IconProp {
|
|
|
15
16
|
CursorArrowRays = "CursorArrowRays",
|
|
16
17
|
ArrowUpDown = "ArrowUpDown",
|
|
17
18
|
Cube = "Cube",
|
|
19
|
+
Unarchive = "Unarchive",
|
|
18
20
|
Swatch = "Swatch",
|
|
19
21
|
Squares = "Squares",
|
|
20
22
|
RectangleStack = "RectangleStack",
|
package/Types/Permission.ts
CHANGED
|
@@ -53,6 +53,12 @@ enum Permission {
|
|
|
53
53
|
EditTelemetryServiceLog = "EditTelemetryServiceLog",
|
|
54
54
|
ReadTelemetryServiceLog = "ReadTelemetryServiceLog",
|
|
55
55
|
|
|
56
|
+
// Exceptions
|
|
57
|
+
CreateTelemetryException = "CreateTelemetryException",
|
|
58
|
+
DeleteTelemetryException = "DeleteTelemetryException",
|
|
59
|
+
EditTelemetryException = "EditTelemetryException",
|
|
60
|
+
ReadTelemetryException = "ReadTelemetryException",
|
|
61
|
+
|
|
56
62
|
// Spans
|
|
57
63
|
CreateTelemetryServiceTraces = "CreateTelemetryServiceTraces",
|
|
58
64
|
DeleteTelemetryServiceTraces = "DeleteTelemetryServiceTraces",
|
|
@@ -2445,6 +2451,39 @@ export class PermissionHelper {
|
|
|
2445
2451
|
isAccessControlPermission: false,
|
|
2446
2452
|
},
|
|
2447
2453
|
|
|
2454
|
+
{
|
|
2455
|
+
permission: Permission.CreateTelemetryException,
|
|
2456
|
+
title: "Create Telemetry Service Exception",
|
|
2457
|
+
description:
|
|
2458
|
+
"This permission can create Telemetry Service Exception this project.",
|
|
2459
|
+
isAssignableToTenant: true,
|
|
2460
|
+
isAccessControlPermission: false,
|
|
2461
|
+
},
|
|
2462
|
+
{
|
|
2463
|
+
permission: Permission.DeleteTelemetryException,
|
|
2464
|
+
title: "Delete Telemetry Service Exception",
|
|
2465
|
+
description:
|
|
2466
|
+
"This permission can delete Telemetry Service Exception of this project.",
|
|
2467
|
+
isAssignableToTenant: true,
|
|
2468
|
+
isAccessControlPermission: false,
|
|
2469
|
+
},
|
|
2470
|
+
{
|
|
2471
|
+
permission: Permission.EditTelemetryException,
|
|
2472
|
+
title: "Edit Telemetry Service Exception",
|
|
2473
|
+
description:
|
|
2474
|
+
"This permission can edit Telemetry Service Exception of this project.",
|
|
2475
|
+
isAssignableToTenant: true,
|
|
2476
|
+
isAccessControlPermission: false,
|
|
2477
|
+
},
|
|
2478
|
+
{
|
|
2479
|
+
permission: Permission.ReadTelemetryException,
|
|
2480
|
+
title: "Read Telemetry Service Exception",
|
|
2481
|
+
description:
|
|
2482
|
+
"This permission can read Telemetry Service Exception of this project.",
|
|
2483
|
+
isAssignableToTenant: true,
|
|
2484
|
+
isAccessControlPermission: false,
|
|
2485
|
+
},
|
|
2486
|
+
|
|
2448
2487
|
{
|
|
2449
2488
|
permission: Permission.CreateCopilotCodeRepository,
|
|
2450
2489
|
title: "Create Code Repository",
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ButtonStyleType } from "../Button/Button";
|
|
2
|
+
import Card from "../Card/Card";
|
|
3
|
+
import ConfirmModal from "../Modal/ConfirmModal";
|
|
4
|
+
import IconProp from "Common/Types/Icon/IconProp";
|
|
5
|
+
import React, { ReactElement, useState } from "react";
|
|
6
|
+
|
|
7
|
+
export interface ConfirmAction {
|
|
8
|
+
actionName: string;
|
|
9
|
+
actionIcon: IconProp;
|
|
10
|
+
onConfirmAction: () => void;
|
|
11
|
+
actionButtonStyle?: ButtonStyleType;
|
|
12
|
+
isLoading?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ComponentProps {
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
actions: Array<ConfirmAction>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const ActionCard: (props: ComponentProps) => ReactElement = (
|
|
22
|
+
props: ComponentProps,
|
|
23
|
+
): ReactElement => {
|
|
24
|
+
const [currentAction, setCurrentAction] = useState<ConfirmAction | undefined>(
|
|
25
|
+
undefined,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
<Card
|
|
31
|
+
title={props.title}
|
|
32
|
+
description={props.description}
|
|
33
|
+
buttons={props.actions.map((action: ConfirmAction) => {
|
|
34
|
+
return {
|
|
35
|
+
title: action.actionName,
|
|
36
|
+
buttonStyle: action.actionButtonStyle || ButtonStyleType.NORMAL,
|
|
37
|
+
onClick: () => {
|
|
38
|
+
setCurrentAction(action);
|
|
39
|
+
},
|
|
40
|
+
icon: action.actionIcon,
|
|
41
|
+
isLoading: action.isLoading,
|
|
42
|
+
};
|
|
43
|
+
})}
|
|
44
|
+
/>
|
|
45
|
+
|
|
46
|
+
{currentAction ? (
|
|
47
|
+
<ConfirmModal
|
|
48
|
+
description={`Are you sure you want to ${currentAction.actionName}?`}
|
|
49
|
+
title={`Confirm ${currentAction.actionName}`}
|
|
50
|
+
onSubmit={() => {
|
|
51
|
+
currentAction.onConfirmAction();
|
|
52
|
+
setCurrentAction(undefined);
|
|
53
|
+
}}
|
|
54
|
+
submitButtonText={`Confirm`}
|
|
55
|
+
onClose={() => {
|
|
56
|
+
setCurrentAction(undefined);
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
) : (
|
|
60
|
+
<></>
|
|
61
|
+
)}
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export default ActionCard;
|
|
@@ -16,13 +16,13 @@ export enum AlertSize {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface ComponentProps {
|
|
19
|
-
strongTitle?:
|
|
20
|
-
title?:
|
|
21
|
-
onClose?:
|
|
22
|
-
type?:
|
|
23
|
-
onClick?: (
|
|
19
|
+
strongTitle?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
onClose?: () => void;
|
|
22
|
+
type?: AlertType;
|
|
23
|
+
onClick?: () => void;
|
|
24
24
|
doNotShowIcon?: boolean | undefined;
|
|
25
|
-
dataTestId?: string;
|
|
25
|
+
dataTestId?: string | undefined;
|
|
26
26
|
textClassName?: string | undefined;
|
|
27
27
|
className?: string | undefined;
|
|
28
28
|
color?: Color | undefined;
|
|
@@ -33,93 +33,102 @@ export interface ComponentProps {
|
|
|
33
33
|
const Alert: FunctionComponent<ComponentProps> = (
|
|
34
34
|
props: ComponentProps,
|
|
35
35
|
): ReactElement => {
|
|
36
|
-
|
|
36
|
+
const type: AlertType = props.type || AlertType.INFO;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const typeClassNames: {
|
|
39
|
+
[key in AlertType]: {
|
|
40
|
+
text: string;
|
|
41
|
+
bg: string;
|
|
42
|
+
hover: string;
|
|
43
|
+
};
|
|
44
|
+
} = {
|
|
45
|
+
[AlertType.DANGER]: {
|
|
46
|
+
text: "text-red-200",
|
|
47
|
+
bg: "bg-red-700",
|
|
48
|
+
hover: "hover:bg-red-600",
|
|
49
|
+
},
|
|
50
|
+
[AlertType.INFO]: {
|
|
51
|
+
text: "text-gray-200",
|
|
52
|
+
bg: "bg-gray-700",
|
|
53
|
+
hover: "hover:bg-gray-600",
|
|
54
|
+
},
|
|
55
|
+
[AlertType.WARNING]: {
|
|
56
|
+
text: "text-yellow-200",
|
|
57
|
+
bg: "bg-gray-700",
|
|
58
|
+
hover: "hover:bg-yellow-600",
|
|
59
|
+
},
|
|
60
|
+
[AlertType.SUCCESS]: {
|
|
61
|
+
text: "text-green-200",
|
|
62
|
+
bg: "bg-gray-700",
|
|
63
|
+
hover: "hover:bg-green-600",
|
|
64
|
+
},
|
|
65
|
+
};
|
|
41
66
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
bgClassName = "bg-red";
|
|
48
|
-
} else if (AlertType.INFO === type) {
|
|
49
|
-
className = "text-gray";
|
|
50
|
-
bgClassName = "bg-gray";
|
|
51
|
-
} else if (AlertType.WARNING === type) {
|
|
52
|
-
className = "text-yellow";
|
|
53
|
-
bgClassName = "bg-gray";
|
|
54
|
-
} else if (AlertType.SUCCESS === type) {
|
|
55
|
-
className = "text-green";
|
|
56
|
-
bgClassName = "bg-gray";
|
|
57
|
-
}
|
|
67
|
+
const {
|
|
68
|
+
text: textClassName,
|
|
69
|
+
bg: bgClassName,
|
|
70
|
+
hover: hoverClassName,
|
|
71
|
+
} = typeClassNames[type];
|
|
58
72
|
|
|
59
73
|
return (
|
|
60
74
|
<div
|
|
61
75
|
id={props.id}
|
|
62
|
-
className={`rounded-md ${bgClassName}
|
|
76
|
+
className={`alert rounded-md ${bgClassName} p-4 ${props.className}`}
|
|
63
77
|
data-testid={props.dataTestId}
|
|
64
|
-
onClick={
|
|
65
|
-
props.onClick && props.onClick();
|
|
66
|
-
}}
|
|
78
|
+
onClick={props.onClick}
|
|
67
79
|
role="alert"
|
|
68
|
-
style={
|
|
69
|
-
props.color
|
|
70
|
-
? {
|
|
71
|
-
backgroundColor: props.color?.toString(),
|
|
72
|
-
}
|
|
73
|
-
: {}
|
|
74
|
-
}
|
|
80
|
+
style={props.color ? { backgroundColor: props.color.toString() } : {}}
|
|
75
81
|
>
|
|
76
|
-
<div className="flex
|
|
82
|
+
<div className="alert-content flex">
|
|
77
83
|
{!props.doNotShowIcon && (
|
|
78
|
-
<div className="flex-shrink-0">
|
|
79
|
-
{AlertType.DANGER
|
|
80
|
-
<Icon
|
|
84
|
+
<div className="alert-icon flex-shrink-0">
|
|
85
|
+
{type === AlertType.DANGER && (
|
|
86
|
+
<Icon
|
|
87
|
+
icon={IconProp.Alert}
|
|
88
|
+
className={`h-5 w-5 ${textClassName}`}
|
|
89
|
+
/>
|
|
81
90
|
)}
|
|
82
|
-
{AlertType.WARNING
|
|
83
|
-
<Icon
|
|
91
|
+
{type === AlertType.WARNING && (
|
|
92
|
+
<Icon
|
|
93
|
+
icon={IconProp.Alert}
|
|
94
|
+
className={`h-5 w-5 ${textClassName}`}
|
|
95
|
+
/>
|
|
84
96
|
)}
|
|
85
|
-
{AlertType.SUCCESS
|
|
97
|
+
{type === AlertType.SUCCESS && (
|
|
86
98
|
<Icon
|
|
87
99
|
icon={IconProp.CheckCircle}
|
|
88
|
-
className=
|
|
100
|
+
className={`h-5 w-5 ${textClassName}`}
|
|
89
101
|
/>
|
|
90
102
|
)}
|
|
91
|
-
{AlertType.INFO
|
|
92
|
-
<Icon
|
|
103
|
+
{type === AlertType.INFO && (
|
|
104
|
+
<Icon
|
|
105
|
+
icon={IconProp.Info}
|
|
106
|
+
className={`h-5 w-5 ${textClassName}`}
|
|
107
|
+
/>
|
|
93
108
|
)}
|
|
94
109
|
</div>
|
|
95
110
|
)}
|
|
96
111
|
<div
|
|
97
|
-
className={`ml-3 mr-3 flex-1 md:flex md:justify-between ${props.
|
|
112
|
+
className={`alert-text ml-3 mr-3 flex-1 md:flex md:justify-between ${props.textClassName}`}
|
|
98
113
|
>
|
|
99
114
|
<div
|
|
100
|
-
className={
|
|
101
|
-
props.textClassName ||
|
|
102
|
-
`text-sm flex justify-between ${className}-200`
|
|
103
|
-
}
|
|
115
|
+
className={`alert-message text-sm flex justify-between ${textClassName}`}
|
|
104
116
|
>
|
|
105
117
|
<div>
|
|
106
118
|
<span className="font-medium">
|
|
107
119
|
{props.strongTitle}{" "}
|
|
108
|
-
{props.title && props.strongTitle ? "-" : ""}
|
|
120
|
+
{props.title && props.strongTitle ? "-" : ""}
|
|
109
121
|
</span>
|
|
110
122
|
{props.title}
|
|
111
123
|
</div>
|
|
112
124
|
{props.textOnRight && <div>{props.textOnRight}</div>}
|
|
113
125
|
</div>
|
|
114
|
-
|
|
115
126
|
{props.onClose && (
|
|
116
|
-
<p className="mt-3 text-sm md:mt-0 md:ml-6">
|
|
127
|
+
<p className="alert-close mt-3 text-sm md:mt-0 md:ml-6">
|
|
117
128
|
<button
|
|
118
|
-
onClick={
|
|
119
|
-
|
|
120
|
-
}}
|
|
121
|
-
role={"alert-close-button"}
|
|
122
|
-
className={`whitespace-nowrap font-medium ${className}-200 hover:${className}-50`}
|
|
129
|
+
onClick={props.onClose}
|
|
130
|
+
role="alert-close-button"
|
|
131
|
+
className={`whitespace-nowrap font-medium ${textClassName} hover:${hoverClassName}`}
|
|
123
132
|
>
|
|
124
133
|
Close
|
|
125
134
|
<span aria-hidden="true"> →</span>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import Text from "../../../../Types/Text";
|
|
1
2
|
import LineChart, { ComponentProps as LineChartProps } from "../Line/LineChart";
|
|
2
|
-
import React, { FunctionComponent, ReactElement
|
|
3
|
+
import React, { FunctionComponent, ReactElement } from "react";
|
|
3
4
|
|
|
4
5
|
export enum ChartType {
|
|
5
6
|
LINE = "line",
|
|
@@ -13,7 +14,6 @@ export interface Chart {
|
|
|
13
14
|
description?: string | undefined;
|
|
14
15
|
type: ChartType;
|
|
15
16
|
props: LineChartProps;
|
|
16
|
-
sync: boolean;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface ComponentProps {
|
|
@@ -23,9 +23,7 @@ export interface ComponentProps {
|
|
|
23
23
|
const ChartGroup: FunctionComponent<ComponentProps> = (
|
|
24
24
|
props: ComponentProps,
|
|
25
25
|
): ReactElement => {
|
|
26
|
-
const
|
|
27
|
-
number | string | Date | undefined
|
|
28
|
-
>(undefined);
|
|
26
|
+
const syncId: string = Text.generateRandomText(10);
|
|
29
27
|
|
|
30
28
|
return (
|
|
31
29
|
<div className="lg:grid grid-cols-1 gap-5">
|
|
@@ -49,18 +47,7 @@ const ChartGroup: FunctionComponent<ComponentProps> = (
|
|
|
49
47
|
{chart.description}
|
|
50
48
|
</p>
|
|
51
49
|
)}
|
|
52
|
-
<LineChart
|
|
53
|
-
key={index}
|
|
54
|
-
{...chart.props}
|
|
55
|
-
xAxisMarker={{
|
|
56
|
-
value: chart.sync ? syncValue : undefined,
|
|
57
|
-
}}
|
|
58
|
-
onHoverXAxis={(value: string | number | Date) => {
|
|
59
|
-
if (chart.sync) {
|
|
60
|
-
setSyncValue(value);
|
|
61
|
-
}
|
|
62
|
-
}}
|
|
63
|
-
/>
|
|
50
|
+
<LineChart key={index} {...chart.props} syncId={syncId} />
|
|
64
51
|
</div>
|
|
65
52
|
);
|
|
66
53
|
default:
|