-
- {data.label}
-
+
+ {data.healthStatus && (
+
+
+
+ )}
+
+
+ {data.label}
+
+
+
);
diff --git a/x-pack/platform/plugins/shared/fleet/public/components/otel_ui/collector_config_view/index.tsx b/x-pack/platform/plugins/shared/fleet/public/components/otel_ui/collector_config_view/index.tsx
index a8982c0846676..08cb6bed5f7e8 100644
--- a/x-pack/platform/plugins/shared/fleet/public/components/otel_ui/collector_config_view/index.tsx
+++ b/x-pack/platform/plugins/shared/fleet/public/components/otel_ui/collector_config_view/index.tsx
@@ -10,7 +10,7 @@ import React, { lazy, Suspense, useMemo, useState } from 'react';
import { EuiEmptyPrompt, EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
-import type { OTelCollectorConfig } from '../../../../common/types';
+import type { OTelCollectorConfig, ComponentHealth } from '../../../../common/types';
import { ALL_PIPELINES } from './utils';
import { PipelineSelector } from './pipeline_selector';
@@ -20,10 +20,12 @@ const GraphView = lazy(() => import('./graph_view').then((m) => ({ default: m.Gr
interface CollectorConfigViewProps {
config: OTelCollectorConfig;
+ health?: ComponentHealth;
}
export const CollectorConfigView: React.FunctionComponent = ({
config,
+ health,
}) => {
const [selectedPipelineId, setSelectedPipelineId] = useState(ALL_PIPELINES);
@@ -65,7 +67,7 @@ export const CollectorConfigView: React.FunctionComponent
}>
-
+
diff --git a/x-pack/platform/plugins/shared/fleet/public/components/otel_ui/collector_config_view/utils.ts b/x-pack/platform/plugins/shared/fleet/public/components/otel_ui/collector_config_view/utils.ts
index fad58571b532a..7a5dfab28fb4f 100644
--- a/x-pack/platform/plugins/shared/fleet/public/components/otel_ui/collector_config_view/utils.ts
+++ b/x-pack/platform/plugins/shared/fleet/public/components/otel_ui/collector_config_view/utils.ts
@@ -5,7 +5,51 @@
* 2.0.
*/
+import { i18n } from '@kbn/i18n';
+import type { ComponentHealth } from '../../../../common/types';
+
+export type ComponentHealthStatus = 'healthy' | 'unhealthy' | 'unknown';
+
export const ALL_PIPELINES = '__all__';
export const SIGNAL_PREFIX = '__signal__';
export const getSignalType = (pipelineId: string): string => pipelineId.split('/')[0];
+
+export const getComponentHealthStatus = (
+ componentHealth: ComponentHealth | undefined
+): ComponentHealthStatus => {
+ if (!componentHealth) return 'unknown';
+ switch (componentHealth.status) {
+ case 'StatusOK':
+ case 'StatusStarting':
+ return 'healthy';
+ case 'StatusRecoverableError':
+ case 'StatusPermanentError':
+ case 'StatusFatalError':
+ return 'unhealthy';
+ case 'StatusNone':
+ default:
+ return 'unknown';
+ }
+};
+
+export const getHealthStatusLabel = (healthStatus: ComponentHealthStatus) => {
+ if (healthStatus === 'healthy') {
+ return i18n.translate('xpack.fleet.otelUi.componentDetail.health.statusHealthy', {
+ defaultMessage: 'Healthy',
+ });
+ } else if (healthStatus === 'unhealthy') {
+ return i18n.translate('xpack.fleet.otelUi.componentDetail.health.statusUnhealthy', {
+ defaultMessage: 'Unhealthy',
+ });
+ }
+ return i18n.translate('xpack.fleet.otelUi.componentDetail.health.statusUnknown', {
+ defaultMessage: 'Unknown',
+ });
+};
+
+export const HEALTH_STATUS_COLORS: Record = {
+ healthy: 'success',
+ unhealthy: 'warning',
+ unknown: 'subdued',
+};