diff --git a/domain/metrics.go b/domain/metrics.go index ec5faa9..2ac9d25 100644 --- a/domain/metrics.go +++ b/domain/metrics.go @@ -7,6 +7,64 @@ func IsMetricAllowed(metric string) bool { // Metric names that are allowed for processing by Forta const ( + MetricClientDial = "agent.client.dial" + MetricClientClose = "agent.client.close" + + MetricStatusRunning = "agent.status.running" + MetricStatusAttached = "agent.status.attached" + MetricStatusInitialized = "agent.status.initialized" + MetricStatusStopping = "agent.status.stopping" + MetricStatusActive = "agent.status.active" + MetricStatusInactive = "agent.status.inactive" + + MetricActionUpdate = "agent.action.update" + MetricActionRestart = "agent.action.restart" + MetricActionSubscribe = "agent.action.subscribe" + MetricActionUnsubscribe = "agent.action.unsubscribe" + + MetricFailurePull = "agent.failure.pull" + MetricFailureLaunch = "agent.failure.launch" + MetricFailureStop = "agent.failure.stop" + MetricFailureDial = "agent.failure.dial" + MetricFailureInitialize = "agent.failure.initialize" + MetricFailureInitializeResponse = "agent.failure.initialize.response" + MetricFailureInitializeValidate = "agent.failure.initialize.validate" + MetricFailureTooManyErrs = "agent.failure.too-many-errs" + + MetricHealthCheckAttempt = "agent.health.attempt" + MetricHealthCheckSuccess = "agent.health.success" + MetricHealthCheckError = "agent.health.error" + + MetricFinding = "finding" + MetricTxRequest = "tx.request" + MetricTxLatency = "tx.latency" + MetricTxError = "tx.error" + MetricTxSuccess = "tx.success" + MetricTxDrop = "tx.drop" + MetricTxBlockAge = "tx.block.age" + MetricTxEventAge = "tx.event.age" + MetricBlockBlockAge = "block.block.age" + MetricBlockEventAge = "block.event.age" + MetricBlockRequest = "block.request" + MetricBlockLatency = "block.latency" + MetricBlockError = "block.error" + MetricBlockSuccess = "block.success" + MetricBlockDrop = "block.drop" + + MetricJSONRPCLatency = "jsonrpc.latency" + MetricJSONRPCRequest = "jsonrpc.request" + MetricJSONRPCSuccess = "jsonrpc.success" + MetricJSONRPCThrottled = "jsonrpc.throttled" + MetricPublicAPIProxyLatency = "publicapi.latency" + MetricPublicAPIProxyRequest = "publicapi.request" + MetricPublicAPIProxySuccess = "publicapi.success" + MetricPublicAPIProxyThrottled = "publicapi.throttled" + MetricFindingsDropped = "findings.dropped" + MetricCombinerRequest = "combiner.request" + MetricCombinerLatency = "combiner.latency" + MetricCombinerError = "combiner.error" + MetricCombinerSuccess = "combiner.success" + MetricCombinerDrop = "combiner.drop" MetricDockerEventPull = "docker.image.pull" MetricDockerEventContainerCreate = "docker.container.create" MetricDockerEventContainerDestroy = "docker.container.destroy" @@ -24,6 +82,64 @@ const ( var ( allMetrics = map[string]interface{}{ + MetricClientDial: nil, + MetricClientClose: nil, + + MetricStatusRunning: nil, + MetricStatusAttached: nil, + MetricStatusInitialized: nil, + MetricStatusStopping: nil, + MetricStatusActive: nil, + MetricStatusInactive: nil, + + MetricActionUpdate: nil, + MetricActionRestart: nil, + MetricActionSubscribe: nil, + MetricActionUnsubscribe: nil, + + MetricFailurePull: nil, + MetricFailureLaunch: nil, + MetricFailureStop: nil, + MetricFailureDial: nil, + MetricFailureInitialize: nil, + MetricFailureInitializeResponse: nil, + MetricFailureInitializeValidate: nil, + MetricFailureTooManyErrs: nil, + + MetricHealthCheckAttempt: nil, + MetricHealthCheckSuccess: nil, + MetricHealthCheckError: nil, + + MetricFinding: nil, + MetricTxRequest: nil, + MetricTxLatency: nil, + MetricTxError: nil, + MetricTxSuccess: nil, + MetricTxDrop: nil, + MetricTxBlockAge: nil, + MetricTxEventAge: nil, + MetricBlockBlockAge: nil, + MetricBlockEventAge: nil, + MetricBlockRequest: nil, + MetricBlockLatency: nil, + MetricBlockError: nil, + MetricBlockSuccess: nil, + MetricBlockDrop: nil, + + MetricJSONRPCLatency: nil, + MetricJSONRPCRequest: nil, + MetricJSONRPCSuccess: nil, + MetricJSONRPCThrottled: nil, + MetricPublicAPIProxyLatency: nil, + MetricPublicAPIProxyRequest: nil, + MetricPublicAPIProxySuccess: nil, + MetricPublicAPIProxyThrottled: nil, + MetricFindingsDropped: nil, + MetricCombinerRequest: nil, + MetricCombinerLatency: nil, + MetricCombinerError: nil, + MetricCombinerSuccess: nil, + MetricCombinerDrop: nil, MetricDockerEventPull: nil, MetricDockerEventContainerCreate: nil, MetricDockerEventContainerDestroy: nil, diff --git a/protocol/bot_metrics.pb.go b/protocol/bot_metrics.pb.go index 55111c7..04b9182 100644 --- a/protocol/bot_metrics.pb.go +++ b/protocol/bot_metrics.pb.go @@ -97,6 +97,7 @@ type MetricSummary struct { P95 float64 `protobuf:"fixed64,6,opt,name=p95,proto3" json:"p95,omitempty"` Details string `protobuf:"bytes,7,opt,name=details,proto3" json:"details,omitempty"` ShardId int32 `protobuf:"varint,8,opt,name=shardId,proto3" json:"shardId,omitempty"` + ChainId int64 `protobuf:"varint,9,opt,name=chainId,proto3" json:"chainId,omitempty"` } func (x *MetricSummary) Reset() { @@ -187,6 +188,13 @@ func (x *MetricSummary) GetShardId() int32 { return 0 } +func (x *MetricSummary) GetChainId() int64 { + if x != nil { + return x.ChainId + } + return 0 +} + type AgentMetric struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -198,6 +206,7 @@ type AgentMetric struct { Value float64 `protobuf:"fixed64,4,opt,name=value,proto3" json:"value,omitempty"` Details string `protobuf:"bytes,5,opt,name=details,proto3" json:"details,omitempty"` ShardId int32 `protobuf:"varint,6,opt,name=shardId,proto3" json:"shardId,omitempty"` + ChainId int64 `protobuf:"varint,7,opt,name=chainId,proto3" json:"chainId,omitempty"` } func (x *AgentMetric) Reset() { @@ -274,6 +283,13 @@ func (x *AgentMetric) GetShardId() int32 { return 0 } +func (x *AgentMetric) GetChainId() int64 { + if x != nil { + return x.ChainId + } + return 0 +} + type AgentMetricList struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -334,7 +350,7 @@ var file_bot_metrics_proto_rawDesc = []byte{ 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x66, 0x6f, 0x72, 0x74, 0x61, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x73, 0x22, 0xbd, 0x01, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x75, 0x6d, + 0x63, 0x73, 0x22, 0xd7, 0x01, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x10, @@ -346,23 +362,26 @@ var file_bot_metrics_proto_rawDesc = []byte{ 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x68, 0x61, 0x72, 0x64, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x68, 0x61, 0x72, 0x64, - 0x49, 0x64, 0x22, 0xa3, 0x01, 0x0a, 0x0b, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x18, - 0x0a, 0x07, 0x73, 0x68, 0x61, 0x72, 0x64, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x07, 0x73, 0x68, 0x61, 0x72, 0x64, 0x49, 0x64, 0x22, 0x47, 0x0a, 0x0f, 0x41, 0x67, 0x65, 0x6e, - 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x07, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x66, 0x6f, 0x72, 0x74, 0x61, 0x2e, 0x41, 0x67, 0x65, - 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x07, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x73, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xbd, 0x01, 0x0a, + 0x0b, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, + 0x67, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, + 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x68, 0x61, 0x72, + 0x64, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x68, 0x61, 0x72, 0x64, + 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0x47, 0x0a, 0x0f, + 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x4c, 0x69, 0x73, 0x74, 0x12, + 0x34, 0x0a, 0x07, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2e, 0x66, 0x6f, 0x72, 0x74, 0x61, + 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x07, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x73, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/protocol/bot_metrics.proto b/protocol/bot_metrics.proto index 40d30af..1ba5e95 100644 --- a/protocol/bot_metrics.proto +++ b/protocol/bot_metrics.proto @@ -19,6 +19,7 @@ message MetricSummary { double p95 = 6; string details = 7; int32 shardId = 8; + int64 chainId = 9; } message AgentMetric { @@ -28,6 +29,7 @@ message AgentMetric { double value = 4; string details = 5; int32 shardId = 6; + int64 chainId = 7; } message AgentMetricList {