mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-17 16:08:12 +00:00
Remove gRPC related modifications (#958)
* Remove gRPC related modifications * Remove gRPC status text related modifications as well * Fixing gRPC vertical image detect grpc when content type is 'application/grpc' as well (and not only from the grpc-status) Co-authored-by: gadotroee <55343099+gadotroee@users.noreply.github.com>
This commit is contained in:
parent
cf5c03d45c
commit
6575495fa5
@ -28,26 +28,6 @@ const protoMinorHTTP2 = 0
|
|||||||
|
|
||||||
var maxHTTP2DataLen = 1 * 1024 * 1024 // 1MB
|
var maxHTTP2DataLen = 1 * 1024 * 1024 // 1MB
|
||||||
|
|
||||||
var grpcStatusCodes = []string{
|
|
||||||
"OK",
|
|
||||||
"CANCELLED",
|
|
||||||
"UNKNOWN",
|
|
||||||
"INVALID_ARGUMENT",
|
|
||||||
"DEADLINE_EXCEEDED",
|
|
||||||
"NOT_FOUND",
|
|
||||||
"ALREADY_EXISTS",
|
|
||||||
"PERMISSION_DENIED",
|
|
||||||
"RESOURCE_EXHAUSTED",
|
|
||||||
"FAILED_PRECONDITION",
|
|
||||||
"ABORTED",
|
|
||||||
"OUT_OF_RANGE",
|
|
||||||
"UNIMPLEMENTED",
|
|
||||||
"INTERNAL",
|
|
||||||
"UNAVAILABLE",
|
|
||||||
"DATA_LOSS",
|
|
||||||
"UNAUTHENTICATED",
|
|
||||||
}
|
|
||||||
|
|
||||||
type messageFragment struct {
|
type messageFragment struct {
|
||||||
headers []hpack.HeaderField
|
headers []hpack.HeaderField
|
||||||
data []byte
|
data []byte
|
||||||
@ -142,18 +122,8 @@ func (ga *Http2Assembler) readMessage() (streamID uint32, messageHTTP1 interface
|
|||||||
|
|
||||||
// gRPC detection
|
// gRPC detection
|
||||||
grpcStatus := headersHTTP1.Get("Grpc-Status")
|
grpcStatus := headersHTTP1.Get("Grpc-Status")
|
||||||
if grpcStatus != "" {
|
if grpcStatus != "" || strings.Contains(headersHTTP1.Get("Content-Type"), "application/grpc") {
|
||||||
isGrpc = true
|
isGrpc = true
|
||||||
status = grpcStatus
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.Contains(headersHTTP1.Get("Content-Type"), "application/grpc") {
|
|
||||||
isGrpc = true
|
|
||||||
grpcPath := headersHTTP1.Get(":path")
|
|
||||||
pathSegments := strings.Split(grpcPath, "/")
|
|
||||||
if len(pathSegments) > 0 {
|
|
||||||
method = pathSegments[len(pathSegments)-1]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if method != "" {
|
if method != "" {
|
||||||
|
@ -248,11 +248,6 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
|
|||||||
reqDetails["_queryStringMerged"] = mapSliceMergeRepeatedKeys(reqDetails["_queryString"].([]interface{}))
|
reqDetails["_queryStringMerged"] = mapSliceMergeRepeatedKeys(reqDetails["_queryString"].([]interface{}))
|
||||||
reqDetails["queryString"] = mapSliceRebuildAsMap(reqDetails["_queryStringMerged"].([]interface{}))
|
reqDetails["queryString"] = mapSliceRebuildAsMap(reqDetails["_queryStringMerged"].([]interface{}))
|
||||||
|
|
||||||
statusCode := int(resDetails["status"].(float64))
|
|
||||||
if item.Protocol.Abbreviation == "gRPC" {
|
|
||||||
resDetails["statusText"] = grpcStatusCodes[statusCode]
|
|
||||||
}
|
|
||||||
|
|
||||||
elapsedTime := item.Pair.Response.CaptureTime.Sub(item.Pair.Request.CaptureTime).Round(time.Millisecond).Milliseconds()
|
elapsedTime := item.Pair.Response.CaptureTime.Sub(item.Pair.Request.CaptureTime).Round(time.Millisecond).Milliseconds()
|
||||||
if elapsedTime < 0 {
|
if elapsedTime < 0 {
|
||||||
elapsedTime = 0
|
elapsedTime = 0
|
||||||
|
@ -37,9 +37,9 @@ export function getClassification(statusCode: number): string {
|
|||||||
|
|
||||||
// 1 - 16 HTTP/2 (gRPC) status codes
|
// 1 - 16 HTTP/2 (gRPC) status codes
|
||||||
// 2xx - 5xx HTTP/1.x status codes
|
// 2xx - 5xx HTTP/1.x status codes
|
||||||
if ((statusCode >= 200 && statusCode <= 399) || statusCode === 0) {
|
if (statusCode >= 200 && statusCode <= 399) {
|
||||||
classification = StatusCodeClassification.SUCCESS;
|
classification = StatusCodeClassification.SUCCESS;
|
||||||
} else if (statusCode >= 400 || (statusCode >= 1 && statusCode <= 16)) {
|
} else if (statusCode >= 400) {
|
||||||
classification = StatusCodeClassification.FAILURE;
|
classification = StatusCodeClassification.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user