mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-31 18:17:29 +00:00
Temporary: Marked with comments where to disable code for experiments
This commit is contained in:
@@ -294,6 +294,7 @@ func pipeTapChannelToSocket(connection *websocket.Conn, messageDataChannel <-cha
|
||||
|
||||
// NOTE: This is where the `*tapApi.OutputChannelItem` leaves the code
|
||||
// and goes into the intermediate WebSocket.
|
||||
// (DEBUG_PERF 7) Comment out to disable writing to WebSocket
|
||||
err = connection.WriteMessage(websocket.TextMessage, marshaledData)
|
||||
if err != nil {
|
||||
logger.Log.Errorf("error sending message through socket server %v, err: %s, (%v,%+v)", messageData, err, err, err)
|
||||
|
@@ -24,6 +24,8 @@ var (
|
||||
)
|
||||
|
||||
func LoadExtensions() {
|
||||
// (DEBUG_PERF 5) Comment out paragraphs to disable extensions
|
||||
// Remember to fix indices: Length of Extensions slice, index in assignment to Extensions
|
||||
Extensions = make([]*tapApi.Extension, 4)
|
||||
ExtensionsMap = make(map[string]*tapApi.Extension)
|
||||
|
||||
|
@@ -149,6 +149,7 @@ type Emitter interface {
|
||||
}
|
||||
|
||||
func (e *Emitting) Emit(item *OutputChannelItem) {
|
||||
// (DEBUG_PERF 6) Comment out to disable emitting from tapper to api-server
|
||||
e.OutputChannel <- item
|
||||
e.AppStats.IncMatchedPairs()
|
||||
}
|
||||
|
@@ -44,6 +44,7 @@ func NewPacketSourceManager(procfs string, filename string, interfaceName string
|
||||
behaviour: behaviour,
|
||||
}
|
||||
|
||||
// (DEBUG_PERF 1) Comment out to disable host pcap (do not pass --tls or --service-mesh)
|
||||
go hostSource.readPackets(ipdefrag, packets)
|
||||
return sourceManager, nil
|
||||
}
|
||||
|
@@ -78,6 +78,7 @@ func (a *tcpAssembler) processPackets(dumpPacket bool, packets <-chan source.Tcp
|
||||
logger.Log.Debugf("Packet content (%d/0x%x) - %s", len(data), len(data), hex.Dump(data))
|
||||
}
|
||||
|
||||
// (DEBUG_PERF 2) Comment out to disable assembler
|
||||
tcp := packet.Layer(layers.LayerTypeTCP)
|
||||
if tcp != nil {
|
||||
diagnose.AppStats.IncTcpPacketsCount()
|
||||
|
@@ -55,6 +55,8 @@ func NewTcpReader(msgQueue chan api.TcpReaderDataMsg, progress *api.ReadProgress
|
||||
func (reader *tcpReader) run(options *api.TrafficFilteringOptions, wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
b := bufio.NewReader(reader)
|
||||
// (DEBUG_PERF 4) Swap with next line to disable dissectors
|
||||
// _, _ = io.ReadAll(b)
|
||||
err := reader.extension.Dissector.Dissect(b, reader, options)
|
||||
if err != nil {
|
||||
_, err = io.Copy(ioutil.Discard, reader)
|
||||
|
@@ -132,6 +132,7 @@ func (t *tcpStream) GetReqResMatchers() []api.RequestResponseMatcher {
|
||||
}
|
||||
|
||||
func (t *tcpStream) GetIsTapTarget() bool {
|
||||
// (DEBUG_PERF 3) Return false to disable Dissecting
|
||||
return t.isTapTarget
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user