Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Chain id in Metrics #300

Merged
merged 4 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions domain/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
Expand Down
55 changes: 37 additions & 18 deletions protocol/bot_metrics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions protocol/bot_metrics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ message MetricSummary {
double p95 = 6;
string details = 7;
int32 shardId = 8;
int64 chainId = 9;
}

message AgentMetric {
Expand All @@ -28,6 +29,7 @@ message AgentMetric {
double value = 4;
string details = 5;
int32 shardId = 6;
int64 chainId = 7;
}

message AgentMetricList {
Expand Down
Loading