mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: Enhance type definitions and improve code clarity across multiple components and files
This commit is contained in:
@@ -91,7 +91,9 @@ const FlameGraph: FunctionComponent<FlameGraphProps> = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getServiceInfo = (span: Span): { color: Color; name: string } => {
|
const getServiceInfo: (span: Span) => { color: Color; name: string } = (
|
||||||
|
span: Span,
|
||||||
|
): { color: Color; name: string } => {
|
||||||
const service: Service | undefined = telemetryServices.find(
|
const service: Service | undefined = telemetryServices.find(
|
||||||
(s: Service) => {
|
(s: Service) => {
|
||||||
return s._id?.toString() === span.serviceId?.toString();
|
return s._id?.toString() === span.serviceId?.toString();
|
||||||
@@ -103,7 +105,10 @@ const FlameGraph: FunctionComponent<FlameGraphProps> = (
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildNode = (span: Span, depth: number): FlameGraphNode => {
|
const buildNode: (span: Span, depth: number) => FlameGraphNode = (
|
||||||
|
span: Span,
|
||||||
|
depth: number,
|
||||||
|
): FlameGraphNode => {
|
||||||
const children: Span[] = childrenMap.get(span.spanId!) || [];
|
const children: Span[] = childrenMap.get(span.spanId!) || [];
|
||||||
const selfTime: SpanSelfTime | undefined = selfTimes.get(span.spanId!);
|
const selfTime: SpanSelfTime | undefined = selfTimes.get(span.spanId!);
|
||||||
const serviceInfo: { color: Color; name: string } = getServiceInfo(span);
|
const serviceInfo: { color: Color; name: string } = getServiceInfo(span);
|
||||||
@@ -156,7 +161,9 @@ const FlameGraph: FunctionComponent<FlameGraphProps> = (
|
|||||||
// Find max depth for height calculation
|
// Find max depth for height calculation
|
||||||
const maxDepth: number = React.useMemo(() => {
|
const maxDepth: number = React.useMemo(() => {
|
||||||
let max: number = 0;
|
let max: number = 0;
|
||||||
const traverse = (node: FlameGraphNode): void => {
|
const traverse: (node: FlameGraphNode) => void = (
|
||||||
|
node: FlameGraphNode,
|
||||||
|
): void => {
|
||||||
if (node.depth > max) {
|
if (node.depth > max) {
|
||||||
max = node.depth;
|
max = node.depth;
|
||||||
}
|
}
|
||||||
@@ -176,7 +183,9 @@ const FlameGraph: FunctionComponent<FlameGraphProps> = (
|
|||||||
return { viewStart: traceStart, viewEnd: traceEnd };
|
return { viewStart: traceStart, viewEnd: traceEnd };
|
||||||
}
|
}
|
||||||
|
|
||||||
const findNode = (nodes: FlameGraphNode[]): FlameGraphNode | null => {
|
const findNode: (nodes: FlameGraphNode[]) => FlameGraphNode | null = (
|
||||||
|
nodes: FlameGraphNode[],
|
||||||
|
): FlameGraphNode | null => {
|
||||||
for (const node of nodes) {
|
for (const node of nodes) {
|
||||||
if (node.span.spanId === focusedSpanId) {
|
if (node.span.spanId === focusedSpanId) {
|
||||||
return node;
|
return node;
|
||||||
@@ -211,7 +220,9 @@ const FlameGraph: FunctionComponent<FlameGraphProps> = (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderNode = (node: FlameGraphNode): ReactElement | null => {
|
const renderNode: (node: FlameGraphNode) => ReactElement | null = (
|
||||||
|
node: FlameGraphNode,
|
||||||
|
): ReactElement | null => {
|
||||||
// Calculate position relative to view
|
// Calculate position relative to view
|
||||||
const nodeStart: number = Math.max(node.startTimeUnixNano, viewStart);
|
const nodeStart: number = Math.max(node.startTimeUnixNano, viewStart);
|
||||||
const nodeEnd: number = Math.min(node.endTimeUnixNano, viewEnd);
|
const nodeEnd: number = Math.min(node.endTimeUnixNano, viewEnd);
|
||||||
@@ -299,7 +310,9 @@ const FlameGraph: FunctionComponent<FlameGraphProps> = (
|
|||||||
if (!hoveredSpanId) {
|
if (!hoveredSpanId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const findNode = (nodes: FlameGraphNode[]): FlameGraphNode | null => {
|
const findNode: (nodes: FlameGraphNode[]) => FlameGraphNode | null = (
|
||||||
|
nodes: FlameGraphNode[],
|
||||||
|
): FlameGraphNode | null => {
|
||||||
for (const node of nodes) {
|
for (const node of nodes) {
|
||||||
if (node.span.spanId === hoveredSpanId) {
|
if (node.span.spanId === hoveredSpanId) {
|
||||||
return node;
|
return node;
|
||||||
|
|||||||
@@ -125,7 +125,8 @@ const TraceServiceMap: FunctionComponent<TraceServiceMapProps> = (
|
|||||||
return maxEnd - minStart;
|
return maxEnd - minStart;
|
||||||
}, [spans]);
|
}, [spans]);
|
||||||
|
|
||||||
const divisibilityFactor = SpanUtil.getDivisibilityFactor(traceDuration);
|
const divisibilityFactor: number =
|
||||||
|
SpanUtil.getDivisibilityFactor(traceDuration);
|
||||||
|
|
||||||
if (nodes.length === 0) {
|
if (nodes.length === 0) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -86,22 +86,24 @@ const KubernetesClusterEvents: FunctionComponent<
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Helper to extract a string value from OTLP kvlistValue
|
// Helper to extract a string value from OTLP kvlistValue
|
||||||
const getKvValue = (
|
const getKvValue: (
|
||||||
kvList: JSONObject | undefined,
|
kvList: JSONObject | undefined,
|
||||||
key: string,
|
key: string,
|
||||||
): string => {
|
) => string = (kvList: JSONObject | undefined, key: string): string => {
|
||||||
if (!kvList) {
|
if (!kvList) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
const values = (kvList as JSONObject)["values"] as
|
const values: Array<JSONObject> | undefined = (kvList as JSONObject)[
|
||||||
| Array<JSONObject>
|
"values"
|
||||||
| undefined;
|
] as Array<JSONObject> | undefined;
|
||||||
if (!values) {
|
if (!values) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
for (const entry of values) {
|
for (const entry of values) {
|
||||||
if (entry["key"] === key) {
|
if (entry["key"] === key) {
|
||||||
const val = entry["value"] as JSONObject | undefined;
|
const val: JSONObject | undefined = entry["value"] as
|
||||||
|
| JSONObject
|
||||||
|
| undefined;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -121,7 +123,11 @@ const KubernetesClusterEvents: FunctionComponent<
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Helper to get nested kvlist value
|
// Helper to get nested kvlist value
|
||||||
const getNestedKvValue = (
|
const getNestedKvValue: (
|
||||||
|
kvList: JSONObject | undefined,
|
||||||
|
parentKey: string,
|
||||||
|
childKey: string,
|
||||||
|
) => string = (
|
||||||
kvList: JSONObject | undefined,
|
kvList: JSONObject | undefined,
|
||||||
parentKey: string,
|
parentKey: string,
|
||||||
childKey: string,
|
childKey: string,
|
||||||
@@ -129,15 +135,17 @@ const KubernetesClusterEvents: FunctionComponent<
|
|||||||
if (!kvList) {
|
if (!kvList) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
const values = (kvList as JSONObject)["values"] as
|
const values: Array<JSONObject> | undefined = (kvList as JSONObject)[
|
||||||
| Array<JSONObject>
|
"values"
|
||||||
| undefined;
|
] as Array<JSONObject> | undefined;
|
||||||
if (!values) {
|
if (!values) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
for (const entry of values) {
|
for (const entry of values) {
|
||||||
if (entry["key"] === parentKey) {
|
if (entry["key"] === parentKey) {
|
||||||
const val = entry["value"] as JSONObject | undefined;
|
const val: JSONObject | undefined = entry["value"] as
|
||||||
|
| JSONObject
|
||||||
|
| undefined;
|
||||||
if (val && val["kvlistValue"]) {
|
if (val && val["kvlistValue"]) {
|
||||||
return getKvValue(val["kvlistValue"] as JSONObject, childKey);
|
return getKvValue(val["kvlistValue"] as JSONObject, childKey);
|
||||||
}
|
}
|
||||||
@@ -179,17 +187,20 @@ const KubernetesClusterEvents: FunctionComponent<
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The body has a top-level kvlistValue with "type" (ADDED/MODIFIED) and "object" keys
|
// The body has a top-level kvlistValue with "type" (ADDED/MODIFIED) and "object" keys
|
||||||
const topKvList = bodyObj["kvlistValue"] as JSONObject | undefined;
|
const topKvList: JSONObject | undefined = bodyObj["kvlistValue"] as
|
||||||
|
| JSONObject
|
||||||
|
| undefined;
|
||||||
if (!topKvList) {
|
if (!topKvList) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the "object" which is the actual k8s Event
|
// Get the "object" which is the actual k8s Event
|
||||||
const objectKvListRaw = getKvValue(topKvList, "object");
|
const objectKvListRaw: string = getKvValue(topKvList, "object");
|
||||||
if (!objectKvListRaw || typeof objectKvListRaw === "string") {
|
if (!objectKvListRaw || typeof objectKvListRaw === "string") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const objectKvList = objectKvListRaw as unknown as JSONObject;
|
const objectKvList: JSONObject =
|
||||||
|
objectKvListRaw as unknown as JSONObject;
|
||||||
|
|
||||||
const eventType: string = getKvValue(objectKvList, "type") || "";
|
const eventType: string = getKvValue(objectKvList, "type") || "";
|
||||||
const reason: string = getKvValue(objectKvList, "reason") || "";
|
const reason: string = getKvValue(objectKvList, "reason") || "";
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import Navigation from "Common/UI/Utils/Navigation";
|
|||||||
import KubernetesCluster from "Common/Models/DatabaseModels/KubernetesCluster";
|
import KubernetesCluster from "Common/Models/DatabaseModels/KubernetesCluster";
|
||||||
import MetricView from "../../../Components/Metrics/MetricView";
|
import MetricView from "../../../Components/Metrics/MetricView";
|
||||||
import MetricViewData from "Common/Types/Metrics/MetricViewData";
|
import MetricViewData from "Common/Types/Metrics/MetricViewData";
|
||||||
import MetricQueryConfigData from "Common/Types/Metrics/MetricQueryConfigData";
|
import MetricQueryConfigData, {
|
||||||
|
ChartSeries,
|
||||||
|
} from "Common/Types/Metrics/MetricQueryConfigData";
|
||||||
import AggregationType from "Common/Types/BaseDatabase/AggregationType";
|
import AggregationType from "Common/Types/BaseDatabase/AggregationType";
|
||||||
import OneUptimeDate from "Common/Types/Date";
|
import OneUptimeDate from "Common/Types/Date";
|
||||||
import InBetween from "Common/Types/BaseDatabase/InBetween";
|
import InBetween from "Common/Types/BaseDatabase/InBetween";
|
||||||
@@ -21,7 +23,6 @@ import PageLoader from "Common/UI/Components/Loader/PageLoader";
|
|||||||
import ErrorMessage from "Common/UI/Components/ErrorMessage/ErrorMessage";
|
import ErrorMessage from "Common/UI/Components/ErrorMessage/ErrorMessage";
|
||||||
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
|
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
|
||||||
import AggregateModel from "Common/Types/BaseDatabase/AggregatedModel";
|
import AggregateModel from "Common/Types/BaseDatabase/AggregatedModel";
|
||||||
import { ChartSeries } from "Common/Types/Metrics/MetricQueryConfigData";
|
|
||||||
|
|
||||||
const KubernetesClusterNodes: FunctionComponent<
|
const KubernetesClusterNodes: FunctionComponent<
|
||||||
PageComponentProps
|
PageComponentProps
|
||||||
@@ -68,7 +69,9 @@ const KubernetesClusterNodes: FunctionComponent<
|
|||||||
const startDate: Date = OneUptimeDate.addRemoveHours(endDate, -6);
|
const startDate: Date = OneUptimeDate.addRemoveHours(endDate, -6);
|
||||||
const startAndEndDate: InBetween<Date> = new InBetween(startDate, endDate);
|
const startAndEndDate: InBetween<Date> = new InBetween(startDate, endDate);
|
||||||
|
|
||||||
const getNodeSeries = (data: AggregateModel): ChartSeries => {
|
const getNodeSeries: (data: AggregateModel) => ChartSeries = (
|
||||||
|
data: AggregateModel,
|
||||||
|
): ChartSeries => {
|
||||||
const attributes: Record<string, unknown> =
|
const attributes: Record<string, unknown> =
|
||||||
(data["attributes"] as Record<string, unknown>) || {};
|
(data["attributes"] as Record<string, unknown>) || {};
|
||||||
const nodeName: string =
|
const nodeName: string =
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import Card from "Common/UI/Components/Card/Card";
|
|||||||
import InfoCard from "Common/UI/Components/InfoCard/InfoCard";
|
import InfoCard from "Common/UI/Components/InfoCard/InfoCard";
|
||||||
import MetricView from "../../../Components/Metrics/MetricView";
|
import MetricView from "../../../Components/Metrics/MetricView";
|
||||||
import MetricViewData from "Common/Types/Metrics/MetricViewData";
|
import MetricViewData from "Common/Types/Metrics/MetricViewData";
|
||||||
import MetricQueryConfigData from "Common/Types/Metrics/MetricQueryConfigData";
|
import MetricQueryConfigData, {
|
||||||
|
ChartSeries,
|
||||||
|
} from "Common/Types/Metrics/MetricQueryConfigData";
|
||||||
import AggregationType from "Common/Types/BaseDatabase/AggregationType";
|
import AggregationType from "Common/Types/BaseDatabase/AggregationType";
|
||||||
import OneUptimeDate from "Common/Types/Date";
|
import OneUptimeDate from "Common/Types/Date";
|
||||||
import InBetween from "Common/Types/BaseDatabase/InBetween";
|
import InBetween from "Common/Types/BaseDatabase/InBetween";
|
||||||
@@ -23,7 +25,6 @@ import PageLoader from "Common/UI/Components/Loader/PageLoader";
|
|||||||
import ErrorMessage from "Common/UI/Components/ErrorMessage/ErrorMessage";
|
import ErrorMessage from "Common/UI/Components/ErrorMessage/ErrorMessage";
|
||||||
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
|
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
|
||||||
import AggregateModel from "Common/Types/BaseDatabase/AggregatedModel";
|
import AggregateModel from "Common/Types/BaseDatabase/AggregatedModel";
|
||||||
import { ChartSeries } from "Common/Types/Metrics/MetricQueryConfigData";
|
|
||||||
|
|
||||||
const KubernetesClusterPodDetail: FunctionComponent<
|
const KubernetesClusterPodDetail: FunctionComponent<
|
||||||
PageComponentProps
|
PageComponentProps
|
||||||
@@ -76,7 +77,9 @@ const KubernetesClusterPodDetail: FunctionComponent<
|
|||||||
const startDate: Date = OneUptimeDate.addRemoveHours(endDate, -6);
|
const startDate: Date = OneUptimeDate.addRemoveHours(endDate, -6);
|
||||||
const startAndEndDate: InBetween<Date> = new InBetween(startDate, endDate);
|
const startAndEndDate: InBetween<Date> = new InBetween(startDate, endDate);
|
||||||
|
|
||||||
const getContainerSeries = (data: AggregateModel): ChartSeries => {
|
const getContainerSeries: (data: AggregateModel) => ChartSeries = (
|
||||||
|
data: AggregateModel,
|
||||||
|
): ChartSeries => {
|
||||||
const attributes: Record<string, unknown> =
|
const attributes: Record<string, unknown> =
|
||||||
(data["attributes"] as Record<string, unknown>) || {};
|
(data["attributes"] as Record<string, unknown>) || {};
|
||||||
const containerName: string =
|
const containerName: string =
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import Navigation from "Common/UI/Utils/Navigation";
|
|||||||
import KubernetesCluster from "Common/Models/DatabaseModels/KubernetesCluster";
|
import KubernetesCluster from "Common/Models/DatabaseModels/KubernetesCluster";
|
||||||
import MetricView from "../../../Components/Metrics/MetricView";
|
import MetricView from "../../../Components/Metrics/MetricView";
|
||||||
import MetricViewData from "Common/Types/Metrics/MetricViewData";
|
import MetricViewData from "Common/Types/Metrics/MetricViewData";
|
||||||
import MetricQueryConfigData from "Common/Types/Metrics/MetricQueryConfigData";
|
import MetricQueryConfigData, {
|
||||||
|
ChartSeries,
|
||||||
|
} from "Common/Types/Metrics/MetricQueryConfigData";
|
||||||
import AggregationType from "Common/Types/BaseDatabase/AggregationType";
|
import AggregationType from "Common/Types/BaseDatabase/AggregationType";
|
||||||
import OneUptimeDate from "Common/Types/Date";
|
import OneUptimeDate from "Common/Types/Date";
|
||||||
import InBetween from "Common/Types/BaseDatabase/InBetween";
|
import InBetween from "Common/Types/BaseDatabase/InBetween";
|
||||||
@@ -21,7 +23,6 @@ import PageLoader from "Common/UI/Components/Loader/PageLoader";
|
|||||||
import ErrorMessage from "Common/UI/Components/ErrorMessage/ErrorMessage";
|
import ErrorMessage from "Common/UI/Components/ErrorMessage/ErrorMessage";
|
||||||
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
|
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
|
||||||
import AggregateModel from "Common/Types/BaseDatabase/AggregatedModel";
|
import AggregateModel from "Common/Types/BaseDatabase/AggregatedModel";
|
||||||
import { ChartSeries } from "Common/Types/Metrics/MetricQueryConfigData";
|
|
||||||
|
|
||||||
const KubernetesClusterPods: FunctionComponent<
|
const KubernetesClusterPods: FunctionComponent<
|
||||||
PageComponentProps
|
PageComponentProps
|
||||||
@@ -68,7 +69,9 @@ const KubernetesClusterPods: FunctionComponent<
|
|||||||
const startDate: Date = OneUptimeDate.addRemoveHours(endDate, -6);
|
const startDate: Date = OneUptimeDate.addRemoveHours(endDate, -6);
|
||||||
const startAndEndDate: InBetween<Date> = new InBetween(startDate, endDate);
|
const startAndEndDate: InBetween<Date> = new InBetween(startDate, endDate);
|
||||||
|
|
||||||
const getPodSeries = (data: AggregateModel): ChartSeries => {
|
const getPodSeries: (data: AggregateModel) => ChartSeries = (
|
||||||
|
data: AggregateModel,
|
||||||
|
): ChartSeries => {
|
||||||
const attributes: Record<string, unknown> =
|
const attributes: Record<string, unknown> =
|
||||||
(data["attributes"] as Record<string, unknown>) || {};
|
(data["attributes"] as Record<string, unknown>) || {};
|
||||||
const podName: string =
|
const podName: string =
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { MigrationInterface, QueryRunner } from "typeorm";
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
export class MigrationName1773761409952 implements MigrationInterface {
|
export class MigrationName1773761409952 implements MigrationInterface {
|
||||||
name = "MigrationName1773761409952";
|
public name = "MigrationName1773761409952";
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
await queryRunner.query(
|
await queryRunner.query(
|
||||||
|
|||||||
@@ -206,9 +206,10 @@ export default class CriticalPathUtil {
|
|||||||
const criticalPathCache: Map<string, { weight: number; path: string[] }> =
|
const criticalPathCache: Map<string, { weight: number; path: string[] }> =
|
||||||
new Map();
|
new Map();
|
||||||
|
|
||||||
const computeWeight = (
|
const computeWeight: (spanId: string) => {
|
||||||
spanId: string,
|
weight: number;
|
||||||
): { weight: number; path: string[] } => {
|
path: string[];
|
||||||
|
} = (spanId: string): { weight: number; path: string[] } => {
|
||||||
const cached: { weight: number; path: string[] } | undefined =
|
const cached: { weight: number; path: string[] } | undefined =
|
||||||
criticalPathCache.get(spanId);
|
criticalPathCache.get(spanId);
|
||||||
if (cached) {
|
if (cached) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{- if .Values.aiAgent.enabled }}
|
{{- if and .Values.aiAgent.enabled (not .Values.deployment.disableDeployments) }}
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{- if $.Values.app.enabled }}
|
{{- if and $.Values.app.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
# OneUptime app Deployment
|
# OneUptime app Deployment
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -137,7 +137,7 @@ spec:
|
|||||||
---
|
---
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if $.Values.app.enabled }}
|
{{- if and $.Values.app.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
# OneUptime app Service
|
# OneUptime app Service
|
||||||
{{- $appPorts := dict "port" $.Values.app.ports.http -}}
|
{{- $appPorts := dict "port" $.Values.app.ports.http -}}
|
||||||
{{- $appServiceArgs := dict "ServiceName" "app" "Ports" $appPorts "Release" $.Release "Values" $.Values -}}
|
{{- $appServiceArgs := dict "ServiceName" "app" "Ports" $appPorts "Release" $.Release "Values" $.Values -}}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{- if $.Values.cronJobs.cleanup.enabled }}
|
{{- if and $.Values.cronJobs.cleanup.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
|
|
||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: CronJob
|
kind: CronJob
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{- if $.Values.home.enabled }}
|
{{- if and $.Values.home.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
# OneUptime Home Deployment
|
# OneUptime Home Deployment
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -126,7 +126,7 @@ spec:
|
|||||||
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if $.Values.home.enabled }}
|
{{- if and $.Values.home.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
# OneUptime home Service
|
# OneUptime home Service
|
||||||
{{- $homePorts := $.Values.home.ports -}}
|
{{- $homePorts := $.Values.home.ports -}}
|
||||||
{{- $homeServiceArgs := dict "ServiceName" "home" "Ports" $homePorts "Release" $.Release "Values" $.Values -}}
|
{{- $homeServiceArgs := dict "ServiceName" "home" "Ports" $homePorts "Release" $.Release "Values" $.Values -}}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ KEDA ScaledObjects for various services
|
|||||||
*/}}
|
*/}}
|
||||||
|
|
||||||
{{/* Telemetry KEDA ScaledObject */}}
|
{{/* Telemetry KEDA ScaledObject */}}
|
||||||
{{- if and .Values.keda.enabled .Values.telemetry.enabled .Values.telemetry.keda.enabled (not .Values.telemetry.disableAutoscaler) }}
|
{{- if and .Values.keda.enabled .Values.telemetry.enabled .Values.telemetry.keda.enabled (not .Values.telemetry.disableAutoscaler) (not .Values.deployment.disableDeployments) }}
|
||||||
{{- $metricsConfig := dict "enabled" .Values.telemetry.keda.enabled "minReplicas" .Values.telemetry.keda.minReplicas "maxReplicas" .Values.telemetry.keda.maxReplicas "pollingInterval" .Values.telemetry.keda.pollingInterval "cooldownPeriod" .Values.telemetry.keda.cooldownPeriod "triggers" (list (dict "query" "oneuptime_telemetry_queue_size" "threshold" .Values.telemetry.keda.queueSizeThreshold "port" .Values.telemetry.ports.http)) }}
|
{{- $metricsConfig := dict "enabled" .Values.telemetry.keda.enabled "minReplicas" .Values.telemetry.keda.minReplicas "maxReplicas" .Values.telemetry.keda.maxReplicas "pollingInterval" .Values.telemetry.keda.pollingInterval "cooldownPeriod" .Values.telemetry.keda.cooldownPeriod "triggers" (list (dict "query" "oneuptime_telemetry_queue_size" "threshold" .Values.telemetry.keda.queueSizeThreshold "port" .Values.telemetry.ports.http)) }}
|
||||||
{{- $telemetryKedaArgs := dict "ServiceName" "telemetry" "Release" .Release "Values" .Values "MetricsConfig" $metricsConfig "DisableAutoscaler" .Values.telemetry.disableAutoscaler }}
|
{{- $telemetryKedaArgs := dict "ServiceName" "telemetry" "Release" .Release "Values" .Values "MetricsConfig" $metricsConfig "DisableAutoscaler" .Values.telemetry.disableAutoscaler }}
|
||||||
{{- include "oneuptime.kedaScaledObject" $telemetryKedaArgs }}
|
{{- include "oneuptime.kedaScaledObject" $telemetryKedaArgs }}
|
||||||
@@ -12,7 +12,7 @@ KEDA ScaledObjects for various services
|
|||||||
{{/* Probe KEDA ScaledObjects - one for each probe configuration */}}
|
{{/* Probe KEDA ScaledObjects - one for each probe configuration */}}
|
||||||
{{- range $key, $val := $.Values.probes }}
|
{{- range $key, $val := $.Values.probes }}
|
||||||
{{- $probeEnabled := or (not (hasKey $val "enabled")) $val.enabled }}
|
{{- $probeEnabled := or (not (hasKey $val "enabled")) $val.enabled }}
|
||||||
{{- if and $.Values.keda.enabled $probeEnabled (and $val.keda $val.keda.enabled) (not $val.disableAutoscaler) }}
|
{{- if and $.Values.keda.enabled $probeEnabled (and $val.keda $val.keda.enabled) (not $val.disableAutoscaler) (not $.Values.deployment.disableDeployments) }}
|
||||||
{{- $serviceName := printf "probe-%s" $key }}
|
{{- $serviceName := printf "probe-%s" $key }}
|
||||||
{{- $probePort := 3874 }}
|
{{- $probePort := 3874 }}
|
||||||
{{- if and $val.ports $val.ports.http }}
|
{{- if and $val.ports $val.ports.http }}
|
||||||
@@ -25,14 +25,14 @@ KEDA ScaledObjects for various services
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/* Worker KEDA ScaledObject */}}
|
{{/* Worker KEDA ScaledObject */}}
|
||||||
{{- if and .Values.keda.enabled .Values.worker.enabled .Values.worker.keda.enabled (not .Values.worker.disableAutoscaler) }}
|
{{- if and .Values.keda.enabled .Values.worker.enabled .Values.worker.keda.enabled (not .Values.worker.disableAutoscaler) (not .Values.deployment.disableDeployments) }}
|
||||||
{{- $metricsConfig := dict "enabled" .Values.worker.keda.enabled "minReplicas" .Values.worker.keda.minReplicas "maxReplicas" .Values.worker.keda.maxReplicas "pollingInterval" .Values.worker.keda.pollingInterval "cooldownPeriod" .Values.worker.keda.cooldownPeriod "triggers" (list (dict "query" "oneuptime_worker_queue_size" "threshold" .Values.worker.keda.queueSizeThreshold "port" .Values.worker.ports.http)) }}
|
{{- $metricsConfig := dict "enabled" .Values.worker.keda.enabled "minReplicas" .Values.worker.keda.minReplicas "maxReplicas" .Values.worker.keda.maxReplicas "pollingInterval" .Values.worker.keda.pollingInterval "cooldownPeriod" .Values.worker.keda.cooldownPeriod "triggers" (list (dict "query" "oneuptime_worker_queue_size" "threshold" .Values.worker.keda.queueSizeThreshold "port" .Values.worker.ports.http)) }}
|
||||||
{{- $workerKedaArgs := dict "ServiceName" "worker" "Release" .Release "Values" .Values "MetricsConfig" $metricsConfig "DisableAutoscaler" .Values.worker.disableAutoscaler }}
|
{{- $workerKedaArgs := dict "ServiceName" "worker" "Release" .Release "Values" .Values "MetricsConfig" $metricsConfig "DisableAutoscaler" .Values.worker.disableAutoscaler }}
|
||||||
{{- include "oneuptime.kedaScaledObject" $workerKedaArgs }}
|
{{- include "oneuptime.kedaScaledObject" $workerKedaArgs }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{/* AI Agent KEDA ScaledObject */}}
|
{{/* AI Agent KEDA ScaledObject */}}
|
||||||
{{- if and .Values.keda.enabled .Values.aiAgent.enabled .Values.aiAgent.keda.enabled (not .Values.aiAgent.disableAutoscaler) }}
|
{{- if and .Values.keda.enabled .Values.aiAgent.enabled .Values.aiAgent.keda.enabled (not .Values.aiAgent.disableAutoscaler) (not .Values.deployment.disableDeployments) }}
|
||||||
{{- $metricsConfig := dict "enabled" .Values.aiAgent.keda.enabled "minReplicas" .Values.aiAgent.keda.minReplicas "maxReplicas" .Values.aiAgent.keda.maxReplicas "pollingInterval" .Values.aiAgent.keda.pollingInterval "cooldownPeriod" .Values.aiAgent.keda.cooldownPeriod "triggers" (list (dict "query" "oneuptime_ai_agent_queue_size" "threshold" .Values.aiAgent.keda.queueSizeThreshold "port" .Values.aiAgent.ports.http)) }}
|
{{- $metricsConfig := dict "enabled" .Values.aiAgent.keda.enabled "minReplicas" .Values.aiAgent.keda.minReplicas "maxReplicas" .Values.aiAgent.keda.maxReplicas "pollingInterval" .Values.aiAgent.keda.pollingInterval "cooldownPeriod" .Values.aiAgent.keda.cooldownPeriod "triggers" (list (dict "query" "oneuptime_ai_agent_queue_size" "threshold" .Values.aiAgent.keda.queueSizeThreshold "port" .Values.aiAgent.ports.http)) }}
|
||||||
{{- $aiAgentKedaArgs := dict "ServiceName" "ai-agent" "Release" .Release "Values" .Values "MetricsConfig" $metricsConfig "DisableAutoscaler" .Values.aiAgent.disableAutoscaler }}
|
{{- $aiAgentKedaArgs := dict "ServiceName" "ai-agent" "Release" .Release "Values" .Values "MetricsConfig" $metricsConfig "DisableAutoscaler" .Values.aiAgent.disableAutoscaler }}
|
||||||
{{- include "oneuptime.kedaScaledObject" $aiAgentKedaArgs }}
|
{{- include "oneuptime.kedaScaledObject" $aiAgentKedaArgs }}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{- if $.Values.nginx.enabled }}
|
{{- if and $.Values.nginx.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
|
|
||||||
# OneUptime nginx Deployment
|
# OneUptime nginx Deployment
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
{{- if not $.Values.deployment.disableDeployments }}
|
||||||
{{- range $key, $val := $.Values.probes }}
|
{{- range $key, $val := $.Values.probes }}
|
||||||
{{- if or (not (hasKey $val "enabled")) $val.enabled }}
|
{{- if or (not (hasKey $val "enabled")) $val.enabled }}
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
@@ -166,3 +167,4 @@ spec:
|
|||||||
---
|
---
|
||||||
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{- if $.Values.telemetry.enabled }}
|
{{- if and $.Values.telemetry.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
# OneUptime telemetry Deployment
|
# OneUptime telemetry Deployment
|
||||||
|
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
@@ -137,7 +137,7 @@ spec:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
{{- if $.Values.telemetry.enabled }}
|
{{- if and $.Values.telemetry.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
# OneUptime telemetry Service
|
# OneUptime telemetry Service
|
||||||
{{- $telemetryPorts := dict "http" $.Values.telemetry.ports.http "grpc" $.Values.telemetry.ports.grpc -}}
|
{{- $telemetryPorts := dict "http" $.Values.telemetry.ports.http "grpc" $.Values.telemetry.ports.grpc -}}
|
||||||
{{- $telemetryServiceArgs := dict "ServiceName" "telemetry" "Ports" $telemetryPorts "Release" $.Release "Values" $.Values -}}
|
{{- $telemetryServiceArgs := dict "ServiceName" "telemetry" "Ports" $telemetryPorts "Release" $.Release "Values" $.Values -}}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{- if $.Values.testServer.enabled }}
|
{{- if and $.Values.testServer.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
|
|
||||||
# OneUptime test-server Deployment
|
# OneUptime test-server Deployment
|
||||||
{{- $testServerPorts := $.Values.testServer.ports -}}
|
{{- $testServerPorts := $.Values.testServer.ports -}}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{- if $.Values.worker.enabled }}
|
{{- if and $.Values.worker.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
# OneUptime worker Deployment
|
# OneUptime worker Deployment
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@@ -128,7 +128,7 @@ spec:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
{{- if $.Values.worker.enabled }}
|
{{- if and $.Values.worker.enabled (not $.Values.deployment.disableDeployments) }}
|
||||||
# OneUptime worker Service
|
# OneUptime worker Service
|
||||||
{{- $workerPorts := $.Values.worker.ports -}}
|
{{- $workerPorts := $.Values.worker.ports -}}
|
||||||
{{- $workerServiceArgs := dict "ServiceName" "worker" "Ports" $workerPorts "Release" $.Release "Values" $.Values -}}
|
{{- $workerServiceArgs := dict "ServiceName" "worker" "Ports" $workerPorts "Release" $.Release "Values" $.Values -}}
|
||||||
|
|||||||
@@ -86,6 +86,11 @@
|
|||||||
"deployment": {
|
"deployment": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"disableDeployments": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "When set to true, no OneUptime deployments are provisioned. Only databases (Redis, ClickHouse, Postgres) will be running.",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
"includeTimestampLabel": {
|
"includeTimestampLabel": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ externalSecrets:
|
|||||||
passwordKey:
|
passwordKey:
|
||||||
|
|
||||||
deployment:
|
deployment:
|
||||||
|
# When set to true, no OneUptime deployments are provisioned. Only databases (Redis, ClickHouse, Postgres) will be running.
|
||||||
|
disableDeployments: false
|
||||||
# Default replica count for all deployments
|
# Default replica count for all deployments
|
||||||
replicaCount: 1
|
replicaCount: 1
|
||||||
# Update strategy type for all deployments
|
# Update strategy type for all deployments
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ function toDisplayString(val: unknown): string {
|
|||||||
}
|
}
|
||||||
if (typeof val === "object") {
|
if (typeof val === "object") {
|
||||||
// Handle OneUptime typed objects like URL { _type, value }
|
// Handle OneUptime typed objects like URL { _type, value }
|
||||||
const obj = val as Record<string, unknown>;
|
const obj: Record<string, unknown> = val as Record<string, unknown>;
|
||||||
if (typeof obj.value === "string") {
|
if (typeof obj.value === "string") {
|
||||||
return obj.value;
|
return obj.value;
|
||||||
}
|
}
|
||||||
@@ -674,7 +674,7 @@ export default function MonitorSummaryView({
|
|||||||
return getProbeResponse(probe);
|
return getProbeResponse(probe);
|
||||||
}, [probeItems, selectedProbeIndex]);
|
}, [probeItems, selectedProbeIndex]);
|
||||||
|
|
||||||
const renderContent = (): React.JSX.Element => {
|
const renderContent: () => React.JSX.Element = (): React.JSX.Element => {
|
||||||
if (!latestResponse) {
|
if (!latestResponse) {
|
||||||
return (
|
return (
|
||||||
<View style={{ padding: 20, alignItems: "center" }}>
|
<View style={{ padding: 20, alignItems: "center" }}>
|
||||||
|
|||||||
@@ -4,10 +4,8 @@ import {
|
|||||||
fetchMonitorFeed,
|
fetchMonitorFeed,
|
||||||
fetchMonitorStatusTimeline,
|
fetchMonitorStatusTimeline,
|
||||||
fetchMonitorProbes,
|
fetchMonitorProbes,
|
||||||
} from "../api/monitors";
|
type MonitorStatusTimelineItem,
|
||||||
import type {
|
type MonitorProbeItem,
|
||||||
MonitorStatusTimelineItem,
|
|
||||||
MonitorProbeItem,
|
|
||||||
} from "../api/monitors";
|
} from "../api/monitors";
|
||||||
import type { MonitorItem, FeedItem } from "../api/types";
|
import type { MonitorItem, FeedItem } from "../api/types";
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { ExpressRequest } from "Common/Server/Utils/Express";
|
import { ExpressRequest } from "Common/Server/Utils/Express";
|
||||||
import CaptureSpan from "Common/Server/Utils/Telemetry/CaptureSpan";
|
import CaptureSpan from "Common/Server/Utils/Telemetry/CaptureSpan";
|
||||||
import { JSONArray, JSONObject } from "Common/Types/JSON";
|
import { JSONArray, JSONObject, JSONValue } from "Common/Types/JSON";
|
||||||
import ObjectID from "Common/Types/ObjectID";
|
import ObjectID from "Common/Types/ObjectID";
|
||||||
import KubernetesClusterService from "Common/Server/Services/KubernetesClusterService";
|
import KubernetesClusterService from "Common/Server/Services/KubernetesClusterService";
|
||||||
|
import KubernetesCluster from "Common/Models/DatabaseModels/KubernetesCluster";
|
||||||
import logger from "Common/Server/Utils/Logger";
|
import logger from "Common/Server/Utils/Logger";
|
||||||
|
|
||||||
export default abstract class OtelIngestBaseService {
|
export default abstract class OtelIngestBaseService {
|
||||||
@@ -46,7 +47,9 @@ export default abstract class OtelIngestBaseService {
|
|||||||
attribute["value"] &&
|
attribute["value"] &&
|
||||||
(attribute["value"] as JSONObject)["stringValue"]
|
(attribute["value"] as JSONObject)["stringValue"]
|
||||||
) {
|
) {
|
||||||
const value = (attribute["value"] as JSONObject)["stringValue"];
|
const value: JSONValue = (attribute["value"] as JSONObject)[
|
||||||
|
"stringValue"
|
||||||
|
];
|
||||||
if (typeof value === "string" && value.trim()) {
|
if (typeof value === "string" && value.trim()) {
|
||||||
return value.trim();
|
return value.trim();
|
||||||
}
|
}
|
||||||
@@ -69,7 +72,7 @@ export default abstract class OtelIngestBaseService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cluster =
|
const cluster: KubernetesCluster =
|
||||||
await KubernetesClusterService.findOrCreateByClusterIdentifier({
|
await KubernetesClusterService.findOrCreateByClusterIdentifier({
|
||||||
projectId: data.projectId,
|
projectId: data.projectId,
|
||||||
clusterIdentifier: clusterName,
|
clusterIdentifier: clusterName,
|
||||||
|
|||||||
Reference in New Issue
Block a user