Skip to content

Commit

Permalink
feat: add metric to track default validator configuration (#7194)
Browse files Browse the repository at this point in the history
* Add metric to track default validator configuration

* Update validator client dashboard

* Rename column
  • Loading branch information
nflaig authored Oct 28, 2024
1 parent 4b08c0b commit 4c757cb
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 3 deletions.
91 changes: 88 additions & 3 deletions dashboards/lodestar_validator_client.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@
},
"gridPos": {
"h": 3,
"w": 6,
"w": 3,
"x": 12,
"y": 2
},
Expand Down Expand Up @@ -552,8 +552,8 @@
},
"gridPos": {
"h": 3,
"w": 6,
"x": 18,
"w": 3,
"x": 15,
"y": 2
},
"id": 37,
Expand Down Expand Up @@ -590,6 +590,91 @@
"title": "Heap used",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"custom": {
"align": "center",
"cellOptions": {
"type": "color-text"
},
"inspect": false
},
"mappings": []
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 6,
"x": 18,
"y": 2
},
"id": 48,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"enablePagination": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"showHeader": true
},
"pluginVersion": "10.4.1",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${DS_PROMETHEUS}"
},
"editorMode": "code",
"exemplar": false,
"expr": "vc_default_configuration",
"format": "table",
"instant": true,
"legendFormat": "__auto",
"range": false,
"refId": "A"
}
],
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {
"Time": true,
"Value": true,
"__name__": true,
"client_name": true,
"group": true,
"host_type": true,
"instance": true,
"job": true,
"network": true,
"scrape_location": true
},
"includeByName": {},
"indexByName": {},
"renameByName": {
"broadcastValidation": "Broadcast validation",
"builderSelection": "Builder selection"
}
}
}
],
"type": "table"
},
{
"datasource": {
"type": "prometheus",
Expand Down
10 changes: 10 additions & 0 deletions packages/validator/src/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {routes} from "@lodestar/api";
import {MetricsRegisterExtra} from "@lodestar/utils";

export enum MessageSource {
Expand Down Expand Up @@ -38,6 +39,15 @@ export function getMetrics(register: MetricsRegisterExtra, gitData: LodestarGitD
.set(gitData, 1);

return {
defaultConfiguration: register.gauge<{
builderSelection: routes.validator.BuilderSelection;
broadcastValidation: routes.beacon.BroadcastValidation;
}>({
name: "vc_default_configuration",
help: "Default validator configuration",
labelNames: ["builderSelection", "broadcastValidation"],
}),

// Attestation journey:
// - Wait for block or 1/3, call prepare attestation
// - Get attestation, sign, call publish
Expand Down
2 changes: 2 additions & 0 deletions packages/validator/src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ export class Validator {
strictFeeRecipientCheck,
});

metrics?.defaultConfiguration.set({builderSelection: defaultBuilderSelection, broadcastValidation}, 1);

// Instantiates block and attestation services and runs them once the chain has been started.
return Validator.init(opts, genesis, metrics);
}
Expand Down

0 comments on commit 4c757cb

Please sign in to comment.