Skip to content

Commit 5b806dd

Browse files
Add version of Teku to VC metrics (#9298)
1 parent d1784ba commit 5b806dd

4 files changed

Lines changed: 26 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- updated graffiti watermarking to put the EL first and shrink the max size.
1414
- Increased the minimum thread count for batch signature verification to 4. If you are on less than a 4 cpu instance, you can override this back to default by using `--Xp2p-batch-verify-signatures-max-threads=2`
1515
- Increased the queue size limit for batch signature verification to 30000.
16+
- Introduced new metric `validator_teku_version_total` which tracks the Teku version in use when running a standalone VC
1617
- Added bootnode-only mode
1718

1819
### Bug Fixes

infrastructure/metrics/src/main/java/tech/pegasys/teku/infrastructure/metrics/TekuMetricCategory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public static Set<TekuMetricCategory> defaultCategories() {
5959
STORAGE,
6060
STORAGE_HOT_DB,
6161
STORAGE_FINALIZED_DB,
62-
REMOTE_VALIDATOR,
6362
VALIDATOR,
6463
VALIDATOR_PERFORMANCE,
6564
VALIDATOR_DUTY);

infrastructure/metrics/src/test/java/tech/pegasys/teku/infrastructure/metrics/TekuMetricCategoryTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.EXECUTOR;
2121
import static tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.LIBP2P;
2222
import static tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.NETWORK;
23-
import static tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.REMOTE_VALIDATOR;
2423
import static tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.STORAGE;
2524
import static tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.STORAGE_FINALIZED_DB;
2625
import static tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory.STORAGE_HOT_DB;
@@ -46,7 +45,6 @@ public void shouldProvideExpectedDefaultCategories() {
4645
STORAGE,
4746
STORAGE_HOT_DB,
4847
STORAGE_FINALIZED_DB,
49-
REMOTE_VALIDATOR,
5048
VALIDATOR,
5149
VALIDATOR_PERFORMANCE,
5250
VALIDATOR_DUTY);

validator/client/src/main/java/tech/pegasys/teku/validator/client/ValidatorClientService.java

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import org.apache.logging.log4j.Logger;
3030
import org.apache.tuweni.bytes.Bytes32;
3131
import org.hyperledger.besu.plugin.services.MetricsSystem;
32+
import org.hyperledger.besu.plugin.services.metrics.Counter;
33+
import org.hyperledger.besu.plugin.services.metrics.LabelledMetric;
3234
import tech.pegasys.teku.bls.BLSPublicKey;
3335
import tech.pegasys.teku.infrastructure.async.AsyncRunner;
3436
import tech.pegasys.teku.infrastructure.async.SafeFuture;
@@ -41,6 +43,7 @@
4143
import tech.pegasys.teku.infrastructure.metrics.TekuMetricCategory;
4244
import tech.pegasys.teku.infrastructure.restapi.RestApi;
4345
import tech.pegasys.teku.infrastructure.time.TimeProvider;
46+
import tech.pegasys.teku.infrastructure.version.VersionProvider;
4447
import tech.pegasys.teku.service.serviceutils.Service;
4548
import tech.pegasys.teku.service.serviceutils.ServiceConfig;
4649
import tech.pegasys.teku.service.serviceutils.layout.DataDirLayout;
@@ -169,9 +172,18 @@ public static ValidatorClientService create(
169172

170173
final ValidatorLoader validatorLoader =
171174
createValidatorLoader(services, config, asyncRunner, updatableGraffitiProvider);
175+
176+
final MetricsSystem metricsSystem = services.getMetricsSystem();
177+
178+
/* Only available when running a standalone VC client */
179+
if (validatorConfig.getSentryNodeConfigurationFile().isPresent()
180+
|| validatorConfig.getBeaconNodeApiEndpoints().isPresent()) {
181+
addVersionMetric(metricsSystem);
182+
}
183+
172184
final ValidatorStatusProvider validatorStatusProvider =
173185
new OwnedValidatorStatusProvider(
174-
services.getMetricsSystem(),
186+
metricsSystem,
175187
validatorLoader.getOwnedValidators(),
176188
validatorApiChannel,
177189
config.getSpec(),
@@ -234,7 +246,7 @@ public static ValidatorClientService create(
234246
beaconProposerPreparer,
235247
validatorRegistrator,
236248
config.getSpec(),
237-
services.getMetricsSystem(),
249+
metricsSystem,
238250
doppelgangerDetectionAction,
239251
maybeValidatorSlashedAction,
240252
services.getTimeProvider());
@@ -394,7 +406,6 @@ private static BeaconNodeApi createBeaconNodeApi(
394406
final SentryNodesConfig sentryNodesConfig =
395407
new SentryNodesConfigLoader()
396408
.load(validatorConfig.getSentryNodeConfigurationFile().get());
397-
398409
beaconNodeApi =
399410
SentryBeaconNodeApi.create(
400411
services,
@@ -566,6 +577,17 @@ private static void addValidatorCountMetric(
566577
validators::getValidatorCount);
567578
}
568579

580+
private static void addVersionMetric(final MetricsSystem metricsSystem) {
581+
final String version = VersionProvider.IMPLEMENTATION_VERSION.replaceAll("^v", "");
582+
final LabelledMetric<Counter> versionCounter =
583+
metricsSystem.createLabelledCounter(
584+
TekuMetricCategory.VALIDATOR,
585+
VersionProvider.CLIENT_IDENTITY + "_version_total",
586+
"Teku version in use",
587+
"version");
588+
versionCounter.labels(version).inc();
589+
}
590+
569591
@Override
570592
protected SafeFuture<?> doStart() {
571593
return initializationComplete

0 commit comments

Comments
 (0)