Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POA-155] Changes for capturing client and server timeouts #201

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions akinet/net_traffic.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,30 @@ func (tls *TLSHandshakeMetadata) ApplicationLatencyMeasurable() bool {
return *tls.SelectedProtocol == "http/1.1"
}

// Represents the content when a TCP connection is closed by the client.
type ClientTimeoutMetadata struct {
shreys7 marked this conversation as resolved.
Show resolved Hide resolved
// StreamID and Seq uniquely identify a pair of request and response.
StreamID uuid.UUID
Seq int
}

var _ ParsedNetworkContent = (*ClientTimeoutMetadata)(nil)

func (ClientTimeoutMetadata) implParsedNetworkContent() {}
func (ClientTimeoutMetadata) ReleaseBuffers() {}

// Represents the content when a TCP connection is closed by the server.
type ServerTimeoutMetadata struct {
// StreamID and Seq uniquely identify a pair of request and response.
StreamID uuid.UUID
Seq int
}

var _ ParsedNetworkContent = (*ServerTimeoutMetadata)(nil)

func (ServerTimeoutMetadata) implParsedNetworkContent() {}
func (ServerTimeoutMetadata) ReleaseBuffers() {}

// Represents an observed HTTP/2 connection preface; no data from it
// is stored.
type HTTP2ConnectionPreface struct {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/OneOfOne/xxhash v1.2.8
github.com/akitasoftware/akita-ir v0.0.0-20220630210013-8926783978fe
github.com/akitasoftware/akita-ir v0.0.0-20231103112405-e2221503d639 // todo: update this to match the commit on master once akita-ir#10 is merged
github.com/akitasoftware/go-utils v0.0.0-20221207014235-6f4c9079488d
github.com/akitasoftware/objecthash-proto v0.0.0-20211020004800-9990a7ea5dc0
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8
github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
github.com/akitasoftware/akita-ir v0.0.0-20220630210013-8926783978fe h1:0BeBDjLDFPwv2bkk6YuRAPf1r6U4Wby98NHI9+Lddvs=
github.com/akitasoftware/akita-ir v0.0.0-20220630210013-8926783978fe/go.mod h1:WEWPzhZtxlJnov3MxcqSDiZaHHf00vs3aJwCdt3OwzA=
github.com/akitasoftware/akita-ir v0.0.0-20231102193917-8b96486d4377 h1:AaUu5pd9GnOZptkkhoFrWJUivv+2+s/zmKHVOGItsrg=
github.com/akitasoftware/akita-ir v0.0.0-20231102193917-8b96486d4377/go.mod h1:WEWPzhZtxlJnov3MxcqSDiZaHHf00vs3aJwCdt3OwzA=
github.com/akitasoftware/akita-ir v0.0.0-20231103112405-e2221503d639 h1:hIWGdk/RJGbvfLA2pODQLn8lAygHXEQLZN3VuIrkCHU=
github.com/akitasoftware/akita-ir v0.0.0-20231103112405-e2221503d639/go.mod h1:WEWPzhZtxlJnov3MxcqSDiZaHHf00vs3aJwCdt3OwzA=
github.com/akitasoftware/go-utils v0.0.0-20221207014235-6f4c9079488d h1:pN1dbNacZ/mvlU1NcJVDxqmKnrDQDTVaN6iKOarfdYM=
github.com/akitasoftware/go-utils v0.0.0-20221207014235-6f4c9079488d/go.mod h1:+IOXf7l/QCAQECJzjJwhTp1sBkRoJ6WciZwJezUwBa4=
github.com/akitasoftware/gopacket v1.1.18-0.20210730205736-879e93dac35b h1:toBhS5rhCjo/N4YZ1cYtlsdSTGjMFH+gbJGCc+OmZiY=
Expand Down
1 change: 1 addition & 0 deletions spec_util/ir_hash/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func main() {
gf.AddHashFunc(reflect.TypeOf(pb.HTTPHeader{}))
gf.AddHashFunc(reflect.TypeOf(pb.HTTPMeta{}))
gf.AddHashFunc(reflect.TypeOf(pb.HTTPMethodMeta{}))
gf.AddHashFunc(reflect.TypeOf(pb.HTTPMethodError{}))
gf.AddHashFunc(reflect.TypeOf(pb.HTTPMultipart{}))
gf.AddHashFunc(reflect.TypeOf(pb.HTTPPath{}))
gf.AddHashFunc(reflect.TypeOf(pb.HTTPQuery{}))
Expand Down
24 changes: 23 additions & 1 deletion spec_util/ir_hash/generated_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,19 @@ func HashHTTPMethodMeta(node *pb.HTTPMethodMeta) []byte {
}
return hash.Sum(nil)
}
func HashHTTPMethodError(node *pb.HTTPMethodError) []byte {
hash := xxhash.New64()
hash.Write([]byte("d"))
if node.Type != 0 {
hash.Write(intHashes[1])
hash.Write(Hash_Int32(int32(node.Type)))
}
if node.Message != "" {
hash.Write(intHashes[2])
hash.Write(Hash_Unicode(node.Message))
}
return hash.Sum(nil)
}
func HashHTTPMultipart(node *pb.HTTPMultipart) []byte {
hash := xxhash.New64()
hash.Write([]byte("d"))
Expand Down Expand Up @@ -621,6 +634,15 @@ func HashMethodMeta(node *pb.MethodMeta) []byte {
hash.Write(intHashes[2])
hash.Write(HashHTTPMethodMeta(val.Http))
}
if len(node.Errors) != 0 {
hash.Write(intHashes[3])
listHash := xxhash.New64()
listHash.Write([]byte("l"))
for _, v := range node.Errors {
listHash.Write(HashHTTPMethodError(v))
}
hash.Write(listHash.Sum(nil))
}
return hash.Sum(nil)
}
func HashNone(node *pb.None) []byte {
Expand Down Expand Up @@ -897,4 +919,4 @@ func HashWitness(node *pb.Witness) []byte {
return hash.Sum(nil)
}

var ProtobufFileHashes map[string][]byte = map[string][]byte{"method.proto": []byte{69, 16, 236, 176, 97, 180, 164, 70}, "witness.proto": []byte{42, 213, 185, 25, 124, 226, 76, 187}, "types.proto": []byte{98, 84, 34, 180, 249, 140, 214, 227}, "spec.proto": []byte{13, 101, 129, 126, 232, 252, 1, 146}}
var ProtobufFileHashes map[string][]byte = map[string][]byte{"method.proto": []byte{177, 245, 189, 217, 244, 231, 2, 63}, "witness.proto": []byte{42, 213, 185, 25, 124, 226, 76, 187}, "types.proto": []byte{98, 84, 34, 180, 249, 140, 214, 227}, "spec.proto": []byte{13, 101, 129, 126, 232, 252, 1, 146}}