From 026bec814bdf5ad3d08bca97e9e65b2bd0b4970e Mon Sep 17 00:00:00 2001 From: Andrew Wilkins Date: Wed, 2 Aug 2023 11:07:37 +0800 Subject: [PATCH] Generate agggregationpb key hash functions Generate key hashing functions in an internal package, and remove the Hasher type. This will ensure the hash functions stay in sync, and will enable us to split up the aggregators package into subpackages. Also, remove global labels from ServiceAggregationKey. --- Makefile | 1 + aggregationpb/aggregation.pb.go | 462 +++++++++--------- aggregationpb/aggregation_vtproto.pb.go | 52 -- aggregators/combined_metrics_test.go | 89 ++-- aggregators/converter.go | 32 +- aggregators/hasher.go | 37 -- aggregators/hasher_test.go | 31 -- aggregators/internal/protohash/doc.go | 9 + .../internal/protohash/generate/main.go | 118 +++++ .../internal/protohash/generated.go | 41 +- aggregators/merger.go | 62 +-- aggregators/partitioner.go | 24 - go.mod | 2 + go.sum | 4 + proto/aggregation.proto | 1 - 15 files changed, 485 insertions(+), 480 deletions(-) delete mode 100644 aggregators/hasher.go delete mode 100644 aggregators/hasher_test.go create mode 100644 aggregators/internal/protohash/doc.go create mode 100644 aggregators/internal/protohash/generate/main.go rename aggregationpb/hash.go => aggregators/internal/protohash/generated.go (63%) delete mode 100644 aggregators/partitioner.go diff --git a/Makefile b/Makefile index e6b7bce..d479afa 100644 --- a/Makefile +++ b/Makefile @@ -47,4 +47,5 @@ gen-proto: $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_VTPROTO) $(PROTOC) --go-vtproto_opt=features=marshal+unmarshal+size+pool+clone \ $(PROTOC_VT_STRUCTS) \ $(wildcard proto/*.proto) + go generate ./aggregators/internal/protohash $(MAKE) fmt diff --git a/aggregationpb/aggregation.pb.go b/aggregationpb/aggregation.pb.go index 0a74387..ae6880c 100644 --- a/aggregationpb/aggregation.pb.go +++ b/aggregationpb/aggregation.pb.go @@ -169,7 +169,6 @@ type ServiceAggregationKey struct { ServiceEnvironment string `protobuf:"bytes,3,opt,name=service_environment,json=serviceEnvironment,proto3" json:"service_environment,omitempty"` ServiceLanguageName string `protobuf:"bytes,4,opt,name=service_language_name,json=serviceLanguageName,proto3" json:"service_language_name,omitempty"` AgentName string `protobuf:"bytes,5,opt,name=agent_name,json=agentName,proto3" json:"agent_name,omitempty"` - GlobalLabelsStr []byte `protobuf:"bytes,6,opt,name=global_labels_str,json=globalLabelsStr,proto3" json:"global_labels_str,omitempty"` } func (x *ServiceAggregationKey) Reset() { @@ -239,13 +238,6 @@ func (x *ServiceAggregationKey) GetAgentName() string { return "" } -func (x *ServiceAggregationKey) GetGlobalLabelsStr() []byte { - if x != nil { - return x.GlobalLabelsStr - } - return nil -} - type ServiceMetrics struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1393,7 +1385,7 @@ var file_proto_aggregation_proto_rawDesc = []byte{ 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x35, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x88, 0x02, 0x0a, + 0x69, 0x63, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0xdc, 0x01, 0x0a, 0x15, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, @@ -1407,239 +1399,237 @@ var file_proto_aggregation_proto_rawDesc = []byte{ 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x67, - 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x5f, 0x73, 0x74, 0x72, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x73, 0x53, 0x74, 0x72, 0x22, 0xb4, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x62, 0x0a, 0x18, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x65, - 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x65, 0x64, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x16, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x3e, - 0x0a, 0x0f, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, - 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x0e, - 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x22, 0x4b, - 0x0a, 0x1d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, - 0x2a, 0x0a, 0x11, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, - 0x5f, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x67, 0x6c, 0x6f, 0x62, - 0x61, 0x6c, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x53, 0x74, 0x72, 0x22, 0x9e, 0x02, 0x0a, 0x16, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x55, 0x0a, 0x13, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, - 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x6b, 0x0a, - 0x1b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, - 0x2e, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, - 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, - 0x19, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x40, 0x0a, 0x0c, 0x73, 0x70, - 0x61, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1d, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x4b, - 0x65, 0x79, 0x65, 0x64, 0x53, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, - 0x0b, 0x73, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x9a, 0x01, 0x0a, - 0x1b, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x3c, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x65, 0x6c, 0x61, 0x73, - 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3d, 0x0a, 0x07, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x65, 0x6c, - 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, - 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x17, 0x4b, 0x65, - 0x79, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x38, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, - 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x67, 0x67, 0x72, - 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x39, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1f, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x54, + 0x52, 0x09, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xb4, 0x01, 0x0a, 0x0e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x62, + 0x0a, 0x18, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, + 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x4b, + 0x65, 0x79, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x16, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x73, 0x12, 0x3e, 0x0a, 0x0f, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x65, 0x6c, + 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x66, 0x6c, + 0x6f, 0x77, 0x52, 0x0e, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x73, 0x22, 0x4b, 0x0a, 0x1d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x4b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x11, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x6c, 0x61, + 0x62, 0x65, 0x6c, 0x73, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, + 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x53, 0x74, 0x72, 0x22, + 0x9e, 0x02, 0x0a, 0x16, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x55, 0x0a, 0x13, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, + 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x73, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0xd6, 0x09, 0x0a, 0x19, 0x54, - 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x63, - 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x74, 0x72, - 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x61, - 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, - 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x6b, 0x75, - 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x5f, 0x70, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x65, 0x73, 0x50, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, - 0x6f, 0x64, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x30, 0x0a, 0x14, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x72, 0x75, 0x6e, 0x74, 0x69, - 0x6d, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x36, 0x0a, 0x17, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x72, 0x75, 0x6e, - 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x15, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x75, 0x6e, 0x74, 0x69, - 0x6d, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, 0x18, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x68, 0x6f, 0x73, 0x74, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x68, 0x6f, 0x73, 0x74, - 0x48, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x6f, 0x73, 0x74, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, - 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6f, 0x73, - 0x5f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0e, 0x68, 0x6f, 0x73, 0x74, 0x4f, 0x73, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, - 0x23, 0x0a, 0x0d, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, - 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4f, 0x75, 0x74, - 0x63, 0x6f, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x29, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x12, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x66, 0x61, 0x61, - 0x73, 0x5f, 0x63, 0x6f, 0x6c, 0x64, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, - 0x0d, 0x52, 0x0d, 0x66, 0x61, 0x61, 0x73, 0x43, 0x6f, 0x6c, 0x64, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x12, 0x17, 0x0a, 0x07, 0x66, 0x61, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x66, 0x61, 0x61, 0x73, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x61, 0x61, - 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x61, - 0x61, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x61, 0x61, 0x73, 0x5f, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x61, - 0x61, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x11, 0x66, 0x61, 0x61, - 0x73, 0x5f, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x14, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x66, 0x61, 0x61, 0x73, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, - 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x70, - 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, - 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, - 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x18, 0x16, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x12, - 0x36, 0x0a, 0x17, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, - 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x17, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x15, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x5a, 0x6f, 0x6e, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6c, 0x6f, 0x75, 0x64, - 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x18, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x61, - 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x19, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x64, 0x12, - 0x2c, 0x0a, 0x12, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6c, 0x6f, - 0x75, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, - 0x12, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, - 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x63, - 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, - 0x1c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x1d, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4e, - 0x61, 0x6d, 0x65, 0x22, 0x4d, 0x0a, 0x12, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x73, 0x12, 0x6b, 0x0a, 0x1b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, + 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x73, 0x52, 0x19, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x40, + 0x0a, 0x0c, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, + 0x70, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x73, 0x52, 0x0b, 0x73, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, + 0x22, 0x9a, 0x01, 0x0a, 0x1b, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, + 0x12, 0x3c, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41, 0x67, 0x67, 0x72, 0x65, + 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3d, + 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x23, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x8e, 0x01, + 0x0a, 0x17, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x38, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, + 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x39, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, + 0x70, 0x6d, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0xd6, + 0x09, 0x0a, 0x19, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x67, + 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, + 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x09, 0x74, 0x72, 0x61, 0x63, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x63, + 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2e, + 0x0a, 0x13, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x5f, 0x70, 0x6f, 0x64, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6b, 0x75, 0x62, + 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x50, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, + 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x72, + 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x75, 0x6e, 0x74, 0x69, 0x6d, + 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x5f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, + 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x38, 0x0a, + 0x18, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, + 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x16, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x68, 0x6f, 0x73, 0x74, 0x5f, + 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x68, 0x6f, 0x73, 0x74, 0x48, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x68, 0x6f, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x68, 0x6f, 0x73, + 0x74, 0x5f, 0x6f, 0x73, 0x5f, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x68, 0x6f, 0x73, 0x74, 0x4f, 0x73, 0x50, 0x6c, 0x61, 0x74, 0x66, + 0x6f, 0x72, 0x6d, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6f, 0x75, 0x74, + 0x63, 0x6f, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x76, 0x65, 0x6e, + 0x74, 0x4f, 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0d, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2d, + 0x0a, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, + 0x73, 0x75, 0x6c, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x25, 0x0a, + 0x0e, 0x66, 0x61, 0x61, 0x73, 0x5f, 0x63, 0x6f, 0x6c, 0x64, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0d, 0x66, 0x61, 0x61, 0x73, 0x43, 0x6f, 0x6c, 0x64, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x61, 0x61, 0x73, 0x5f, 0x69, 0x64, 0x18, + 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x61, 0x61, 0x73, 0x49, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x66, 0x61, 0x61, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x66, 0x61, 0x61, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x61, + 0x61, 0x73, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x66, 0x61, 0x61, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2a, 0x0a, + 0x11, 0x66, 0x61, 0x61, 0x73, 0x5f, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x5f, 0x74, 0x79, + 0x70, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x66, 0x61, 0x61, 0x73, 0x54, 0x72, + 0x69, 0x67, 0x67, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x15, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, + 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, + 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x52, 0x65, 0x67, + 0x69, 0x6f, 0x6e, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x61, 0x76, 0x61, + 0x69, 0x6c, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x17, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x41, 0x76, 0x61, 0x69, 0x6c, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5a, 0x6f, 0x6e, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x63, + 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x19, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x61, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x6d, 0x61, 0x63, 0x68, 0x69, + 0x6e, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, + 0x6c, 0x6f, 0x75, 0x64, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x28, 0x0a, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x5f, 0x69, 0x64, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6c, 0x6f, 0x75, 0x64, + 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x6c, 0x6f, + 0x75, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x1d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x50, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x4d, 0x0a, 0x12, 0x54, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x37, 0x0a, + 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x48, + 0x44, 0x52, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x52, 0x09, 0x68, 0x69, 0x73, + 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x22, 0xa3, 0x01, 0x0a, 0x1e, 0x4b, 0x65, 0x79, 0x65, 0x64, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, + 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x40, 0x0a, 0x07, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x65, 0x6c, + 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x4d, 0x0a, 0x20, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, + 0x12, 0x29, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x19, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x37, 0x0a, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x48, 0x44, 0x52, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x52, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, - 0x61, 0x6d, 0x22, 0xa3, 0x01, 0x0a, 0x1e, 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x3f, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, - 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, - 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x40, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, - 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, - 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, - 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x4d, 0x0a, 0x20, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x67, - 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x29, 0x0a, 0x10, - 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x19, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x37, 0x0a, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, - 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, - 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x48, 0x44, 0x52, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x67, - 0x72, 0x61, 0x6d, 0x52, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x12, 0x23, - 0x0a, 0x0d, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, 0x73, 0x75, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x79, 0x0a, 0x10, 0x4b, 0x65, 0x79, 0x65, - 0x64, 0x53, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x31, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x65, 0x6c, 0x61, 0x73, - 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x41, 0x67, 0x67, 0x72, - 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, - 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x22, 0xa9, 0x01, 0x0a, 0x12, 0x53, 0x70, 0x61, 0x6e, 0x41, 0x67, 0x67, 0x72, - 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x70, - 0x61, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, - 0x70, 0x61, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x63, 0x6f, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x63, 0x6f, 0x6d, - 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, - 0x35, 0x0a, 0x0b, 0x53, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x01, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x22, 0xe6, 0x03, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x66, - 0x6c, 0x6f, 0x77, 0x12, 0x54, 0x0a, 0x15, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, - 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, - 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x52, 0x14, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x72, 0x61, - 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x6a, 0x0a, 0x1d, 0x6f, 0x76, 0x65, - 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x26, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x1b, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, - 0x6f, 0x77, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3f, 0x0a, 0x0e, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, - 0x77, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, + 0x61, 0x6d, 0x12, 0x23, 0x0a, 0x0d, 0x66, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, 0x66, 0x61, 0x69, 0x6c, 0x75, + 0x72, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x75, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, + 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x79, 0x0a, 0x10, + 0x4b, 0x65, 0x79, 0x65, 0x64, 0x53, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, + 0x12, 0x31, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x53, 0x70, 0x61, 0x6e, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x0d, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, - 0x77, 0x53, 0x70, 0x61, 0x6e, 0x73, 0x12, 0x46, 0x0a, 0x1f, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, - 0x6f, 0x77, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, - 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x1d, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x55, - 0x0a, 0x27, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x5f, - 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x24, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x73, 0x74, 0x69, - 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x18, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, - 0x77, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, - 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, - 0x77, 0x53, 0x70, 0x61, 0x6e, 0x73, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x22, - 0xdf, 0x01, 0x0a, 0x0c, 0x48, 0x44, 0x52, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, - 0x12, 0x34, 0x0a, 0x16, 0x6c, 0x6f, 0x77, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, - 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x14, 0x6c, 0x6f, 0x77, 0x65, 0x73, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, - 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, - 0x74, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x68, 0x69, 0x67, 0x68, 0x65, 0x73, 0x74, - 0x54, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2f, - 0x0a, 0x13, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, 0x74, 0x5f, 0x66, 0x69, - 0x67, 0x75, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x73, 0x69, 0x67, - 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, 0x74, 0x46, 0x69, 0x67, 0x75, 0x72, 0x65, 0x73, 0x12, - 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x03, 0x52, - 0x06, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, - 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, - 0x73, 0x42, 0x13, 0x48, 0x01, 0x5a, 0x0f, 0x2e, 0x2f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, + 0x70, 0x6d, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x07, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0xa9, 0x01, 0x0a, 0x12, 0x53, 0x70, 0x61, 0x6e, + 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x1b, + 0x0a, 0x09, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x73, 0x70, 0x61, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6f, + 0x75, 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x75, + 0x74, 0x63, 0x6f, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x22, 0x35, 0x0a, 0x0b, 0x53, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x01, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x75, 0x6d, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x73, 0x75, 0x6d, 0x22, 0xe6, 0x03, 0x0a, 0x08, 0x4f, + 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x54, 0x0a, 0x15, 0x6f, 0x76, 0x65, 0x72, 0x66, + 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, + 0x2e, 0x61, 0x70, 0x6d, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x14, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, + 0x77, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x6a, 0x0a, + 0x1d, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, + 0x70, 0x6d, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x1b, 0x6f, 0x76, + 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3f, 0x0a, 0x0e, 0x6f, 0x76, 0x65, + 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x18, 0x2e, 0x65, 0x6c, 0x61, 0x73, 0x74, 0x69, 0x63, 0x2e, 0x61, 0x70, 0x6d, 0x2e, + 0x53, 0x70, 0x61, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x0d, 0x6f, 0x76, 0x65, + 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x70, 0x61, 0x6e, 0x73, 0x12, 0x46, 0x0a, 0x1f, 0x6f, 0x76, + 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x1d, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, + 0x6f, 0x72, 0x12, 0x55, 0x0a, 0x27, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x5f, 0x65, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x24, 0x6f, 0x76, 0x65, 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x38, 0x0a, 0x18, 0x6f, 0x76, 0x65, + 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x5f, 0x65, 0x73, 0x74, 0x69, + 0x6d, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x6f, 0x76, 0x65, + 0x72, 0x66, 0x6c, 0x6f, 0x77, 0x53, 0x70, 0x61, 0x6e, 0x73, 0x45, 0x73, 0x74, 0x69, 0x6d, 0x61, + 0x74, 0x6f, 0x72, 0x22, 0xdf, 0x01, 0x0a, 0x0c, 0x48, 0x44, 0x52, 0x48, 0x69, 0x73, 0x74, 0x6f, + 0x67, 0x72, 0x61, 0x6d, 0x12, 0x34, 0x0a, 0x16, 0x6c, 0x6f, 0x77, 0x65, 0x73, 0x74, 0x5f, 0x74, + 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x6c, 0x6f, 0x77, 0x65, 0x73, 0x74, 0x54, 0x72, 0x61, 0x63, + 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x68, 0x69, + 0x67, 0x68, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x68, 0x69, 0x67, + 0x68, 0x65, 0x73, 0x74, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, + 0x74, 0x5f, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x12, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x66, 0x69, 0x63, 0x61, 0x6e, 0x74, 0x46, 0x69, 0x67, 0x75, + 0x72, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, + 0x03, 0x28, 0x03, 0x52, 0x06, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x62, + 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x62, 0x75, + 0x63, 0x6b, 0x65, 0x74, 0x73, 0x42, 0x13, 0x48, 0x01, 0x5a, 0x0f, 0x2e, 0x2f, 0x61, 0x67, 0x67, + 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/aggregationpb/aggregation_vtproto.pb.go b/aggregationpb/aggregation_vtproto.pb.go index 70c8565..8bf6d1a 100644 --- a/aggregationpb/aggregation_vtproto.pb.go +++ b/aggregationpb/aggregation_vtproto.pb.go @@ -89,11 +89,6 @@ func (m *ServiceAggregationKey) CloneVT() *ServiceAggregationKey { ServiceLanguageName: m.ServiceLanguageName, AgentName: m.AgentName, } - if rhs := m.GlobalLabelsStr; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.GlobalLabelsStr = tmpBytes - } if len(m.unknownFields) > 0 { r.unknownFields = make([]byte, len(m.unknownFields)) copy(r.unknownFields, m.unknownFields) @@ -628,13 +623,6 @@ func (m *ServiceAggregationKey) MarshalToSizedBufferVT(dAtA []byte) (int, error) i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } - if len(m.GlobalLabelsStr) > 0 { - i -= len(m.GlobalLabelsStr) - copy(dAtA[i:], m.GlobalLabelsStr) - i = encodeVarint(dAtA, i, uint64(len(m.GlobalLabelsStr))) - i-- - dAtA[i] = 0x32 - } if len(m.AgentName) > 0 { i -= len(m.AgentName) copy(dAtA[i:], m.AgentName) @@ -1805,9 +1793,7 @@ var vtprotoPool_ServiceAggregationKey = sync.Pool{ } func (m *ServiceAggregationKey) ResetVT() { - f0 := m.GlobalLabelsStr[:0] m.Reset() - m.GlobalLabelsStr = f0 } func (m *ServiceAggregationKey) ReturnToVTPool() { if m != nil { @@ -2226,10 +2212,6 @@ func (m *ServiceAggregationKey) SizeVT() (n int) { if l > 0 { n += 1 + l + sov(uint64(l)) } - l = len(m.GlobalLabelsStr) - if l > 0 { - n += 1 + l + sov(uint64(l)) - } n += len(m.unknownFields) return n } @@ -3150,40 +3132,6 @@ func (m *ServiceAggregationKey) UnmarshalVT(dAtA []byte) error { } m.AgentName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalLabelsStr", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GlobalLabelsStr = append(m.GlobalLabelsStr[:0], dAtA[iNdEx:postIndex]...) - if m.GlobalLabelsStr == nil { - m.GlobalLabelsStr = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) diff --git a/aggregators/combined_metrics_test.go b/aggregators/combined_metrics_test.go index e3b1240..c7776ef 100644 --- a/aggregators/combined_metrics_test.go +++ b/aggregators/combined_metrics_test.go @@ -7,11 +7,13 @@ package aggregators import ( "time" + "github.com/cespare/xxhash/v2" "github.com/google/go-cmp/cmp" "google.golang.org/protobuf/testing/protocmp" "github.com/elastic/apm-aggregation/aggregationpb" "github.com/elastic/apm-aggregation/aggregators/internal/hdrhistogram" + "github.com/elastic/apm-aggregation/aggregators/internal/protohash" "github.com/elastic/apm-aggregation/aggregators/internal/timestamppb" ) @@ -192,11 +194,11 @@ func (tsm *TestServiceMetrics) AddServiceInstanceMetricsOverflow( } } // All service instance overflows to global bucket. - hash := Hasher{}. - Chain(tsm.sk.ToProto()). - Chain(sik.ToProto()). - Sum() - insertHash(&tsm.tcm.OverflowServiceInstancesEstimator, hash) + hash := protohash.HashServiceInstanceAggregationKey( + protohash.HashServiceAggregationKey(xxhash.Digest{}, tsm.sk.ToProto()), + sik.ToProto(), + ) + insertHash(&tsm.tcm.OverflowServiceInstancesEstimator, hash.Sum64()) // Does not save to a map, children of service instance will automatically // overflow to the global overflow bucket. return &TestServiceInstanceMetrics{ @@ -251,18 +253,20 @@ func (tsim *TestServiceInstanceMetrics) AddTransactionOverflow( from := aggregationpb.TransactionMetricsFromVTPool() from.Histogram = histogramToProto(hdr) - hash := Hasher{}. - Chain(tsim.tsm.sk.ToProto()). - Chain(tsim.sik.ToProto()). - Chain(tk.ToProto()). - Sum() + hash := protohash.HashTransactionAggregationKey( + protohash.HashServiceInstanceAggregationKey( + protohash.HashServiceAggregationKey(xxhash.Digest{}, tsim.tsm.sk.ToProto()), + tsim.sik.ToProto(), + ), + tk.ToProto(), + ) if tsim.tsm.overflow { // Global overflow - tsim.tsm.tcm.OverflowServices.OverflowTransaction.Merge(from, hash) + tsim.tsm.tcm.OverflowServices.OverflowTransaction.Merge(from, hash.Sum64()) } else { // Per service overflow svc := tsim.tsm.tcm.Services[tsim.tsm.sk] - svc.OverflowGroups.OverflowTransaction.Merge(from, hash) + svc.OverflowGroups.OverflowTransaction.Merge(from, hash.Sum64()) tsim.tsm.tcm.Services[tsim.tsm.sk] = svc } return tsim @@ -320,18 +324,20 @@ func (tsim *TestServiceInstanceMetrics) AddServiceTransactionOverflow( from.SuccessCount = float64(cfg.count) } - hash := Hasher{}. - Chain(tsim.tsm.sk.ToProto()). - Chain(tsim.sik.ToProto()). - Chain(stk.ToProto()). - Sum() + hash := protohash.HashServiceTransactionAggregationKey( + protohash.HashServiceInstanceAggregationKey( + protohash.HashServiceAggregationKey(xxhash.Digest{}, tsim.tsm.sk.ToProto()), + tsim.sik.ToProto(), + ), + stk.ToProto(), + ) if tsim.tsm.overflow { // Global overflow - tsim.tsm.tcm.OverflowServices.OverflowServiceTransaction.Merge(from, hash) + tsim.tsm.tcm.OverflowServices.OverflowServiceTransaction.Merge(from, hash.Sum64()) } else { // Per service overflow svc := tsim.tsm.tcm.Services[tsim.tsm.sk] - svc.OverflowGroups.OverflowServiceTransaction.Merge(from, hash) + svc.OverflowGroups.OverflowServiceTransaction.Merge(from, hash.Sum64()) tsim.tsm.tcm.Services[tsim.tsm.sk] = svc } return tsim @@ -375,18 +381,20 @@ func (tsim *TestServiceInstanceMetrics) AddSpanOverflow( from.Sum += float64(cfg.duration * time.Duration(cfg.count)) from.Count += float64(cfg.count) - hash := Hasher{}. - Chain(tsim.tsm.sk.ToProto()). - Chain(tsim.sik.ToProto()). - Chain(spk.ToProto()). - Sum() + hash := protohash.HashSpanAggregationKey( + protohash.HashServiceInstanceAggregationKey( + protohash.HashServiceAggregationKey(xxhash.Digest{}, tsim.tsm.sk.ToProto()), + tsim.sik.ToProto(), + ), + spk.ToProto(), + ) if tsim.tsm.overflow { // Global overflow - tsim.tsm.tcm.OverflowServices.OverflowSpan.Merge(from, hash) + tsim.tsm.tcm.OverflowServices.OverflowSpan.Merge(from, hash.Sum64()) } else { // Per service overflow svc := tsim.tsm.tcm.Services[tsim.tsm.sk] - svc.OverflowGroups.OverflowSpan.Merge(from, hash) + svc.OverflowGroups.OverflowSpan.Merge(from, hash.Sum64()) tsim.tsm.tcm.Services[tsim.tsm.sk] = svc } return tsim @@ -404,18 +412,37 @@ func (tsim *TestServiceInstanceMetrics) Get() combinedMetrics { // are not considered. var combinedMetricsSliceSorters = []cmp.Option{ protocmp.SortRepeated(func(a, b *aggregationpb.KeyedServiceMetrics) bool { - return Hasher{}.Chain(a.Key).Sum() < Hasher{}.Chain(b.Key).Sum() + return xxhashDigestLess( + protohash.HashServiceAggregationKey(xxhash.Digest{}, a.Key), + protohash.HashServiceAggregationKey(xxhash.Digest{}, b.Key), + ) }), protocmp.SortRepeated(func(a, b *aggregationpb.KeyedServiceInstanceMetrics) bool { - return Hasher{}.Chain(a.Key).Sum() < Hasher{}.Chain(b.Key).Sum() + return xxhashDigestLess( + protohash.HashServiceInstanceAggregationKey(xxhash.Digest{}, a.Key), + protohash.HashServiceInstanceAggregationKey(xxhash.Digest{}, b.Key), + ) }), protocmp.SortRepeated(func(a, b *aggregationpb.KeyedTransactionMetrics) bool { - return Hasher{}.Chain(a.Key).Sum() < Hasher{}.Chain(b.Key).Sum() + return xxhashDigestLess( + protohash.HashTransactionAggregationKey(xxhash.Digest{}, a.Key), + protohash.HashTransactionAggregationKey(xxhash.Digest{}, b.Key), + ) }), protocmp.SortRepeated(func(a, b *aggregationpb.KeyedServiceTransactionMetrics) bool { - return Hasher{}.Chain(a.Key).Sum() < Hasher{}.Chain(b.Key).Sum() + return xxhashDigestLess( + protohash.HashServiceTransactionAggregationKey(xxhash.Digest{}, a.Key), + protohash.HashServiceTransactionAggregationKey(xxhash.Digest{}, b.Key), + ) }), protocmp.SortRepeated(func(a, b *aggregationpb.KeyedSpanMetrics) bool { - return Hasher{}.Chain(a.Key).Sum() < Hasher{}.Chain(b.Key).Sum() + return xxhashDigestLess( + protohash.HashSpanAggregationKey(xxhash.Digest{}, a.Key), + protohash.HashSpanAggregationKey(xxhash.Digest{}, b.Key), + ) }), } + +func xxhashDigestLess(a, b xxhash.Digest) bool { + return a.Sum64() < b.Sum64() +} diff --git a/aggregators/converter.go b/aggregators/converter.go index 3ccbb3c..14737f7 100644 --- a/aggregators/converter.go +++ b/aggregators/converter.go @@ -14,8 +14,11 @@ import ( "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/timestamppb" + "github.com/cespare/xxhash/v2" + "github.com/elastic/apm-aggregation/aggregationpb" "github.com/elastic/apm-aggregation/aggregators/internal/hdrhistogram" + "github.com/elastic/apm-aggregation/aggregators/internal/protohash" tspb "github.com/elastic/apm-aggregation/aggregators/internal/timestamppb" "github.com/elastic/apm-aggregation/aggregators/nullable" "github.com/elastic/apm-data/model/modelpb" @@ -38,9 +41,9 @@ var ( // partitionedMetricsBuilder provides support for building partitioned // sets of metrics from an event. type partitionedMetricsBuilder struct { - partitions uint16 - hasher Hasher - builders []*eventMetricsBuilder // partitioned metrics + partitions uint16 + serviceInstanceHash xxhash.Digest + builders []*eventMetricsBuilder // partitioned metrics // Event metrics are for exactly one service instance, so we create an // array of a single element and use that for backing the slice in @@ -82,7 +85,10 @@ func getPartitionedMetricsBuilder( } p.serviceAggregationKey = serviceAggregationKey p.serviceInstanceAggregationKey = serviceInstanceAggregationKey - p.hasher = Hasher{}.Chain(&p.serviceAggregationKey).Chain(&p.serviceInstanceAggregationKey) + p.serviceInstanceHash = protohash.HashServiceInstanceAggregationKey( + protohash.HashServiceAggregationKey(xxhash.Digest{}, &p.serviceAggregationKey), + &p.serviceInstanceAggregationKey, + ) p.partitions = partitions return p } @@ -131,8 +137,9 @@ func (p *partitionedMetricsBuilder) processEvent(e *modelpb.APMEvent) { func (p *partitionedMetricsBuilder) addTransactionMetrics(e *modelpb.APMEvent, count float64, duration time.Duration) { var key aggregationpb.TransactionAggregationKey setTransactionKey(e, &key) + hash := protohash.HashTransactionAggregationKey(p.serviceInstanceHash, &key) - mb := p.get(p.hasher.Chain(&key)) + mb := p.get(hash) mb.transactionAggregationKey = key hdr := hdrhistogram.New() @@ -145,8 +152,9 @@ func (p *partitionedMetricsBuilder) addTransactionMetrics(e *modelpb.APMEvent, c func (p *partitionedMetricsBuilder) addServiceTransactionMetrics(e *modelpb.APMEvent, count float64, duration time.Duration) { var key aggregationpb.ServiceTransactionAggregationKey setServiceTransactionKey(e, &key) + hash := protohash.HashServiceTransactionAggregationKey(p.serviceInstanceHash, &key) - mb := p.get(p.hasher.Chain(&key)) + mb := p.get(hash) mb.serviceTransactionAggregationKey = key if mb.transactionMetrics.Histogram == nil { @@ -174,8 +182,9 @@ func (p *partitionedMetricsBuilder) addServiceTransactionMetrics(e *modelpb.APME func (p *partitionedMetricsBuilder) addDroppedSpanStatsMetrics(dss *modelpb.DroppedSpanStats, repCount float64) { var key aggregationpb.SpanAggregationKey setDroppedSpanStatsKey(dss, &key) + hash := protohash.HashSpanAggregationKey(p.serviceInstanceHash, &key) - mb := p.get(p.hasher.Chain(&key)) + mb := p.get(hash) i := len(mb.keyedSpanMetricsSlice) if i == len(mb.keyedSpanMetricsArray) { // No more capacity. The spec says that when 128 dropped span @@ -194,8 +203,9 @@ func (p *partitionedMetricsBuilder) addDroppedSpanStatsMetrics(dss *modelpb.Drop func (p *partitionedMetricsBuilder) addSpanMetrics(e *modelpb.APMEvent, repCount float64) { var key aggregationpb.SpanAggregationKey setSpanKey(e, &key) + hash := protohash.HashSpanAggregationKey(p.serviceInstanceHash, &key) - mb := p.get(p.hasher.Chain(&key)) + mb := p.get(hash) i := len(mb.keyedSpanMetricsSlice) mb.spanAggregationKey[i] = key setSpanMetrics(e, repCount, &mb.spanMetrics[i]) @@ -208,11 +218,11 @@ func (p *partitionedMetricsBuilder) addServiceSummaryMetrics() { // There are no actual metric values, we're just want to // create documents for the dimensions, so we can build a // list of services. - _ = p.get(p.hasher) + _ = p.get(p.serviceInstanceHash) } -func (p *partitionedMetricsBuilder) get(h Hasher) *eventMetricsBuilder { - partition := uint16(h.Sum() % uint64(p.partitions)) +func (p *partitionedMetricsBuilder) get(h xxhash.Digest) *eventMetricsBuilder { + partition := uint16(h.Sum64() % uint64(p.partitions)) for _, mb := range p.builders { if mb.partition == partition { return mb diff --git a/aggregators/hasher.go b/aggregators/hasher.go deleted file mode 100644 index beb0daa..0000000 --- a/aggregators/hasher.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -// or more contributor license agreements. Licensed under the Elastic License 2.0; -// you may not use this file except in compliance with the Elastic License 2.0. - -package aggregators - -import ( - "github.com/cespare/xxhash/v2" -) - -// HashableFunc is a function type that implements Hashable. -type HashableFunc func(xxhash.Digest) xxhash.Digest - -// Hash calls HashableFunc function. -func (f HashableFunc) Hash(d xxhash.Digest) xxhash.Digest { - return f(d) -} - -// Hashable represents the hash function interface implemented by aggregation models. -type Hashable interface { - Hash(xxhash.Digest) xxhash.Digest -} - -// Hasher contains a safe to copy digest. -type Hasher struct { - digest xxhash.Digest // xxhash.Digest does not contain pointers and is safe to copy -} - -// Chain allows chaining hash functions for Hashable interfaces. -func (h Hasher) Chain(hashable Hashable) Hasher { - return Hasher{digest: hashable.Hash(h.digest)} -} - -// Sum returns the hash for all the chained interfaces. -func (h Hasher) Sum() uint64 { - return h.digest.Sum64() -} diff --git a/aggregators/hasher_test.go b/aggregators/hasher_test.go deleted file mode 100644 index 0a7237a..0000000 --- a/aggregators/hasher_test.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -// or more contributor license agreements. Licensed under the Elastic License 2.0; -// you may not use this file except in compliance with the Elastic License 2.0. - -package aggregators - -import ( - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/cespare/xxhash/v2" -) - -func TestHasher(t *testing.T) { - a := Hasher{} - b := a.Chain(HashableFunc(func(h xxhash.Digest) xxhash.Digest { - h.WriteString("1") - return h - })) - c := a.Chain(HashableFunc(func(h xxhash.Digest) xxhash.Digest { - h.WriteString("1") - return h - })) - assert.NotEqual(t, a, b) - assert.Equal(t, b, c) - - // Ensure the struct does not change after calling Sum - c.Sum() - assert.Equal(t, b, c) -} diff --git a/aggregators/internal/protohash/doc.go b/aggregators/internal/protohash/doc.go new file mode 100644 index 0000000..0203579 --- /dev/null +++ b/aggregators/internal/protohash/doc.go @@ -0,0 +1,9 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// Package protohash holds functions for hashing aggregationpb.*Key types. + +//go:generate go run ./generate + +package protohash diff --git a/aggregators/internal/protohash/generate/main.go b/aggregators/internal/protohash/generate/main.go new file mode 100644 index 0000000..8c1b45f --- /dev/null +++ b/aggregators/internal/protohash/generate/main.go @@ -0,0 +1,118 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +package main + +import ( + "fmt" + "go/types" + "log" + "os" + "strings" + + "golang.org/x/tools/go/packages" +) + +func main() { + const pkgpath = "github.com/elastic/apm-aggregation/aggregationpb" + cfg := &packages.Config{Mode: packages.NeedTypes | packages.NeedTypesInfo} + pkgs, err := packages.Load(cfg, pkgpath) + if err != nil { + log.Fatal(err) + } + + f, err := os.Create("generated.go") + if err != nil { + log.Fatal(err) + } + defer f.Close() + + fmt.Fprintln(f, ` +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License 2.0; +// you may not use this file except in compliance with the Elastic License 2.0. + +// Code generated by protohash/generate. DO NOT EDIT. + +package protohash + +import ( + "encoding/binary" + + "github.com/cespare/xxhash/v2" + + "github.com/elastic/apm-aggregation/aggregationpb" +) + +func writeUint32(h *xxhash.Digest, v uint32) { + var buf [4]byte + binary.LittleEndian.PutUint32(buf[:], v) + h.Write(buf[:]) +} + +func writeUint64(h *xxhash.Digest, v uint64) { + var buf [8]byte + binary.LittleEndian.PutUint64(buf[:], v) + h.Write(buf[:]) +} +`[1:]) + + pkg := pkgs[0] + pkgscope := pkg.Types.Scope() + for _, name := range pkgscope.Names() { + if !strings.HasSuffix(name, "Key") { + continue + } + typeName, ok := pkgscope.Lookup(name).(*types.TypeName) + if !ok || !typeName.Exported() { + continue + } + named := typeName.Type().(*types.Named) + structType, ok := named.Underlying().(*types.Struct) + if !ok { + continue + } + + fmt.Fprintf(f, "func Hash%[1]s(h xxhash.Digest, k *aggregationpb.%[1]s) xxhash.Digest {\n", name) + for i := 0; i < structType.NumFields(); i++ { + field := structType.Field(i) + if !field.Exported() { + continue + } + var unhandled bool + switch fieldType := field.Type().(type) { + case *types.Basic: + switch kind := fieldType.Kind(); kind { + case types.Bool: + fmt.Fprintf(f, " if k.%s {\n h.WriteString(\"1\")\n }\n", field.Name()) + case types.String: + fmt.Fprintf(f, " h.WriteString(k.%s)\n", field.Name()) + case types.Uint32: + fmt.Fprintf(f, " writeUint32(&h, k.%s)\n", field.Name()) + case types.Uint64: + fmt.Fprintf(f, " writeUint64(&h, k.%s)\n", field.Name()) + default: + unhandled = true + } + case *types.Slice: + switch elemType := fieldType.Elem().(type) { + case *types.Basic: + if elemType.Kind() != types.Byte { + unhandled = true + break + } + fmt.Fprintf(f, " h.Write(k.%s)\n", field.Name()) + default: + unhandled = true + } + default: + unhandled = true + } + if unhandled { + panic(fmt.Errorf("unhandled field %s.%s (%v)", name, field.Name(), field.Type())) + } + } + fmt.Fprintln(f, " return h\n}\n") + } +} diff --git a/aggregationpb/hash.go b/aggregators/internal/protohash/generated.go similarity index 63% rename from aggregationpb/hash.go rename to aggregators/internal/protohash/generated.go index ac65f6f..f58526d 100644 --- a/aggregationpb/hash.go +++ b/aggregators/internal/protohash/generated.go @@ -2,21 +2,32 @@ // or more contributor license agreements. Licensed under the Elastic License 2.0; // you may not use this file except in compliance with the Elastic License 2.0. -package aggregationpb +// Code generated by protohash/generate. DO NOT EDIT. + +package protohash import ( "encoding/binary" "github.com/cespare/xxhash/v2" - "github.com/elastic/apm-aggregation/aggregators/nullable" + "github.com/elastic/apm-aggregation/aggregationpb" ) -func (k *ServiceAggregationKey) Hash(h xxhash.Digest) xxhash.Digest { +func writeUint32(h *xxhash.Digest, v uint32) { + var buf [4]byte + binary.LittleEndian.PutUint32(buf[:], v) + h.Write(buf[:]) +} + +func writeUint64(h *xxhash.Digest, v uint64) { var buf [8]byte - binary.LittleEndian.PutUint64(buf[:], k.Timestamp) + binary.LittleEndian.PutUint64(buf[:], v) h.Write(buf[:]) +} +func HashServiceAggregationKey(h xxhash.Digest, k *aggregationpb.ServiceAggregationKey) xxhash.Digest { + writeUint64(&h, k.Timestamp) h.WriteString(k.ServiceName) h.WriteString(k.ServiceEnvironment) h.WriteString(k.ServiceLanguageName) @@ -24,60 +35,48 @@ func (k *ServiceAggregationKey) Hash(h xxhash.Digest) xxhash.Digest { return h } -func (k *ServiceInstanceAggregationKey) Hash(h xxhash.Digest) xxhash.Digest { +func HashServiceInstanceAggregationKey(h xxhash.Digest, k *aggregationpb.ServiceInstanceAggregationKey) xxhash.Digest { h.Write(k.GlobalLabelsStr) return h } -func (k *ServiceTransactionAggregationKey) Hash(h xxhash.Digest) xxhash.Digest { +func HashServiceTransactionAggregationKey(h xxhash.Digest, k *aggregationpb.ServiceTransactionAggregationKey) xxhash.Digest { h.WriteString(k.TransactionType) return h } -func (k *SpanAggregationKey) Hash(h xxhash.Digest) xxhash.Digest { +func HashSpanAggregationKey(h xxhash.Digest, k *aggregationpb.SpanAggregationKey) xxhash.Digest { h.WriteString(k.SpanName) h.WriteString(k.Outcome) - h.WriteString(k.TargetType) h.WriteString(k.TargetName) - h.WriteString(k.Resource) return h } -func (k *TransactionAggregationKey) Hash(h xxhash.Digest) xxhash.Digest { +func HashTransactionAggregationKey(h xxhash.Digest, k *aggregationpb.TransactionAggregationKey) xxhash.Digest { if k.TraceRoot { h.WriteString("1") } - h.WriteString(k.ContainerId) h.WriteString(k.KubernetesPodName) - h.WriteString(k.ServiceVersion) h.WriteString(k.ServiceNodeName) - h.WriteString(k.ServiceRuntimeName) h.WriteString(k.ServiceRuntimeVersion) h.WriteString(k.ServiceLanguageVersion) - h.WriteString(k.HostHostname) h.WriteString(k.HostName) h.WriteString(k.HostOsPlatform) - h.WriteString(k.EventOutcome) - h.WriteString(k.TransactionName) h.WriteString(k.TransactionType) h.WriteString(k.TransactionResult) - - if k.FaasColdstart == uint32(nullable.True) { - h.WriteString("1") - } + writeUint32(&h, k.FaasColdstart) h.WriteString(k.FaasId) h.WriteString(k.FaasName) h.WriteString(k.FaasVersion) h.WriteString(k.FaasTriggerType) - h.WriteString(k.CloudProvider) h.WriteString(k.CloudRegion) h.WriteString(k.CloudAvailabilityZone) diff --git a/aggregators/merger.go b/aggregators/merger.go index 0e574e4..bfa3aaf 100644 --- a/aggregators/merger.go +++ b/aggregators/merger.go @@ -8,10 +8,12 @@ import ( "io" "github.com/axiomhq/hyperloglog" + "github.com/cespare/xxhash/v2" "golang.org/x/exp/slices" "github.com/elastic/apm-aggregation/aggregationpb" "github.com/elastic/apm-aggregation/aggregators/internal/constraint" + "github.com/elastic/apm-aggregation/aggregators/internal/protohash" ) type combinedMetricsMerger struct { @@ -83,7 +85,7 @@ func (m *combinedMetricsMerger) merge(from *aggregationpb.CombinedMetrics) { // of the _to_ combined metrics. for i := range from.ServiceMetrics { fromSvc := from.ServiceMetrics[i] - hash := Hasher{}.Chain(fromSvc.Key) + serviceKeyHash := protohash.HashServiceAggregationKey(xxhash.Digest{}, fromSvc.Key) var sk serviceAggregationKey sk.FromProto(fromSvc.Key) toSvc, svcOverflow := getServiceMetrics(&m.metrics, sk, m.limits.MaxServices) @@ -91,9 +93,9 @@ func (m *combinedMetricsMerger) merge(from *aggregationpb.CombinedMetrics) { mergeOverflow(&m.metrics.OverflowServices, fromSvc.Metrics.OverflowGroups) for j := range fromSvc.Metrics.ServiceInstanceMetrics { ksim := fromSvc.Metrics.ServiceInstanceMetrics[j] - sikHash := hash.Chain(ksim.Key) - mergeToOverflowFromSIM(&m.metrics.OverflowServices, ksim, sikHash) - insertHash(&m.metrics.OverflowServiceInstancesEstimator, sikHash.Sum()) + serviceInstanceKeyHash := protohash.HashServiceInstanceAggregationKey(serviceKeyHash, ksim.Key) + mergeToOverflowFromSIM(&m.metrics.OverflowServices, ksim, serviceInstanceKeyHash) + insertHash(&m.metrics.OverflowServiceInstancesEstimator, serviceInstanceKeyHash.Sum64()) } continue } @@ -104,7 +106,7 @@ func (m *combinedMetricsMerger) merge(from *aggregationpb.CombinedMetrics) { fromSvc.Metrics.ServiceInstanceMetrics, m.constraints, m.limits, - hash, + serviceKeyHash, &m.metrics.OverflowServiceInstancesEstimator, ) } @@ -117,14 +119,14 @@ func mergeServiceInstanceGroups( from []*aggregationpb.KeyedServiceInstanceMetrics, globalConstraints constraints, limits Limits, - hash Hasher, + hash xxhash.Digest, overflowServiceInstancesEstimator **hyperloglog.Sketch, ) { for i := range from { fromSvcIns := from[i] var sik serviceInstanceAggregationKey sik.FromProto(fromSvcIns.Key) - sikHash := hash.Chain(fromSvcIns.Key) + sikHash := protohash.HashServiceInstanceAggregationKey(hash, fromSvcIns.Key) toSvcIns, overflowed := getServiceInstanceMetrics(to, sik, limits.MaxServiceInstanceGroupsPerService) if overflowed { @@ -135,7 +137,7 @@ func mergeServiceInstanceGroups( ) insertHash( overflowServiceInstancesEstimator, - sikHash.Sum(), + sikHash.Sum64(), ) continue } @@ -182,7 +184,7 @@ func mergeTransactionGroups( to map[transactionAggregationKey]*aggregationpb.KeyedTransactionMetrics, from []*aggregationpb.KeyedTransactionMetrics, perSvcConstraint, globalConstraint *constraint.Constraint, - hash Hasher, + hash xxhash.Digest, overflowTo *overflowTransaction, ) { for i := range from { @@ -193,10 +195,8 @@ func mergeTransactionGroups( if !ok { overflowed := perSvcConstraint.Maxed() || globalConstraint.Maxed() if overflowed { - overflowTo.Merge( - fromTxn.Metrics, - hash.Chain(fromTxn.Key).Sum(), - ) + fromTxnKeyHash := protohash.HashTransactionAggregationKey(hash, fromTxn.Key) + overflowTo.Merge(fromTxn.Metrics, fromTxnKeyHash.Sum64()) continue } perSvcConstraint.Add(1) @@ -217,7 +217,7 @@ func mergeServiceTransactionGroups( to map[serviceTransactionAggregationKey]*aggregationpb.KeyedServiceTransactionMetrics, from []*aggregationpb.KeyedServiceTransactionMetrics, perSvcConstraint, globalConstraint *constraint.Constraint, - hash Hasher, + hash xxhash.Digest, overflowTo *overflowServiceTransaction, ) { for i := range from { @@ -228,10 +228,8 @@ func mergeServiceTransactionGroups( if !ok { overflowed := perSvcConstraint.Maxed() || globalConstraint.Maxed() if overflowed { - overflowTo.Merge( - fromSvcTxn.Metrics, - hash.Chain(fromSvcTxn.Key).Sum(), - ) + fromSvcTxnKeyHash := protohash.HashServiceTransactionAggregationKey(hash, fromSvcTxn.Key) + overflowTo.Merge(fromSvcTxn.Metrics, fromSvcTxnKeyHash.Sum64()) continue } perSvcConstraint.Add(1) @@ -251,7 +249,7 @@ func mergeSpanGroups( to map[spanAggregationKey]*aggregationpb.KeyedSpanMetrics, from []*aggregationpb.KeyedSpanMetrics, perSvcConstraint, globalConstraint *constraint.Constraint, - hash Hasher, + hash xxhash.Digest, overflowTo *overflowSpan, ) { for i := range from { @@ -271,10 +269,8 @@ func mergeSpanGroups( if !ok { overflowed := perSvcConstraint.Maxed() || globalConstraint.Maxed() if overflowed { - overflowTo.Merge( - fromSpan.Metrics, - hash.Chain(fromSpan.Key).Sum(), - ) + fromSpanKeyHash := protohash.HashSpanAggregationKey(hash, fromSpan.Key) + overflowTo.Merge(fromSpan.Metrics, fromSpanKeyHash.Sum64()) continue } perSvcConstraint.Add(1) @@ -292,28 +288,22 @@ func mergeSpanGroups( func mergeToOverflowFromSIM( to *overflow, from *aggregationpb.KeyedServiceInstanceMetrics, - hash Hasher, + hash xxhash.Digest, ) { if from.Metrics == nil { return } for _, ktm := range from.Metrics.TransactionMetrics { - to.OverflowTransaction.Merge( - ktm.Metrics, - hash.Chain(ktm.Key).Sum(), - ) + ktmKeyHash := protohash.HashTransactionAggregationKey(hash, ktm.Key) + to.OverflowTransaction.Merge(ktm.Metrics, ktmKeyHash.Sum64()) } for _, kstm := range from.Metrics.ServiceTransactionMetrics { - to.OverflowServiceTransaction.Merge( - kstm.Metrics, - hash.Chain(kstm.Key).Sum(), - ) + kstmKeyHash := protohash.HashServiceTransactionAggregationKey(hash, kstm.Key) + to.OverflowServiceTransaction.Merge(kstm.Metrics, kstmKeyHash.Sum64()) } for _, ksm := range from.Metrics.SpanMetrics { - to.OverflowSpan.Merge( - ksm.Metrics, - hash.Chain(ksm.Key).Sum(), - ) + ksmKeyHash := protohash.HashSpanAggregationKey(hash, ksm.Key) + to.OverflowSpan.Merge(ksm.Metrics, ksmKeyHash.Sum64()) } } diff --git a/aggregators/partitioner.go b/aggregators/partitioner.go deleted file mode 100644 index f5e38e0..0000000 --- a/aggregators/partitioner.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -// or more contributor license agreements. Licensed under the Elastic License 2.0; -// you may not use this file except in compliance with the Elastic License 2.0. - -package aggregators - -// HashPartitioner is a hash based partitioner for pebble keys. The paritioner -// partitions the keys into buckets with number of buckets limited by the passed -// argument. -type HashPartitioner struct { - maxPartitions uint16 -} - -// NewHashPartitioner creates a new instance of the HashPartitioner. -func NewHashPartitioner(maxPartitions uint16) *HashPartitioner { - return &HashPartitioner{ - maxPartitions: maxPartitions, - } -} - -// Partition generates an ID to be used as partition ID given a hash of the key. -func (p *HashPartitioner) Partition(hasher Hasher) uint16 { - return uint16(hasher.Sum() % uint64(p.maxPartitions)) -} diff --git a/go.mod b/go.mod index 870436a..073ec11 100644 --- a/go.mod +++ b/go.mod @@ -20,6 +20,7 @@ require ( go.uber.org/zap v1.24.0 golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 golang.org/x/sync v0.3.0 + golang.org/x/tools v0.9.3 google.golang.org/protobuf v1.31.0 ) @@ -63,6 +64,7 @@ require ( go.opentelemetry.io/collector/semconv v0.76.1 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.11.0 // indirect + golang.org/x/mod v0.11.0 // indirect golang.org/x/net v0.10.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect diff --git a/go.sum b/go.sum index 029db67..f69dfa6 100644 --- a/go.sum +++ b/go.sum @@ -475,6 +475,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -639,6 +641,8 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= +golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/proto/aggregation.proto b/proto/aggregation.proto index f6b2646..16259f6 100644 --- a/proto/aggregation.proto +++ b/proto/aggregation.proto @@ -24,7 +24,6 @@ message ServiceAggregationKey { string service_environment = 3; string service_language_name = 4; string agent_name = 5; - bytes global_labels_str = 6; } message ServiceMetrics {