Skip to content

Commit 923fecd

Browse files
committed
Add Keyper count and threshold to batch config metric
1 parent 42f5625 commit 923fecd

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

rolling-shutter/keyper/keypermetrics/metrics.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ var MetricsKeyperBatchConfigInfo = prometheus.NewGaugeVec(
8787
Name: "batch_config_info",
8888
Help: "Information about the batch configuration in use",
8989
},
90-
[]string{"batch_config_index", "keyper_addresses"})
90+
[]string{"batch_config_index", "keyper_addresses", "keyper_count", "threshold"},
91+
)
9192

9293
var MetricsKeyperDKGStatus = prometheus.NewGaugeVec(
9394
prometheus.GaugeOpts{
@@ -199,7 +200,12 @@ func InitMetrics(dbpool *pgxpool.Pool, config kprconfig.Config) {
199200

200201
// Join keyper addresses for the label
201202
keyperAddresses := strings.Join(batchConfig.Keypers, ",")
202-
MetricsKeyperBatchConfigInfo.WithLabelValues(batchConfigIndexStr, keyperAddresses).Set(1)
203+
204+
keyperCount := strconv.Itoa(len(batchConfig.Keypers))
205+
206+
threshold := strconv.FormatInt(int64(batchConfig.Threshold), 10)
207+
208+
MetricsKeyperBatchConfigInfo.WithLabelValues(batchConfigIndexStr, keyperAddresses, keyperCount, threshold).Set(1)
203209

204210
// Check if current node is a keyper in this batch config
205211
isKeyper := false

rolling-shutter/keyper/smobserver/smstate.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,12 @@ func (st *ShuttermintState) handleBatchConfig(
273273
for _, k := range e.Keypers {
274274
keypers = append(keypers, shdb.EncodeAddress(k))
275275
}
276-
keypermetrics.MetricsKeyperBatchConfigInfo.WithLabelValues(strconv.FormatUint(e.KeyperConfigIndex, 10), strings.Join(keypers, ",")).Set(1)
276+
keypermetrics.MetricsKeyperBatchConfigInfo.WithLabelValues(
277+
strconv.FormatUint(e.KeyperConfigIndex, 10),
278+
strings.Join(keypers, ","),
279+
strconv.Itoa(len(e.Keypers)),
280+
strconv.FormatUint(e.Threshold, 10),
281+
).Set(1)
277282
if err := queries.InsertBatchConfig(
278283
ctx,
279284
database.InsertBatchConfigParams{

0 commit comments

Comments
 (0)