mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-01 18:47:39 +00:00
Handle unexpected socket close and replace the default rlimit(100)
filter with leftOff(-1)
filter (#508)
* Handle unexpected socket close and replace the default `rlimit(100)` filter with `leftOff(-1)` filter * Rename `dontClear` parameter to `resetEntriesBuffer` and remove negation
This commit is contained in:
@@ -42,8 +42,8 @@ RUN go build -ldflags="-s -w \
|
|||||||
-X 'mizuserver/pkg/version.SemVer=${SEM_VER}'" -o mizuagent .
|
-X 'mizuserver/pkg/version.SemVer=${SEM_VER}'" -o mizuagent .
|
||||||
|
|
||||||
# Download Basenine executable, verify the sha1sum and move it to a directory in $PATH
|
# Download Basenine executable, verify the sha1sum and move it to a directory in $PATH
|
||||||
ADD https://github.com/up9inc/basenine/releases/download/v0.2.11/basenine_linux_amd64 ./basenine_linux_amd64
|
ADD https://github.com/up9inc/basenine/releases/download/v0.2.12/basenine_linux_amd64 ./basenine_linux_amd64
|
||||||
ADD https://github.com/up9inc/basenine/releases/download/v0.2.11/basenine_linux_amd64.sha256 ./basenine_linux_amd64.sha256
|
ADD https://github.com/up9inc/basenine/releases/download/v0.2.12/basenine_linux_amd64.sha256 ./basenine_linux_amd64.sha256
|
||||||
RUN shasum -a 256 -c basenine_linux_amd64.sha256
|
RUN shasum -a 256 -c basenine_linux_amd64.sha256
|
||||||
RUN chmod +x ./basenine_linux_amd64
|
RUN chmod +x ./basenine_linux_amd64
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ require (
|
|||||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
||||||
github.com/orcaman/concurrent-map v0.0.0-20210106121528-16402b402231
|
github.com/orcaman/concurrent-map v0.0.0-20210106121528-16402b402231
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||||
github.com/up9inc/basenine/client/go v0.0.0-20211121072216-04366911881c
|
github.com/up9inc/basenine/client/go v0.0.0-20211125004153-d0e8aec03fea
|
||||||
github.com/up9inc/mizu/shared v0.0.0
|
github.com/up9inc/mizu/shared v0.0.0
|
||||||
github.com/up9inc/mizu/tap v0.0.0
|
github.com/up9inc/mizu/tap v0.0.0
|
||||||
github.com/up9inc/mizu/tap/api v0.0.0
|
github.com/up9inc/mizu/tap/api v0.0.0
|
||||||
|
@@ -450,8 +450,8 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
|||||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||||
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||||
github.com/up9inc/basenine/client/go v0.0.0-20211121072216-04366911881c h1:GJsCVhDKjV/k3mNG255VN7hAQ7fxyNgX5T+VJyzoOQ0=
|
github.com/up9inc/basenine/client/go v0.0.0-20211125004153-d0e8aec03fea h1:GpJGO2PNTS/S0j2E1yqBi3ST/VXfokzuOrTQyaYgWnA=
|
||||||
github.com/up9inc/basenine/client/go v0.0.0-20211121072216-04366911881c/go.mod h1:SvJGPoa/6erhUQV7kvHBwM/0x5LyO6XaG2lUaCaKiUI=
|
github.com/up9inc/basenine/client/go v0.0.0-20211125004153-d0e8aec03fea/go.mod h1:SvJGPoa/6erhUQV7kvHBwM/0x5LyO6XaG2lUaCaKiUI=
|
||||||
github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw=
|
github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw=
|
||||||
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f h1:p4VB7kIXpOQvVn1ZaTIVp+3vuYAXFe3OJEvjbUYJLaA=
|
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f h1:p4VB7kIXpOQvVn1ZaTIVp+3vuYAXFe3OJEvjbUYJLaA=
|
||||||
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
||||||
|
@@ -37,8 +37,8 @@ COPY agent .
|
|||||||
RUN go build -gcflags="all=-N -l" -o mizuagent .
|
RUN go build -gcflags="all=-N -l" -o mizuagent .
|
||||||
|
|
||||||
# Download Basenine executable, verify the sha1sum and move it to a directory in $PATH
|
# Download Basenine executable, verify the sha1sum and move it to a directory in $PATH
|
||||||
ADD https://github.com/up9inc/basenine/releases/download/v0.2.11/basenine_linux_amd64 ./basenine_linux_amd64
|
ADD https://github.com/up9inc/basenine/releases/download/v0.2.12/basenine_linux_amd64 ./basenine_linux_amd64
|
||||||
ADD https://github.com/up9inc/basenine/releases/download/v0.2.11/basenine_linux_amd64.sha256 ./basenine_linux_amd64.sha256
|
ADD https://github.com/up9inc/basenine/releases/download/v0.2.12/basenine_linux_amd64.sha256 ./basenine_linux_amd64.sha256
|
||||||
RUN shasum -a 256 -c basenine_linux_amd64.sha256
|
RUN shasum -a 256 -c basenine_linux_amd64.sha256
|
||||||
RUN chmod +x ./basenine_linux_amd64
|
RUN chmod +x ./basenine_linux_amd64
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ interface FiltersProps {
|
|||||||
setQuery: any
|
setQuery: any
|
||||||
backgroundColor: string
|
backgroundColor: string
|
||||||
ws: any
|
ws: any
|
||||||
openWebSocket: (query: string) => void;
|
openWebSocket: (query: string, resetEntriesBuffer: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Filters: React.FC<FiltersProps> = ({query, setQuery, backgroundColor, ws, openWebSocket}) => {
|
export const Filters: React.FC<FiltersProps> = ({query, setQuery, backgroundColor, ws, openWebSocket}) => {
|
||||||
@@ -33,7 +33,7 @@ interface QueryFormProps {
|
|||||||
setQuery: any
|
setQuery: any
|
||||||
backgroundColor: string
|
backgroundColor: string
|
||||||
ws: any
|
ws: any
|
||||||
openWebSocket: (query: string) => void;
|
openWebSocket: (query: string, resetEntriesBuffer: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const style = {
|
const style = {
|
||||||
@@ -63,8 +63,8 @@ export const QueryForm: React.FC<QueryFormProps> = ({query, setQuery, background
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmit = (e) => {
|
const handleSubmit = (e) => {
|
||||||
ws.close()
|
ws.close();
|
||||||
openWebSocket(query)
|
openWebSocket(query, true);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,6 +66,7 @@ export const TrafficPage: React.FC<TrafficPageProps> = ({setAnalyzeStatus, onTLS
|
|||||||
|
|
||||||
const [queriedCurrent, setQueriedCurrent] = useState(0);
|
const [queriedCurrent, setQueriedCurrent] = useState(0);
|
||||||
const [queriedTotal, setQueriedTotal] = useState(0);
|
const [queriedTotal, setQueriedTotal] = useState(0);
|
||||||
|
const [leftOff, setLeftOff] = useState(0);
|
||||||
|
|
||||||
const [startTime, setStartTime] = useState(0);
|
const [startTime, setStartTime] = useState(0);
|
||||||
|
|
||||||
@@ -100,16 +101,30 @@ export const TrafficPage: React.FC<TrafficPageProps> = ({setAnalyzeStatus, onTLS
|
|||||||
|
|
||||||
const listEntry = useRef(null);
|
const listEntry = useRef(null);
|
||||||
|
|
||||||
const openWebSocket = (query) => {
|
const openWebSocket = (query: string, resetEntriesBuffer: boolean) => {
|
||||||
|
if (resetEntriesBuffer) {
|
||||||
setFocusedEntryId(null);
|
setFocusedEntryId(null);
|
||||||
setEntries([]);
|
setEntries([]);
|
||||||
setEntriesBuffer([]);
|
setEntriesBuffer([]);
|
||||||
|
} else {
|
||||||
|
setEntriesBuffer(entries);
|
||||||
|
}
|
||||||
ws.current = new WebSocket(MizuWebsocketURL);
|
ws.current = new WebSocket(MizuWebsocketURL);
|
||||||
ws.current.onopen = () => {
|
ws.current.onopen = () => {
|
||||||
ws.current.send(query)
|
|
||||||
setConnection(ConnectionStatus.Connected);
|
setConnection(ConnectionStatus.Connected);
|
||||||
|
ws.current.send(query);
|
||||||
|
}
|
||||||
|
ws.current.onclose = () => {
|
||||||
|
setConnection(ConnectionStatus.Closed);
|
||||||
|
}
|
||||||
|
ws.current.onerror = (event) => {
|
||||||
|
console.error("WebSocket error:", event);
|
||||||
|
if (query) {
|
||||||
|
openWebSocket(`(${query}) and leftOff(${leftOff})`, false);
|
||||||
|
} else {
|
||||||
|
openWebSocket(`leftOff(${leftOff})`, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ws.current.onclose = () => setConnection(ConnectionStatus.Closed);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ws.current) {
|
if (ws.current) {
|
||||||
@@ -161,6 +176,7 @@ export const TrafficPage: React.FC<TrafficPageProps> = ({setAnalyzeStatus, onTLS
|
|||||||
case "queryMetadata":
|
case "queryMetadata":
|
||||||
setQueriedCurrent(message.data.current);
|
setQueriedCurrent(message.data.current);
|
||||||
setQueriedTotal(message.data.total);
|
setQueriedTotal(message.data.total);
|
||||||
|
setLeftOff(message.data.leftOff);
|
||||||
setEntries(entriesBuffer);
|
setEntries(entriesBuffer);
|
||||||
break;
|
break;
|
||||||
case "startTime":
|
case "startTime":
|
||||||
@@ -184,7 +200,7 @@ export const TrafficPage: React.FC<TrafficPageProps> = ({setAnalyzeStatus, onTLS
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
openWebSocket("rlimit(100)");
|
openWebSocket("leftOff(-1)", true);
|
||||||
try{
|
try{
|
||||||
const tapStatusResponse = await api.tapStatus();
|
const tapStatusResponse = await api.tapStatus();
|
||||||
setTappingStatus(tapStatusResponse);
|
setTappingStatus(tapStatusResponse);
|
||||||
@@ -232,8 +248,11 @@ export const TrafficPage: React.FC<TrafficPageProps> = ({setAnalyzeStatus, onTLS
|
|||||||
if (connection === ConnectionStatus.Connected) {
|
if (connection === ConnectionStatus.Connected) {
|
||||||
ws.current.close();
|
ws.current.close();
|
||||||
} else {
|
} else {
|
||||||
openWebSocket(query);
|
if (query) {
|
||||||
setConnection(ConnectionStatus.Connected);
|
openWebSocket(`(${query}) and leftOff(${leftOff})`, false);
|
||||||
|
} else {
|
||||||
|
openWebSocket(`leftOff(${leftOff})`, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user