(() => {
+ return convertDateRangeToGranularityString(dateRange, 60);
+ }, [dateRange]);
+
+ return (
+
+
+
+ {title}
+ setRange(value as any)}
+ />
+
+
+ setSize(value as any)}
+ />
+
+
+
+
+
+ CPU Usage (%)
+
+
+
+
+
+
+
+ Memory Used
+
+
+
+
+
+
+
+ Disk Available
+
+
+
+
+
+
+
+ );
+};
+
+const MetricsSubpanel = ({ logData }: { logData?: any }) => {
+ const podUid = useMemo(() => {
+ return logData?.['string.values']?.[
+ logData?.['string.names']?.indexOf('k8s.pod.uid')
+ ];
+ }, [logData]);
+
+ const nodeName = useMemo(() => {
+ return logData?.['string.values']?.[
+ logData?.['string.names']?.indexOf('k8s.node.name')
+ ];
+ }, [logData]);
+
+ const timestamp = new Date(logData?.timestamp).getTime();
+
+ return (
+
+ {podUid && (
+
+ )}
+ {nodeName && (
+
+ )}
+
+ );
+};
+
+const checkKeyExistsInLogData = (key: string, logData: any) => {
+ return logData?.['string.values']?.[logData?.['string.names']?.indexOf(key)];
+};
export default function LogSidePanel({
logId,
@@ -2383,12 +2575,8 @@ export default function LogSidePanel({
// TODO: use rum_session_id instead ?
const rumSessionId: string | undefined =
- logData?.['string.values']?.[
- logData?.['string.names']?.indexOf('rum.sessionId')
- ] ??
- logData?.['string.values']?.[
- logData?.['string.names']?.indexOf('process.tag.rum.sessionId')
- ] ??
+ checkKeyExistsInLogData('rum.sessionId', logData) ??
+ checkKeyExistsInLogData('process.tag.rum.sessionId', logData) ??
sessionId;
const { width } = useWindowSize();
@@ -2396,6 +2584,13 @@ export default function LogSidePanel({
const drawerZIndex = contextZIndex + 1;
+ const hasK8sContext = useMemo(() => {
+ return (
+ checkKeyExistsInLogData('k8s.pod.uid', logData) != null ||
+ checkKeyExistsInLogData('k8s.node.name', logData) != null
+ );
+ }, [logData]);
+
return (
setTab(v)}
@@ -2553,6 +2756,13 @@ export default function LogSidePanel({
)}
) : null}
+
+ {/* Metrics */}
+ {displayedTab === 'metrics' ? (
+
+
+
+ ) : null}
>
diff --git a/packages/app/src/config.ts b/packages/app/src/config.ts
index b718a6e1..3831acbf 100644
--- a/packages/app/src/config.ts
+++ b/packages/app/src/config.ts
@@ -12,3 +12,4 @@ export const IS_OSS = process.env.NEXT_PUBLIC_IS_OSS ?? 'true' === 'true';
// Features in development
export const METRIC_ALERTS_ENABLED = process.env.NODE_ENV === 'development';
+export const K8S_METRICS_ENABLED = process.env.NODE_ENV === 'development';