Skip to content

Commit eb953a6

Browse files
authored
Merge pull request #897 from SiaFoundation/nate/fix-metrics-panic
Fix missing syncer metrics
2 parents b71fe54 + 61bf188 commit eb953a6

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

api/prometheus.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ func (m Metrics) PrometheusMetric() []prometheus.Metric {
298298
Name: "hostd_metrics_data_rhp_egress",
299299
Value: float64(m.Data.RHP.Egress),
300300
},
301+
{
302+
Name: "hostd_metrics_data_syncer_ingress",
303+
Value: float64(m.Data.Syncer.Ingress),
304+
},
305+
{
306+
Name: "hostd_metrics_data_syncer_egress",
307+
Value: float64(m.Data.Syncer.Egress),
308+
},
301309
{
302310
Name: "hostd_metrics_wallet_balance",
303311
Value: m.Wallet.Balance.Siacoins(),

host/metrics/types.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ type (
3131

3232
// DataMetrics is a collection of metrics related to data usage.
3333
DataMetrics struct {
34-
RHP RHPData `json:"rhp"`
34+
RHP Data `json:"rhp"`
35+
Syncer Data `json:"syncer"`
3536
}
3637

37-
// RHPData is a collection of data metrics related to the RHP.
38-
RHPData struct {
38+
// Data is a collection of data metrics related to the RHP and Syncer.
39+
Data struct {
3940
// Ingress returns the number of bytes received by the host.
4041
Ingress uint64 `json:"ingress"`
4142
// Egress returns the number of bytes sent by the host.

persist/sqlite/metrics.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,10 @@ func mustParseMetricValue(stat string, buf []byte, m *metrics.Metrics) {
424424
m.Data.RHP.Ingress = mustScanUint64(buf)
425425
case metricDataRHPEgress:
426426
m.Data.RHP.Egress = mustScanUint64(buf)
427+
case metricDataSyncerEgress:
428+
m.Data.Syncer.Egress = mustScanUint64(buf)
429+
case metricDataSyncerIngress:
430+
m.Data.Syncer.Ingress = mustScanUint64(buf)
427431
// potential revenue
428432
case metricPotentialRPCRevenue:
429433
m.Revenue.Potential.RPC = mustScanCurrency(buf)

0 commit comments

Comments
 (0)