From 9c12c4f2a897d883e541b39eed2d22bb61966489 Mon Sep 17 00:00:00 2001 From: Charith Ellawala Date: Tue, 25 Apr 2023 16:04:37 +0100 Subject: [PATCH] chore: Add bundle driver info to telemetry (#1545) * chore: Add bundle driver info to telemetry Signed-off-by: Charith Ellawala * Remove label Signed-off-by: Charith Ellawala --------- Signed-off-by: Charith Ellawala --- .../cerbos/telemetry/v1/hashpb_helpers.pb.go | 20 + api/genpb/cerbos/telemetry/v1/telemetry.pb.go | 405 +++++++++++------- .../telemetry/v1/telemetry.pb.validate.go | 152 +++++++ .../telemetry/v1/telemetry_hashpb.pb.go | 8 + .../telemetry/v1/telemetry_vtproto.pb.go | 295 +++++++++++++ .../cerbos/telemetry/v1/telemetry.proto | 7 + internal/storage/bundle/local_source.go | 4 + internal/storage/bundle/remote_source.go | 22 +- internal/storage/bundle/source_wrappers.go | 8 + internal/storage/bundle/store.go | 8 + internal/telemetry/server_launch.go | 19 +- internal/util/app.go | 18 + .../telemetry/v1/ServerLaunch.schema.json | 18 + .../v1/ServerLaunch/Features.schema.json | 18 + .../ServerLaunch/Features/Storage.schema.json | 18 + .../Features/Storage/Bundle.schema.json | 17 + 16 files changed, 867 insertions(+), 170 deletions(-) create mode 100644 schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features/Storage/Bundle.schema.json diff --git a/api/genpb/cerbos/telemetry/v1/hashpb_helpers.pb.go b/api/genpb/cerbos/telemetry/v1/hashpb_helpers.pb.go index 8d8a69807..0494c34a4 100644 --- a/api/genpb/cerbos/telemetry/v1/hashpb_helpers.pb.go +++ b/api/genpb/cerbos/telemetry/v1/hashpb_helpers.pb.go @@ -130,6 +130,21 @@ func cerbos_telemetry_v1_ServerLaunch_Features_Storage_Blob_hashpb_sum(m *Server } } +func cerbos_telemetry_v1_ServerLaunch_Features_Storage_Bundle_hashpb_sum(m *ServerLaunch_Features_Storage_Bundle, hasher hash.Hash, ignore map[string]struct{}) { + if _, ok := ignore["cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle.pdp_id"]; !ok { + _, _ = hasher.Write(protowire.AppendString(nil, m.PdpId)) + + } + if _, ok := ignore["cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle.bundle_source"]; !ok { + _, _ = hasher.Write(protowire.AppendString(nil, m.BundleSource)) + + } + if _, ok := ignore["cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle.client_id"]; !ok { + _, _ = hasher.Write(protowire.AppendString(nil, m.ClientId)) + + } +} + func cerbos_telemetry_v1_ServerLaunch_Features_Storage_Disk_hashpb_sum(m *ServerLaunch_Features_Storage_Disk, hasher hash.Hash, ignore map[string]struct{}) { if _, ok := ignore["cerbos.telemetry.v1.ServerLaunch.Features.Storage.Disk.watch"]; !ok { _, _ = hasher.Write(protowire.AppendVarint(nil, protowire.EncodeBool(m.Watch))) @@ -177,6 +192,11 @@ func cerbos_telemetry_v1_ServerLaunch_Features_Storage_hashpb_sum(m *ServerLaunc cerbos_telemetry_v1_ServerLaunch_Features_Storage_Blob_hashpb_sum(t.Blob, hasher, ignore) } + case *ServerLaunch_Features_Storage_Bundle_: + if t.Bundle != nil { + cerbos_telemetry_v1_ServerLaunch_Features_Storage_Bundle_hashpb_sum(t.Bundle, hasher, ignore) + } + } } } diff --git a/api/genpb/cerbos/telemetry/v1/telemetry.pb.go b/api/genpb/cerbos/telemetry/v1/telemetry.pb.go index bf74b4920..55850549a 100644 --- a/api/genpb/cerbos/telemetry/v1/telemetry.pb.go +++ b/api/genpb/cerbos/telemetry/v1/telemetry.pb.go @@ -661,6 +661,7 @@ type ServerLaunch_Features_Storage struct { // *ServerLaunch_Features_Storage_Disk_ // *ServerLaunch_Features_Storage_Git_ // *ServerLaunch_Features_Storage_Blob_ + // *ServerLaunch_Features_Storage_Bundle_ Store isServerLaunch_Features_Storage_Store `protobuf_oneof:"store"` } @@ -731,6 +732,13 @@ func (x *ServerLaunch_Features_Storage) GetBlob() *ServerLaunch_Features_Storage return nil } +func (x *ServerLaunch_Features_Storage) GetBundle() *ServerLaunch_Features_Storage_Bundle { + if x, ok := x.GetStore().(*ServerLaunch_Features_Storage_Bundle_); ok { + return x.Bundle + } + return nil +} + type isServerLaunch_Features_Storage_Store interface { isServerLaunch_Features_Storage_Store() } @@ -747,12 +755,18 @@ type ServerLaunch_Features_Storage_Blob_ struct { Blob *ServerLaunch_Features_Storage_Blob `protobuf:"bytes,4,opt,name=blob,proto3,oneof"` } +type ServerLaunch_Features_Storage_Bundle_ struct { + Bundle *ServerLaunch_Features_Storage_Bundle `protobuf:"bytes,5,opt,name=bundle,proto3,oneof"` +} + func (*ServerLaunch_Features_Storage_Disk_) isServerLaunch_Features_Storage_Store() {} func (*ServerLaunch_Features_Storage_Git_) isServerLaunch_Features_Storage_Store() {} func (*ServerLaunch_Features_Storage_Blob_) isServerLaunch_Features_Storage_Store() {} +func (*ServerLaunch_Features_Storage_Bundle_) isServerLaunch_Features_Storage_Store() {} + type ServerLaunch_Features_Storage_Disk struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -918,6 +932,69 @@ func (x *ServerLaunch_Features_Storage_Blob) GetPollInterval() *durationpb.Durat return nil } +type ServerLaunch_Features_Storage_Bundle struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PdpId string `protobuf:"bytes,1,opt,name=pdp_id,json=pdpId,proto3" json:"pdp_id,omitempty"` + BundleSource string `protobuf:"bytes,2,opt,name=bundle_source,json=bundleSource,proto3" json:"bundle_source,omitempty"` + ClientId string `protobuf:"bytes,3,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` +} + +func (x *ServerLaunch_Features_Storage_Bundle) Reset() { + *x = ServerLaunch_Features_Storage_Bundle{} + if protoimpl.UnsafeEnabled { + mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerLaunch_Features_Storage_Bundle) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerLaunch_Features_Storage_Bundle) ProtoMessage() {} + +func (x *ServerLaunch_Features_Storage_Bundle) ProtoReflect() protoreflect.Message { + mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerLaunch_Features_Storage_Bundle.ProtoReflect.Descriptor instead. +func (*ServerLaunch_Features_Storage_Bundle) Descriptor() ([]byte, []int) { + return file_cerbos_telemetry_v1_telemetry_proto_rawDescGZIP(), []int{0, 2, 3, 3} +} + +func (x *ServerLaunch_Features_Storage_Bundle) GetPdpId() string { + if x != nil { + return x.PdpId + } + return "" +} + +func (x *ServerLaunch_Features_Storage_Bundle) GetBundleSource() string { + if x != nil { + return x.BundleSource + } + return "" +} + +func (x *ServerLaunch_Features_Storage_Bundle) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + type ServerLaunch_Stats_Policy struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -931,7 +1008,7 @@ type ServerLaunch_Stats_Policy struct { func (x *ServerLaunch_Stats_Policy) Reset() { *x = ServerLaunch_Stats_Policy{} if protoimpl.UnsafeEnabled { - mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[14] + mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -944,7 +1021,7 @@ func (x *ServerLaunch_Stats_Policy) String() string { func (*ServerLaunch_Stats_Policy) ProtoMessage() {} func (x *ServerLaunch_Stats_Policy) ProtoReflect() protoreflect.Message { - mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[14] + mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -992,7 +1069,7 @@ type ServerLaunch_Stats_Schema struct { func (x *ServerLaunch_Stats_Schema) Reset() { *x = ServerLaunch_Stats_Schema{} if protoimpl.UnsafeEnabled { - mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[15] + mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1005,7 +1082,7 @@ func (x *ServerLaunch_Stats_Schema) String() string { func (*ServerLaunch_Stats_Schema) ProtoMessage() {} func (x *ServerLaunch_Stats_Schema) ProtoReflect() protoreflect.Message { - mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[15] + mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1040,7 +1117,7 @@ type Event_CountStat struct { func (x *Event_CountStat) Reset() { *x = Event_CountStat{} if protoimpl.UnsafeEnabled { - mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[19] + mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1053,7 +1130,7 @@ func (x *Event_CountStat) String() string { func (*Event_CountStat) ProtoMessage() {} func (x *Event_CountStat) ProtoReflect() protoreflect.Message { - mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[19] + mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1097,7 +1174,7 @@ type Event_ApiActivity struct { func (x *Event_ApiActivity) Reset() { *x = Event_ApiActivity{} if protoimpl.UnsafeEnabled { - mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[20] + mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1110,7 +1187,7 @@ func (x *Event_ApiActivity) String() string { func (*Event_ApiActivity) ProtoMessage() {} func (x *Event_ApiActivity) ProtoReflect() protoreflect.Message { - mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[20] + mi := &file_cerbos_telemetry_v1_telemetry_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1162,7 +1239,7 @@ var file_cerbos_telemetry_v1_telemetry_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe, 0x11, 0x0a, 0x0c, 0x53, + 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf6, 0x12, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x40, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, @@ -1197,7 +1274,7 @@ var file_cerbos_telemetry_v1_telemetry_proto_rawDesc = []byte{ 0x01, 0x28, 0x09, 0x52, 0x02, 0x6f, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x63, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x75, 0x6d, 0x5f, 0x63, 0x70, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6e, - 0x75, 0x6d, 0x43, 0x70, 0x75, 0x73, 0x1a, 0xdc, 0x07, 0x0a, 0x08, 0x46, 0x65, 0x61, 0x74, 0x75, + 0x75, 0x6d, 0x43, 0x70, 0x75, 0x73, 0x1a, 0x94, 0x09, 0x0a, 0x08, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x05, 0x61, 0x75, 0x64, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, @@ -1226,7 +1303,7 @@ var file_cerbos_telemetry_v1_telemetry_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x24, 0x0a, 0x08, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x41, 0x70, 0x69, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, - 0x61, 0x62, 0x6c, 0x65, 0x64, 0x1a, 0x8d, 0x04, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x1a, 0xc5, 0x05, 0x0a, 0x07, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x12, 0x4d, 0x0a, 0x04, 0x64, 0x69, 0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, @@ -1243,107 +1320,118 @@ var file_cerbos_telemetry_v1_telemetry_proto_rawDesc = []byte{ 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x6c, 0x6f, 0x62, 0x48, 0x00, 0x52, 0x04, 0x62, - 0x6c, 0x6f, 0x62, 0x1a, 0x1c, 0x0a, 0x04, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x77, - 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x77, 0x61, 0x74, 0x63, - 0x68, 0x1a, 0x75, 0x0a, 0x03, 0x47, 0x69, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, 0x3e, 0x0a, 0x0d, 0x70, 0x6f, 0x6c, 0x6c, - 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x70, 0x6f, 0x6c, 0x6c, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x1a, 0x62, 0x0a, 0x04, 0x42, 0x6c, 0x6f, 0x62, - 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x0d, - 0x70, 0x6f, 0x6c, 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, - 0x70, 0x6f, 0x6c, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x42, 0x07, 0x0a, 0x05, - 0x73, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0xb3, 0x05, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, - 0x46, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2e, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, - 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, 0x75, 0x6e, - 0x63, 0x68, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, - 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x46, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, - 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, - 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, - 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x1a, - 0xf9, 0x03, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x4f, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x63, 0x65, 0x72, 0x62, - 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x66, 0x0a, 0x0e, 0x61, - 0x76, 0x67, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, + 0x6c, 0x6f, 0x62, 0x12, 0x53, 0x0a, 0x06, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x2e, 0x41, 0x76, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x61, 0x76, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x75, 0x0a, 0x13, 0x61, 0x76, 0x67, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x45, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, - 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, 0x75, - 0x6e, 0x63, 0x68, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, - 0x2e, 0x41, 0x76, 0x67, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x61, 0x76, 0x67, 0x43, 0x6f, 0x6e, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x38, 0x0a, 0x0a, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3f, 0x0a, 0x11, 0x41, 0x76, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x44, 0x0a, 0x16, 0x41, 0x76, 0x67, 0x43, 0x6f, 0x6e, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x1e, 0x0a, 0x06, 0x53, - 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x80, 0x01, 0x0a, 0x0a, - 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, + 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x46, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2e, + 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x2e, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x48, 0x00, + 0x52, 0x06, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x1a, 0x1c, 0x0a, 0x04, 0x44, 0x69, 0x73, 0x6b, + 0x12, 0x14, 0x0a, 0x05, 0x77, 0x61, 0x74, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x05, 0x77, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x75, 0x0a, 0x03, 0x47, 0x69, 0x74, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x75, 0x74, + 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x12, 0x3e, 0x0a, + 0x0d, 0x70, 0x6f, 0x6c, 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x73, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0xfe, - 0x02, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0c, 0x61, 0x70, 0x69, 0x5f, - 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, - 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, - 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x70, 0x69, 0x41, 0x63, - 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x70, 0x69, 0x41, 0x63, 0x74, - 0x69, 0x76, 0x69, 0x74, 0x79, 0x1a, 0x33, 0x0a, 0x09, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, - 0x61, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0xea, 0x01, 0x0a, 0x0b, 0x41, - 0x70, 0x69, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x47, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x68, 0x6f, - 0x64, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x0c, 0x70, 0x6f, 0x6c, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x1a, 0x62, 0x0a, + 0x04, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x12, 0x3e, 0x0a, 0x0d, 0x70, 0x6f, 0x6c, 0x6c, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, + 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x70, 0x6f, 0x6c, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, + 0x6c, 0x1a, 0x61, 0x0a, 0x06, 0x42, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x70, + 0x64, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x64, 0x70, + 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x62, 0x75, 0x6e, 0x64, 0x6c, 0x65, 0x5f, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x62, 0x75, 0x6e, 0x64, 0x6c, + 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x49, 0x64, 0x42, 0x07, 0x0a, 0x05, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x1a, 0xb3, 0x05, + 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x46, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, + 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, + 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, + 0x46, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2e, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, + 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, 0x75, 0x6e, + 0x63, 0x68, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x52, + 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x1a, 0xf9, 0x03, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x79, 0x12, 0x4f, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x39, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, + 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x66, 0x0a, 0x0e, 0x61, 0x76, 0x67, 0x5f, 0x72, 0x75, 0x6c, 0x65, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x63, 0x65, + 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, + 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x76, 0x67, 0x52, + 0x75, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x61, + 0x76, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x75, 0x0a, 0x13, 0x61, + 0x76, 0x67, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, + 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x76, 0x67, 0x43, 0x6f, 0x6e, 0x64, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x11, 0x61, 0x76, 0x67, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x1a, 0x38, 0x0a, 0x0a, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3f, 0x0a, 0x11, + 0x41, 0x76, 0x67, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x44, 0x0a, + 0x16, 0x41, 0x76, 0x67, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x1a, 0x1e, 0x0a, 0x06, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x80, 0x01, 0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x74, + 0x6f, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x06, + 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, + 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x5f, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x73, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x22, 0xfe, 0x02, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x12, 0x4b, 0x0a, 0x0c, 0x61, 0x70, 0x69, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, + 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x2e, 0x41, 0x70, 0x69, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x48, 0x00, + 0x52, 0x0b, 0x61, 0x70, 0x69, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x1a, 0x33, 0x0a, + 0x09, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x1a, 0xea, 0x01, 0x0a, 0x0b, 0x41, 0x70, 0x69, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, + 0x74, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x06, + 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x12, + 0x47, 0x0a, 0x0c, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, + 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, + 0x74, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x52, 0x0b, 0x6d, 0x65, 0x74, + 0x68, 0x6f, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x12, 0x45, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x52, 0x0b, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x43, 0x61, 0x6c, 0x6c, 0x73, - 0x12, 0x45, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x74, - 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x74, 0x61, 0x74, 0x52, 0x0a, 0x75, 0x73, 0x65, - 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, - 0x7b, 0x0a, 0x1b, 0x64, 0x65, 0x76, 0x2e, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5a, 0x42, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x65, 0x72, 0x62, 0x6f, - 0x73, 0x2f, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, - 0x70, 0x62, 0x2f, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2f, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, - 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x3b, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, - 0x76, 0x31, 0xaa, 0x02, 0x17, 0x43, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, - 0x56, 0x31, 0x2e, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x61, 0x74, 0x52, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x42, + 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x7b, 0x0a, 0x1b, 0x64, 0x65, 0x76, 0x2e, 0x63, + 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x2e, 0x74, 0x65, 0x6c, + 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x2f, 0x63, 0x65, 0x72, 0x62, 0x6f, 0x73, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x70, 0x62, 0x2f, 0x63, 0x65, 0x72, 0x62, 0x6f, + 0x73, 0x2f, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2f, 0x76, 0x31, 0x3b, 0x74, + 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x76, 0x31, 0xaa, 0x02, 0x17, 0x43, 0x65, 0x72, + 0x62, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x31, 0x2e, 0x54, 0x65, 0x6c, 0x65, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1358,60 +1446,62 @@ func file_cerbos_telemetry_v1_telemetry_proto_rawDescGZIP() []byte { return file_cerbos_telemetry_v1_telemetry_proto_rawDescData } -var file_cerbos_telemetry_v1_telemetry_proto_msgTypes = make([]protoimpl.MessageInfo, 21) +var file_cerbos_telemetry_v1_telemetry_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_cerbos_telemetry_v1_telemetry_proto_goTypes = []interface{}{ - (*ServerLaunch)(nil), // 0: cerbos.telemetry.v1.ServerLaunch - (*ServerStop)(nil), // 1: cerbos.telemetry.v1.ServerStop - (*Event)(nil), // 2: cerbos.telemetry.v1.Event - (*ServerLaunch_Cerbos)(nil), // 3: cerbos.telemetry.v1.ServerLaunch.Cerbos - (*ServerLaunch_Source)(nil), // 4: cerbos.telemetry.v1.ServerLaunch.Source - (*ServerLaunch_Features)(nil), // 5: cerbos.telemetry.v1.ServerLaunch.Features - (*ServerLaunch_Stats)(nil), // 6: cerbos.telemetry.v1.ServerLaunch.Stats - (*ServerLaunch_Features_Audit)(nil), // 7: cerbos.telemetry.v1.ServerLaunch.Features.Audit - (*ServerLaunch_Features_Schema)(nil), // 8: cerbos.telemetry.v1.ServerLaunch.Features.Schema - (*ServerLaunch_Features_AdminApi)(nil), // 9: cerbos.telemetry.v1.ServerLaunch.Features.AdminApi - (*ServerLaunch_Features_Storage)(nil), // 10: cerbos.telemetry.v1.ServerLaunch.Features.Storage - (*ServerLaunch_Features_Storage_Disk)(nil), // 11: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Disk - (*ServerLaunch_Features_Storage_Git)(nil), // 12: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Git - (*ServerLaunch_Features_Storage_Blob)(nil), // 13: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Blob - (*ServerLaunch_Stats_Policy)(nil), // 14: cerbos.telemetry.v1.ServerLaunch.Stats.Policy - (*ServerLaunch_Stats_Schema)(nil), // 15: cerbos.telemetry.v1.ServerLaunch.Stats.Schema - nil, // 16: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.CountEntry - nil, // 17: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.AvgRuleCountEntry - nil, // 18: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.AvgConditionCountEntry - (*Event_CountStat)(nil), // 19: cerbos.telemetry.v1.Event.CountStat - (*Event_ApiActivity)(nil), // 20: cerbos.telemetry.v1.Event.ApiActivity - (*durationpb.Duration)(nil), // 21: google.protobuf.Duration + (*ServerLaunch)(nil), // 0: cerbos.telemetry.v1.ServerLaunch + (*ServerStop)(nil), // 1: cerbos.telemetry.v1.ServerStop + (*Event)(nil), // 2: cerbos.telemetry.v1.Event + (*ServerLaunch_Cerbos)(nil), // 3: cerbos.telemetry.v1.ServerLaunch.Cerbos + (*ServerLaunch_Source)(nil), // 4: cerbos.telemetry.v1.ServerLaunch.Source + (*ServerLaunch_Features)(nil), // 5: cerbos.telemetry.v1.ServerLaunch.Features + (*ServerLaunch_Stats)(nil), // 6: cerbos.telemetry.v1.ServerLaunch.Stats + (*ServerLaunch_Features_Audit)(nil), // 7: cerbos.telemetry.v1.ServerLaunch.Features.Audit + (*ServerLaunch_Features_Schema)(nil), // 8: cerbos.telemetry.v1.ServerLaunch.Features.Schema + (*ServerLaunch_Features_AdminApi)(nil), // 9: cerbos.telemetry.v1.ServerLaunch.Features.AdminApi + (*ServerLaunch_Features_Storage)(nil), // 10: cerbos.telemetry.v1.ServerLaunch.Features.Storage + (*ServerLaunch_Features_Storage_Disk)(nil), // 11: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Disk + (*ServerLaunch_Features_Storage_Git)(nil), // 12: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Git + (*ServerLaunch_Features_Storage_Blob)(nil), // 13: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Blob + (*ServerLaunch_Features_Storage_Bundle)(nil), // 14: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle + (*ServerLaunch_Stats_Policy)(nil), // 15: cerbos.telemetry.v1.ServerLaunch.Stats.Policy + (*ServerLaunch_Stats_Schema)(nil), // 16: cerbos.telemetry.v1.ServerLaunch.Stats.Schema + nil, // 17: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.CountEntry + nil, // 18: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.AvgRuleCountEntry + nil, // 19: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.AvgConditionCountEntry + (*Event_CountStat)(nil), // 20: cerbos.telemetry.v1.Event.CountStat + (*Event_ApiActivity)(nil), // 21: cerbos.telemetry.v1.Event.ApiActivity + (*durationpb.Duration)(nil), // 22: google.protobuf.Duration } var file_cerbos_telemetry_v1_telemetry_proto_depIdxs = []int32{ 4, // 0: cerbos.telemetry.v1.ServerLaunch.source:type_name -> cerbos.telemetry.v1.ServerLaunch.Source 5, // 1: cerbos.telemetry.v1.ServerLaunch.features:type_name -> cerbos.telemetry.v1.ServerLaunch.Features 6, // 2: cerbos.telemetry.v1.ServerLaunch.stats:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats - 21, // 3: cerbos.telemetry.v1.ServerStop.uptime:type_name -> google.protobuf.Duration - 20, // 4: cerbos.telemetry.v1.Event.api_activity:type_name -> cerbos.telemetry.v1.Event.ApiActivity + 22, // 3: cerbos.telemetry.v1.ServerStop.uptime:type_name -> google.protobuf.Duration + 21, // 4: cerbos.telemetry.v1.Event.api_activity:type_name -> cerbos.telemetry.v1.Event.ApiActivity 3, // 5: cerbos.telemetry.v1.ServerLaunch.Source.cerbos:type_name -> cerbos.telemetry.v1.ServerLaunch.Cerbos 7, // 6: cerbos.telemetry.v1.ServerLaunch.Features.audit:type_name -> cerbos.telemetry.v1.ServerLaunch.Features.Audit 8, // 7: cerbos.telemetry.v1.ServerLaunch.Features.schema:type_name -> cerbos.telemetry.v1.ServerLaunch.Features.Schema 9, // 8: cerbos.telemetry.v1.ServerLaunch.Features.admin_api:type_name -> cerbos.telemetry.v1.ServerLaunch.Features.AdminApi 10, // 9: cerbos.telemetry.v1.ServerLaunch.Features.storage:type_name -> cerbos.telemetry.v1.ServerLaunch.Features.Storage - 14, // 10: cerbos.telemetry.v1.ServerLaunch.Stats.policy:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats.Policy - 15, // 11: cerbos.telemetry.v1.ServerLaunch.Stats.schema:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats.Schema + 15, // 10: cerbos.telemetry.v1.ServerLaunch.Stats.policy:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats.Policy + 16, // 11: cerbos.telemetry.v1.ServerLaunch.Stats.schema:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats.Schema 11, // 12: cerbos.telemetry.v1.ServerLaunch.Features.Storage.disk:type_name -> cerbos.telemetry.v1.ServerLaunch.Features.Storage.Disk 12, // 13: cerbos.telemetry.v1.ServerLaunch.Features.Storage.git:type_name -> cerbos.telemetry.v1.ServerLaunch.Features.Storage.Git 13, // 14: cerbos.telemetry.v1.ServerLaunch.Features.Storage.blob:type_name -> cerbos.telemetry.v1.ServerLaunch.Features.Storage.Blob - 21, // 15: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Git.poll_interval:type_name -> google.protobuf.Duration - 21, // 16: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Blob.poll_interval:type_name -> google.protobuf.Duration - 16, // 17: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.count:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats.Policy.CountEntry - 17, // 18: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.avg_rule_count:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats.Policy.AvgRuleCountEntry - 18, // 19: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.avg_condition_count:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats.Policy.AvgConditionCountEntry - 21, // 20: cerbos.telemetry.v1.Event.ApiActivity.uptime:type_name -> google.protobuf.Duration - 19, // 21: cerbos.telemetry.v1.Event.ApiActivity.method_calls:type_name -> cerbos.telemetry.v1.Event.CountStat - 19, // 22: cerbos.telemetry.v1.Event.ApiActivity.user_agents:type_name -> cerbos.telemetry.v1.Event.CountStat - 23, // [23:23] is the sub-list for method output_type - 23, // [23:23] is the sub-list for method input_type - 23, // [23:23] is the sub-list for extension type_name - 23, // [23:23] is the sub-list for extension extendee - 0, // [0:23] is the sub-list for field type_name + 14, // 15: cerbos.telemetry.v1.ServerLaunch.Features.Storage.bundle:type_name -> cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle + 22, // 16: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Git.poll_interval:type_name -> google.protobuf.Duration + 22, // 17: cerbos.telemetry.v1.ServerLaunch.Features.Storage.Blob.poll_interval:type_name -> google.protobuf.Duration + 17, // 18: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.count:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats.Policy.CountEntry + 18, // 19: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.avg_rule_count:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats.Policy.AvgRuleCountEntry + 19, // 20: cerbos.telemetry.v1.ServerLaunch.Stats.Policy.avg_condition_count:type_name -> cerbos.telemetry.v1.ServerLaunch.Stats.Policy.AvgConditionCountEntry + 22, // 21: cerbos.telemetry.v1.Event.ApiActivity.uptime:type_name -> google.protobuf.Duration + 20, // 22: cerbos.telemetry.v1.Event.ApiActivity.method_calls:type_name -> cerbos.telemetry.v1.Event.CountStat + 20, // 23: cerbos.telemetry.v1.Event.ApiActivity.user_agents:type_name -> cerbos.telemetry.v1.Event.CountStat + 24, // [24:24] is the sub-list for method output_type + 24, // [24:24] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] is the sub-list for field type_name } func init() { file_cerbos_telemetry_v1_telemetry_proto_init() } @@ -1589,7 +1679,7 @@ func file_cerbos_telemetry_v1_telemetry_proto_init() { } } file_cerbos_telemetry_v1_telemetry_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ServerLaunch_Stats_Policy); i { + switch v := v.(*ServerLaunch_Features_Storage_Bundle); i { case 0: return &v.state case 1: @@ -1601,6 +1691,18 @@ func file_cerbos_telemetry_v1_telemetry_proto_init() { } } file_cerbos_telemetry_v1_telemetry_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerLaunch_Stats_Policy); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cerbos_telemetry_v1_telemetry_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ServerLaunch_Stats_Schema); i { case 0: return &v.state @@ -1612,7 +1714,7 @@ func file_cerbos_telemetry_v1_telemetry_proto_init() { return nil } } - file_cerbos_telemetry_v1_telemetry_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + file_cerbos_telemetry_v1_telemetry_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Event_CountStat); i { case 0: return &v.state @@ -1624,7 +1726,7 @@ func file_cerbos_telemetry_v1_telemetry_proto_init() { return nil } } - file_cerbos_telemetry_v1_telemetry_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + file_cerbos_telemetry_v1_telemetry_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Event_ApiActivity); i { case 0: return &v.state @@ -1644,6 +1746,7 @@ func file_cerbos_telemetry_v1_telemetry_proto_init() { (*ServerLaunch_Features_Storage_Disk_)(nil), (*ServerLaunch_Features_Storage_Git_)(nil), (*ServerLaunch_Features_Storage_Blob_)(nil), + (*ServerLaunch_Features_Storage_Bundle_)(nil), } type x struct{} out := protoimpl.TypeBuilder{ @@ -1651,7 +1754,7 @@ func file_cerbos_telemetry_v1_telemetry_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cerbos_telemetry_v1_telemetry_proto_rawDesc, NumEnums: 0, - NumMessages: 21, + NumMessages: 22, NumExtensions: 0, NumServices: 0, }, diff --git a/api/genpb/cerbos/telemetry/v1/telemetry.pb.validate.go b/api/genpb/cerbos/telemetry/v1/telemetry.pb.validate.go index 5eb57df54..ed61a2c6a 100644 --- a/api/genpb/cerbos/telemetry/v1/telemetry.pb.validate.go +++ b/api/genpb/cerbos/telemetry/v1/telemetry.pb.validate.go @@ -1591,6 +1591,47 @@ func (m *ServerLaunch_Features_Storage) validate(all bool) error { } } + case *ServerLaunch_Features_Storage_Bundle_: + if v == nil { + err := ServerLaunch_Features_StorageValidationError{ + field: "Store", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetBundle()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ServerLaunch_Features_StorageValidationError{ + field: "Bundle", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ServerLaunch_Features_StorageValidationError{ + field: "Bundle", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetBundle()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ServerLaunch_Features_StorageValidationError{ + field: "Bundle", + reason: "embedded message failed validation", + cause: err, + } + } + } + default: _ = v // ensures v is used } @@ -2057,6 +2098,117 @@ var _ interface { ErrorName() string } = ServerLaunch_Features_Storage_BlobValidationError{} +// Validate checks the field values on ServerLaunch_Features_Storage_Bundle +// with the rules defined in the proto definition for this message. If any +// rules are violated, the first error encountered is returned, or nil if +// there are no violations. +func (m *ServerLaunch_Features_Storage_Bundle) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ServerLaunch_Features_Storage_Bundle +// with the rules defined in the proto definition for this message. If any +// rules are violated, the result is a list of violation errors wrapped in +// ServerLaunch_Features_Storage_BundleMultiError, or nil if none found. +func (m *ServerLaunch_Features_Storage_Bundle) ValidateAll() error { + return m.validate(true) +} + +func (m *ServerLaunch_Features_Storage_Bundle) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for PdpId + + // no validation rules for BundleSource + + // no validation rules for ClientId + + if len(errors) > 0 { + return ServerLaunch_Features_Storage_BundleMultiError(errors) + } + + return nil +} + +// ServerLaunch_Features_Storage_BundleMultiError is an error wrapping multiple +// validation errors returned by +// ServerLaunch_Features_Storage_Bundle.ValidateAll() if the designated +// constraints aren't met. +type ServerLaunch_Features_Storage_BundleMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ServerLaunch_Features_Storage_BundleMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ServerLaunch_Features_Storage_BundleMultiError) AllErrors() []error { return m } + +// ServerLaunch_Features_Storage_BundleValidationError is the validation error +// returned by ServerLaunch_Features_Storage_Bundle.Validate if the designated +// constraints aren't met. +type ServerLaunch_Features_Storage_BundleValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ServerLaunch_Features_Storage_BundleValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ServerLaunch_Features_Storage_BundleValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ServerLaunch_Features_Storage_BundleValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ServerLaunch_Features_Storage_BundleValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ServerLaunch_Features_Storage_BundleValidationError) ErrorName() string { + return "ServerLaunch_Features_Storage_BundleValidationError" +} + +// Error satisfies the builtin error interface +func (e ServerLaunch_Features_Storage_BundleValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sServerLaunch_Features_Storage_Bundle.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ServerLaunch_Features_Storage_BundleValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ServerLaunch_Features_Storage_BundleValidationError{} + // Validate checks the field values on ServerLaunch_Stats_Policy with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. diff --git a/api/genpb/cerbos/telemetry/v1/telemetry_hashpb.pb.go b/api/genpb/cerbos/telemetry/v1/telemetry_hashpb.pb.go index c94a0b4c4..25bb8273e 100644 --- a/api/genpb/cerbos/telemetry/v1/telemetry_hashpb.pb.go +++ b/api/genpb/cerbos/telemetry/v1/telemetry_hashpb.pb.go @@ -96,6 +96,14 @@ func (m *ServerLaunch_Features_Storage_Blob) HashPB(hasher hash.Hash, ignore map } } +// HashPB computes a hash of the message using the given hash function +// The ignore set must contain fully-qualified field names (pkg.msg.field) that should be ignored from the hash +func (m *ServerLaunch_Features_Storage_Bundle) HashPB(hasher hash.Hash, ignore map[string]struct{}) { + if m != nil { + cerbos_telemetry_v1_ServerLaunch_Features_Storage_Bundle_hashpb_sum(m, hasher, ignore) + } +} + // HashPB computes a hash of the message using the given hash function // The ignore set must contain fully-qualified field names (pkg.msg.field) that should be ignored from the hash func (m *ServerLaunch_Stats) HashPB(hasher hash.Hash, ignore map[string]struct{}) { diff --git a/api/genpb/cerbos/telemetry/v1/telemetry_vtproto.pb.go b/api/genpb/cerbos/telemetry/v1/telemetry_vtproto.pb.go index 2175854d0..cd99d33d7 100644 --- a/api/genpb/cerbos/telemetry/v1/telemetry_vtproto.pb.go +++ b/api/genpb/cerbos/telemetry/v1/telemetry_vtproto.pb.go @@ -462,6 +462,60 @@ func (m *ServerLaunch_Features_Storage_Blob) MarshalToSizedBufferVT(dAtA []byte) return len(dAtA) - i, nil } +func (m *ServerLaunch_Features_Storage_Bundle) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ServerLaunch_Features_Storage_Bundle) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *ServerLaunch_Features_Storage_Bundle) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = encodeVarint(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0x1a + } + if len(m.BundleSource) > 0 { + i -= len(m.BundleSource) + copy(dAtA[i:], m.BundleSource) + i = encodeVarint(dAtA, i, uint64(len(m.BundleSource))) + i-- + dAtA[i] = 0x12 + } + if len(m.PdpId) > 0 { + i -= len(m.PdpId) + copy(dAtA[i:], m.PdpId) + i = encodeVarint(dAtA, i, uint64(len(m.PdpId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *ServerLaunch_Features_Storage) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -568,6 +622,25 @@ func (m *ServerLaunch_Features_Storage_Blob_) MarshalToSizedBufferVT(dAtA []byte } return len(dAtA) - i, nil } +func (m *ServerLaunch_Features_Storage_Bundle_) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *ServerLaunch_Features_Storage_Bundle_) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Bundle != nil { + size, err := m.Bundle.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + return len(dAtA) - i, nil +} func (m *ServerLaunch_Features) MarshalVT() (dAtA []byte, err error) { if m == nil { return nil, nil @@ -1321,6 +1394,28 @@ func (m *ServerLaunch_Features_Storage_Blob) SizeVT() (n int) { return n } +func (m *ServerLaunch_Features_Storage_Bundle) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PdpId) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.BundleSource) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + l = len(m.ClientId) + if l > 0 { + n += 1 + l + sov(uint64(l)) + } + n += len(m.unknownFields) + return n +} + func (m *ServerLaunch_Features_Storage) SizeVT() (n int) { if m == nil { return 0 @@ -1374,6 +1469,18 @@ func (m *ServerLaunch_Features_Storage_Blob_) SizeVT() (n int) { } return n } +func (m *ServerLaunch_Features_Storage_Bundle_) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Bundle != nil { + l = m.Bundle.SizeVT() + n += 1 + l + sov(uint64(l)) + } + return n +} func (m *ServerLaunch_Features) SizeVT() (n int) { if m == nil { return 0 @@ -2586,6 +2693,153 @@ func (m *ServerLaunch_Features_Storage_Blob) UnmarshalVT(dAtA []byte) error { } return nil } +func (m *ServerLaunch_Features_Storage_Bundle) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ServerLaunch_Features_Storage_Bundle: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ServerLaunch_Features_Storage_Bundle: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PdpId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PdpId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BundleSource", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BundleSource = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ServerLaunch_Features_Storage) UnmarshalVT(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2770,6 +3024,47 @@ func (m *ServerLaunch_Features_Storage) UnmarshalVT(dAtA []byte) error { m.Store = &ServerLaunch_Features_Storage_Blob_{Blob: v} } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bundle", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Store.(*ServerLaunch_Features_Storage_Bundle_); ok { + if err := oneof.Bundle.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &ServerLaunch_Features_Storage_Bundle{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Store = &ServerLaunch_Features_Storage_Bundle_{Bundle: v} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skip(dAtA[iNdEx:]) diff --git a/api/public/cerbos/telemetry/v1/telemetry.proto b/api/public/cerbos/telemetry/v1/telemetry.proto index 51bec2464..e971e2146 100644 --- a/api/public/cerbos/telemetry/v1/telemetry.proto +++ b/api/public/cerbos/telemetry/v1/telemetry.proto @@ -57,11 +57,18 @@ message ServerLaunch { google.protobuf.Duration poll_interval = 2; } + message Bundle { + string pdp_id = 1; + string bundle_source = 2; + string client_id = 3; + } + string driver = 1; oneof store { Disk disk = 2; Git git = 3; Blob blob = 4; + Bundle bundle = 5; } } diff --git a/internal/storage/bundle/local_source.go b/internal/storage/bundle/local_source.go index 010d76dd0..d0c1707d5 100644 --- a/internal/storage/bundle/local_source.go +++ b/internal/storage/bundle/local_source.go @@ -161,3 +161,7 @@ func (ls *LocalSource) Close() error { return nil } + +func (ls *LocalSource) SourceKind() string { + return "local" +} diff --git a/internal/storage/bundle/remote_source.go b/internal/storage/bundle/remote_source.go index 58cf0cdf9..5ee45eb8b 100644 --- a/internal/storage/bundle/remote_source.go +++ b/internal/storage/bundle/remote_source.go @@ -5,7 +5,6 @@ package bundle import ( "context" - "crypto/md5" //nolint:gosec "crypto/tls" "crypto/x509" "errors" @@ -24,9 +23,7 @@ import ( "github.com/cerbos/cerbos/internal/util" cloudapi "github.com/cerbos/cloud-api/bundle" "github.com/cerbos/cloud-api/credentials" - pdpv1 "github.com/cerbos/cloud-api/genpb/cerbos/cloud/pdp/v1" "github.com/go-logr/zapr" - "github.com/google/uuid" "github.com/spf13/afero" "go.opencensus.io/stats" "go.opencensus.io/tag" @@ -80,7 +77,7 @@ func NewRemoteSource(conf *Conf) (*RemoteSource, error) { } func (s *RemoteSource) Init(ctx context.Context) error { - pdpID := getPDPIdentifier(s.conf.Credentials.InstanceID) + pdpID := util.PDPIdentifier(s.conf.Credentials.InstanceID) s.log = s.log.With(zap.String("instance", pdpID.Instance)) tlsConf := &tls.Config{ @@ -157,19 +154,6 @@ func (s *RemoteSource) InitWithClient(ctx context.Context, client CloudAPIClient return nil } -func getPDPIdentifier(instanceID string) *pdpv1.Identifier { - if instanceID == "" { - //nolint:gosec - nodeID := md5.Sum(uuid.NodeID()) - instanceID = fmt.Sprintf("%X-%d", nodeID, os.Getpid()) - } - - return &pdpv1.Identifier{ - Instance: instanceID, - Version: util.AppShortVersion(), - } -} - func shouldWorkOffline() bool { v := os.Getenv(offlineEnvVar) offline, err := strconv.ParseBool(v) @@ -472,3 +456,7 @@ func (s *RemoteSource) LoadSchema(ctx context.Context, id string) (io.ReadCloser func (s *RemoteSource) Reload(ctx context.Context) error { return s.fetchBundle(ctx) } + +func (s *RemoteSource) SourceKind() string { + return "remote" +} diff --git a/internal/storage/bundle/source_wrappers.go b/internal/storage/bundle/source_wrappers.go index ebbbf33fb..23a03a572 100644 --- a/internal/storage/bundle/source_wrappers.go +++ b/internal/storage/bundle/source_wrappers.go @@ -71,6 +71,14 @@ func (is instrumentedSource) Close() error { return nil } +func (is instrumentedSource) SourceKind() string { + if s, ok := is.source.(Source); ok { + return s.SourceKind() + } + + return "unknown" +} + func measureBinaryOp[T any](ctx context.Context, source, opName string, op func(context.Context) (T, error)) (T, error) { startTime := time.Now() result, err := withTrace(ctx, source, opName, op) diff --git a/internal/storage/bundle/store.go b/internal/storage/bundle/store.go index 815dda4b5..1b8d71a08 100644 --- a/internal/storage/bundle/store.go +++ b/internal/storage/bundle/store.go @@ -80,6 +80,10 @@ func NewStore(ctx context.Context, conf *Conf) (storage.BinaryStore, error) { } } +type Source interface { + SourceKind() string +} + type HybridStore struct { log *zap.Logger local storage.BinaryStore @@ -115,3 +119,7 @@ func (hs *HybridStore) LoadSchema(ctx context.Context, id string) (io.ReadCloser func (hs *HybridStore) GetPolicySet(ctx context.Context, id namer.ModuleID) (*runtimev1.RunnablePolicySet, error) { return hs.withActiveSource().GetPolicySet(ctx, id) } + +func (hs *HybridStore) SourceKind() string { + return "hybrid" +} diff --git a/internal/telemetry/server_launch.go b/internal/telemetry/server_launch.go index 53717472e..d8bf52404 100644 --- a/internal/telemetry/server_launch.go +++ b/internal/telemetry/server_launch.go @@ -15,6 +15,7 @@ import ( "github.com/cerbos/cerbos/internal/schema" "github.com/cerbos/cerbos/internal/storage" "github.com/cerbos/cerbos/internal/storage/blob" + "github.com/cerbos/cerbos/internal/storage/bundle" "github.com/cerbos/cerbos/internal/storage/disk" "github.com/cerbos/cerbos/internal/storage/git" "github.com/cerbos/cerbos/internal/util" @@ -25,7 +26,7 @@ func buildServerLaunch(store storage.Store) *telemetryv1.ServerLaunch { evt := &telemetryv1.ServerLaunch{ Version: "1.0.0", Source: extractSource(), - Features: extractFeatures(), + Features: extractFeatures(store), } if is, ok := store.(storage.Instrumented); ok { @@ -56,7 +57,7 @@ func extractSource() *telemetryv1.ServerLaunch_Source { return s } -func extractFeatures() *telemetryv1.ServerLaunch_Features { +func extractFeatures(store storage.Store) *telemetryv1.ServerLaunch_Features { feats := &telemetryv1.ServerLaunch_Features{} if auditConf, err := audit.GetConf(); err == nil { @@ -117,6 +118,20 @@ func extractFeatures() *telemetryv1.ServerLaunch_Features { feats.Storage.Store = &telemetryv1.ServerLaunch_Features_Storage_Blob_{Blob: b} } + case bundle.DriverName: + if bundleConf, err := bundle.GetConf(); err == nil { + pdpID := util.PDPIdentifier(bundleConf.Credentials.InstanceID) + b := &telemetryv1.ServerLaunch_Features_Storage_Bundle{ + PdpId: pdpID.GetInstance(), + ClientId: bundleConf.Credentials.ClientID, + } + + if src, ok := store.(bundle.Source); ok { + b.BundleSource = src.SourceKind() + } + + feats.Storage.Store = &telemetryv1.ServerLaunch_Features_Storage_Bundle_{Bundle: b} + } } } diff --git a/internal/util/app.go b/internal/util/app.go index b5cc6ea20..1b099283a 100644 --- a/internal/util/app.go +++ b/internal/util/app.go @@ -4,9 +4,14 @@ package util import ( + "crypto/md5" //nolint:gosec "fmt" + "os" "runtime/debug" "strings" + + pdpv1 "github.com/cerbos/cloud-api/genpb/cerbos/cloud/pdp/v1" + "github.com/google/uuid" ) var ( @@ -53,3 +58,16 @@ func AppShortVersion() string { return sb.String() } + +func PDPIdentifier(instanceID string) *pdpv1.Identifier { + if instanceID == "" { + //nolint:gosec + nodeID := md5.Sum(uuid.NodeID()) + instanceID = fmt.Sprintf("%X-%d", nodeID, os.Getpid()) + } + + return &pdpv1.Identifier{ + Instance: instanceID, + Version: AppShortVersion(), + } +} diff --git a/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch.schema.json b/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch.schema.json index abc9da1f6..3fb1037ce 100644 --- a/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch.schema.json +++ b/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch.schema.json @@ -78,6 +78,9 @@ "blob": { "$ref": "#/definitions/cerbos.telemetry.v1.ServerLaunch.Features.Storage.Blob" }, + "bundle": { + "$ref": "#/definitions/cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle" + }, "disk": { "$ref": "#/definitions/cerbos.telemetry.v1.ServerLaunch.Features.Storage.Disk" }, @@ -101,6 +104,21 @@ } } }, + "cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle": { + "type": "object", + "additionalProperties": false, + "properties": { + "bundleSource": { + "type": "string" + }, + "clientId": { + "type": "string" + }, + "pdpId": { + "type": "string" + } + } + }, "cerbos.telemetry.v1.ServerLaunch.Features.Storage.Disk": { "type": "object", "additionalProperties": false, diff --git a/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features.schema.json b/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features.schema.json index 6c4113c5f..a17373f63 100644 --- a/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features.schema.json +++ b/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features.schema.json @@ -39,6 +39,9 @@ "blob": { "$ref": "#/definitions/cerbos.telemetry.v1.ServerLaunch.Features.Storage.Blob" }, + "bundle": { + "$ref": "#/definitions/cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle" + }, "disk": { "$ref": "#/definitions/cerbos.telemetry.v1.ServerLaunch.Features.Storage.Disk" }, @@ -62,6 +65,21 @@ } } }, + "cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle": { + "type": "object", + "additionalProperties": false, + "properties": { + "bundleSource": { + "type": "string" + }, + "clientId": { + "type": "string" + }, + "pdpId": { + "type": "string" + } + } + }, "cerbos.telemetry.v1.ServerLaunch.Features.Storage.Disk": { "type": "object", "additionalProperties": false, diff --git a/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features/Storage.schema.json b/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features/Storage.schema.json index 1bad053cf..8175b9e44 100644 --- a/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features/Storage.schema.json +++ b/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features/Storage.schema.json @@ -14,6 +14,21 @@ } } }, + "cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle": { + "type": "object", + "additionalProperties": false, + "properties": { + "bundleSource": { + "type": "string" + }, + "clientId": { + "type": "string" + }, + "pdpId": { + "type": "string" + } + } + }, "cerbos.telemetry.v1.ServerLaunch.Features.Storage.Disk": { "type": "object", "additionalProperties": false, @@ -51,6 +66,9 @@ "blob": { "$ref": "#/definitions/cerbos.telemetry.v1.ServerLaunch.Features.Storage.Blob" }, + "bundle": { + "$ref": "#/definitions/cerbos.telemetry.v1.ServerLaunch.Features.Storage.Bundle" + }, "disk": { "$ref": "#/definitions/cerbos.telemetry.v1.ServerLaunch.Features.Storage.Disk" }, diff --git a/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features/Storage/Bundle.schema.json b/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features/Storage/Bundle.schema.json new file mode 100644 index 000000000..c4f783e38 --- /dev/null +++ b/schema/jsonschema/cerbos/telemetry/v1/ServerLaunch/Features/Storage/Bundle.schema.json @@ -0,0 +1,17 @@ +{ + "$id": "https://api.cerbos.dev/cerbos/telemetry/v1/ServerLaunch/Features/Storage/Bundle.schema.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "bundleSource": { + "type": "string" + }, + "clientId": { + "type": "string" + }, + "pdpId": { + "type": "string" + } + } +}