-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
225de97
commit 46a4f2b
Showing
6 changed files
with
108 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package executionclient | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/ssvlabs/ssv/observability" | ||
"go.opentelemetry.io/otel" | ||
"go.opentelemetry.io/otel/attribute" | ||
"go.opentelemetry.io/otel/metric" | ||
) | ||
|
||
const ( | ||
observabilityComponentName = "github.com/ssvlabs/ssv/eth/executionclient" | ||
observabilityComponentNamespace = "ssv.el" | ||
) | ||
|
||
type executionClientStatus string | ||
|
||
const ( | ||
statusSyncing = "syncing" | ||
statusFailure = "failure" | ||
statusReady = "ready" | ||
) | ||
|
||
var ( | ||
meter = otel.Meter(observabilityComponentName) | ||
|
||
latencyHistogram = observability.GetMetric( | ||
fmt.Sprintf("%s.latency.duration", observabilityComponentNamespace), | ||
func(metricName string) (metric.Float64Histogram, error) { | ||
return meter.Float64Histogram( | ||
metricName, | ||
metric.WithUnit("s"), | ||
metric.WithDescription("execution client latency in seconds"), | ||
metric.WithExplicitBucketBoundaries(observability.SecondsHistogramBuckets...), | ||
) | ||
}, | ||
) | ||
|
||
syncingDistanceGauge = observability.GetMetric( | ||
fmt.Sprintf("%s.syncing.distance", observabilityComponentNamespace), | ||
func(metricName string) (metric.Int64Gauge, error) { | ||
return meter.Int64Gauge( | ||
metricName, | ||
metric.WithUnit("{block}"), | ||
metric.WithDescription("execution client syncing distance which is a delta between highest and current blocks")) | ||
}, | ||
) | ||
|
||
clientStatusGauge = observability.GetMetric( | ||
fmt.Sprintf("%s.syncing.status", observabilityComponentNamespace), | ||
func(metricName string) (metric.Int64Gauge, error) { | ||
return meter.Int64Gauge( | ||
metricName, | ||
metric.WithDescription("execution client syncing status")) | ||
}, | ||
) | ||
|
||
lastProcessedBlockGauge = observability.GetMetric( | ||
fmt.Sprintf("%s.syncing.last_processed_block", observabilityComponentNamespace), | ||
func(metricName string) (metric.Int64Gauge, error) { | ||
return meter.Int64Gauge( | ||
metricName, | ||
metric.WithUnit("{block_number}"), | ||
metric.WithDescription("last processed block by execution client")) | ||
}, | ||
) | ||
) | ||
|
||
func executionClientAddrAttribute(value string) attribute.KeyValue { | ||
eventNameAttrName := fmt.Sprintf("%s.addr", observabilityComponentNamespace) | ||
return attribute.String(eventNameAttrName, value) | ||
} | ||
|
||
func executionClientStatusAttribute(value executionClientStatus) attribute.KeyValue { | ||
eventNameAttrName := fmt.Sprintf("%s.status", observabilityComponentNamespace) | ||
return attribute.String(eventNameAttrName, string(value)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters