Skip to content

Commit

Permalink
Use process.tags.k8s field for resource detection (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeShi42 committed Jan 11, 2024
1 parent a0dc1b5 commit 0ce9328
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions packages/app/src/LogSidePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2439,15 +2439,25 @@ const MetricsSubpanelGroup = ({

const MetricsSubpanel = ({ logData }: { logData?: any }) => {
const podUid = useMemo(() => {
return logData?.['string.values']?.[
logData?.['string.names']?.indexOf('k8s.pod.uid')
];
return (
logData?.['string.values']?.[
logData?.['string.names']?.indexOf('k8s.pod.uid')
] ??
logData?.['string.values']?.[
logData?.['string.names']?.indexOf('process.tag.k8s.pod.uid')
]
);
}, [logData]);

const nodeName = useMemo(() => {
return logData?.['string.values']?.[
logData?.['string.names']?.indexOf('k8s.node.name')
];
return (
logData?.['string.values']?.[
logData?.['string.names']?.indexOf('k8s.node.name')
] ??
logData?.['string.values']?.[
logData?.['string.names']?.indexOf('process.tag.k8s.node.name')
]
);
}, [logData]);

const timestamp = new Date(logData?.timestamp).getTime();
Expand Down Expand Up @@ -2596,7 +2606,9 @@ export default function LogSidePanel({
const hasK8sContext = useMemo(() => {
return (
checkKeyExistsInLogData('k8s.pod.uid', logData) != null ||
checkKeyExistsInLogData('k8s.node.name', logData) != null
checkKeyExistsInLogData('k8s.node.name', logData) != null ||
checkKeyExistsInLogData('process.tag.k8s.pod.uid', logData) != null ||
checkKeyExistsInLogData('process.tag.k8s.node.name', logData) != null
);
}, [logData]);

Expand Down

0 comments on commit 0ce9328

Please sign in to comment.