mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-05 06:23:23 +00:00
Fix the Kafka ApiKey
query and add ApiKeyName
field (human-readable ApiKey
) (#1080)
* Fix the Kafka `ApiKey` query and add `ApiKeyName` field (human-readable `ApiKey`) * Update the dataset for Kafka unit tests * #run_acceptance_tests
This commit is contained in:
parent
09a0fca2c2
commit
5fc3e38c1a
@ -13,4 +13,4 @@ test-pull-bin:
|
|||||||
|
|
||||||
test-pull-expect:
|
test-pull-expect:
|
||||||
@mkdir -p expect
|
@mkdir -p expect
|
||||||
@[ "${skipexpect}" ] && echo "Skipping downloading expected JSONs" || gsutil -o 'GSUtil:parallel_process_count=5' -o 'GSUtil:parallel_thread_count=5' -m cp -r gs://static.up9.io/mizu/test-pcap/expect8/kafka/\* expect
|
@[ "${skipexpect}" ] && echo "Skipping downloading expected JSONs" || gsutil -o 'GSUtil:parallel_process_count=5' -o 'GSUtil:parallel_thread_count=5' -m cp -r gs://static.up9.io/mizu/test-pcap/expect9/kafka/\* expect
|
||||||
|
@ -3,13 +3,14 @@ package kafka
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang.org/x/text/cases"
|
|
||||||
"golang.org/x/text/language"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/text/cases"
|
||||||
|
"golang.org/x/text/language"
|
||||||
|
|
||||||
"github.com/fatih/camelcase"
|
"github.com/fatih/camelcase"
|
||||||
"github.com/ohler55/ojg/jp"
|
"github.com/ohler55/ojg/jp"
|
||||||
"github.com/ohler55/ojg/oj"
|
"github.com/ohler55/ojg/oj"
|
||||||
@ -36,9 +37,14 @@ type KafkaWrapper struct {
|
|||||||
|
|
||||||
func representRequestHeader(data map[string]interface{}, rep []interface{}) []interface{} {
|
func representRequestHeader(data map[string]interface{}, rep []interface{}) []interface{} {
|
||||||
requestHeader, _ := json.Marshal([]api.TableData{
|
requestHeader, _ := json.Marshal([]api.TableData{
|
||||||
|
{
|
||||||
|
Name: "ApiKeyName",
|
||||||
|
Value: data["apiKeyName"].(string),
|
||||||
|
Selector: `request.apiKeyName`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "ApiKey",
|
Name: "ApiKey",
|
||||||
Value: apiNames[int(data["apiKey"].(float64))],
|
Value: int(data["apiKey"].(float64)),
|
||||||
Selector: `request.apiKey`,
|
Selector: `request.apiKey`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -96,8 +96,8 @@ func (d dissecting) Summarize(entry *api.Entry) *api.BaseEntry {
|
|||||||
statusQuery := ""
|
statusQuery := ""
|
||||||
|
|
||||||
apiKey := ApiKey(entry.Request["apiKey"].(float64))
|
apiKey := ApiKey(entry.Request["apiKey"].(float64))
|
||||||
method := apiNames[apiKey]
|
method := entry.Request["apiKeyName"].(string)
|
||||||
methodQuery := fmt.Sprintf("request.apiKey == %d", int(entry.Request["apiKey"].(float64)))
|
methodQuery := fmt.Sprintf(`request.apiKeyName == "%s"`, method)
|
||||||
|
|
||||||
summary := ""
|
summary := ""
|
||||||
summaryQuery := ""
|
summaryQuery := ""
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
type Request struct {
|
type Request struct {
|
||||||
Size int32 `json:"size"`
|
Size int32 `json:"size"`
|
||||||
|
ApiKeyName string `json:"apiKeyName"`
|
||||||
ApiKey ApiKey `json:"apiKey"`
|
ApiKey ApiKey `json:"apiKey"`
|
||||||
ApiVersion int16 `json:"apiVersion"`
|
ApiVersion int16 `json:"apiVersion"`
|
||||||
CorrelationID int32 `json:"correlationID"`
|
CorrelationID int32 `json:"correlationID"`
|
||||||
@ -202,6 +203,7 @@ func ReadRequest(r io.Reader, tcpID *api.TcpID, counterPair *api.CounterPair, ca
|
|||||||
|
|
||||||
request := &Request{
|
request := &Request{
|
||||||
Size: size,
|
Size: size,
|
||||||
|
ApiKeyName: apiNames[apiKey],
|
||||||
ApiKey: apiKey,
|
ApiKey: apiKey,
|
||||||
ApiVersion: apiVersion,
|
ApiVersion: apiVersion,
|
||||||
CorrelationID: correlationID,
|
CorrelationID: correlationID,
|
||||||
|
Loading…
Reference in New Issue
Block a user