Skip to content

Commit

Permalink
Add debug to the other services
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmarslender committed Sep 28, 2023
1 parent 46c99fd commit 29d144f
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 1 deletion.
8 changes: 8 additions & 0 deletions internal/metrics/crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ type CrawlerServiceMetrics struct {
ipv6Nodes5Days *wrappedPrometheus.LazyGauge
versionBuckets *prometheus.GaugeVec
countryNodeCountBuckets *prometheus.GaugeVec

// Debug Metric
debug *prometheus.GaugeVec
}

// InitMetrics sets all the metrics properties
Expand All @@ -49,6 +52,9 @@ func (s *CrawlerServiceMetrics) InitMetrics() {
s.versionBuckets = s.metrics.newGaugeVec(chiaServiceCrawler, "peer_version", "Number of peers for each version. Only peers the crawler was able to connect to are included here.", []string{"version"})
s.countryNodeCountBuckets = s.metrics.newGaugeVec(chiaServiceCrawler, "country_node_count", "Number of peers gossiped in the last 5 days from each country.", []string{"country", "country_display"})

// Debug Metric
s.debug = s.metrics.newGaugeVec(chiaServiceCrawler, "debug_metrics", "random debugging metrics distinguished by labels", []string{"key"})

err := s.initMaxmindDB()
if err != nil {
// Continue on maxmind error - optional/not critical functionality
Expand Down Expand Up @@ -104,6 +110,8 @@ func (s *CrawlerServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse) {
fallthrough
case "crawl_batch_completed":
s.GetPeerCounts(resp)
case "debug":
debugHelper(resp, s.debug)
}
}

Expand Down
8 changes: 8 additions & 0 deletions internal/metrics/farmer.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ type FarmerServiceMetrics struct {
totalEligiblePlots *prometheus.CounterVec
lastEligiblePlots *prometheus.GaugeVec
lastLookupTime *prometheus.GaugeVec

// Debug Metric
debug *prometheus.GaugeVec
}

// InitMetrics sets all the metrics properties
Expand Down Expand Up @@ -75,6 +78,9 @@ func (s *FarmerServiceMetrics) InitMetrics() {
s.totalEligiblePlots = s.metrics.newCounterVec(chiaServiceFarmer, "total_eligible_plots", "Counter of total eligible plots since the exporter started", []string{"host", "node_id"})
s.lastEligiblePlots = s.metrics.newGaugeVec(chiaServiceFarmer, "last_eligible_plots", "Number of eligible plots for the last farmer_info event", []string{"host", "node_id"})
s.lastLookupTime = s.metrics.newGaugeVec(chiaServiceFarmer, "last_lookup_time", "Lookup time for the last farmer_info event", []string{"host", "node_id"})

// Debug Metric
s.debug = s.metrics.newGaugeVec(chiaServiceFarmer, "debug_metrics", "random debugging metrics distinguished by labels", []string{"key"})
}

// InitialData is called on startup of the metrics server, to allow seeding metrics with current/initial data
Expand Down Expand Up @@ -117,6 +123,8 @@ func (s *FarmerServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse) {
fallthrough
case "close_connection":
utils.LogErr(s.metrics.client.FarmerService.GetConnections(&rpc.GetConnectionsOptions{}))
case "debug":
debugHelper(resp, s.debug)
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/metrics/fullnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (s *FullNodeServiceMetrics) InitMetrics() {
s.subEpochSummaries = s.metrics.newGauge(chiaServiceFullNode, "sub_epoch_summaries_filesize", "Size of sub_epoch_summaries file")

// Debug Metric
s.debug = s.metrics.newGaugeVec(chiaServiceFullNode, "debug_metrics", "random debugging metrics distinguished by labels", []string{"key"})
s.debug = s.metrics.newGaugeVec(chiaServiceFullNode, "debug_metrics", "misc debugging metrics distinguished by labels", []string{"key"})
}

// InitialData is called on startup of the metrics server, to allow seeding metrics with
Expand Down
8 changes: 8 additions & 0 deletions internal/metrics/harvester.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ type HarvesterServiceMetrics struct {
totalEligiblePlots *wrappedPrometheus.LazyCounter
lastEligiblePlots *wrappedPrometheus.LazyGauge
lastLookupTime *wrappedPrometheus.LazyGauge

// Debug Metric
debug *prometheus.GaugeVec
}

// InitMetrics sets all the metrics properties
Expand All @@ -57,6 +60,9 @@ func (s *HarvesterServiceMetrics) InitMetrics() {
s.lastEligiblePlots = s.metrics.newGauge(chiaServiceHarvester, "last_eligible_plots", "Number of eligible plots for the last farmer_info event")

s.lastLookupTime = s.metrics.newGauge(chiaServiceHarvester, "last_lookup_time", "Lookup time for the last farmer_info event")

// Debug Metric
s.debug = s.metrics.newGaugeVec(chiaServiceHarvester, "debug_metrics", "random debugging metrics distinguished by labels", []string{"key"})
}

// InitialData is called on startup of the metrics server, to allow seeding metrics with current/initial data
Expand Down Expand Up @@ -111,6 +117,8 @@ func (s *HarvesterServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse)
s.FarmingInfo(resp)
case "get_plots":
s.GetPlots(resp)
case "debug":
debugHelper(resp, s.debug)
}
}

Expand Down
8 changes: 8 additions & 0 deletions internal/metrics/timelord.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ type TimelordServiceMetrics struct {
slowTimelord *wrappedPrometheus.LazyCounter
estimatedIPS *wrappedPrometheus.LazyGauge
compactProofsFound *prometheus.CounterVec

// Debug Metric
debug *prometheus.GaugeVec
}

// InitMetrics sets all the metrics properties
Expand All @@ -33,6 +36,9 @@ func (s *TimelordServiceMetrics) InitMetrics() {
s.slowTimelord = s.metrics.newCounter(chiaServiceTimelord, "slow_timelord", "Counter for how many times this timelord has NOT been the fastest since the exporter has been running")
s.estimatedIPS = s.metrics.newGauge(chiaServiceTimelord, "estimated_ips", "Current estimated IPS. Updated every time a new PoT Challenge is complete")
s.compactProofsFound = s.metrics.newCounterVec(chiaServiceTimelord, "compact_proofs_completed", "Count of the number of compact proofs by proof type since the exporter was started", []string{"vdf_field"})

// Debug Metric
s.debug = s.metrics.newGaugeVec(chiaServiceTimelord, "debug_metrics", "random debugging metrics distinguished by labels", []string{"key"})
}

// InitialData is called on startup of the metrics server, to allow seeding metrics with
Expand Down Expand Up @@ -69,6 +75,8 @@ func (s *TimelordServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse)
s.SkippingPeak(resp)
case "new_peak":
s.NewPeak(resp)
case "debug":
debugHelper(resp, s.debug)
}
}

Expand Down
8 changes: 8 additions & 0 deletions internal/metrics/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ type WalletServiceMetrics struct {
maxSendAmount *prometheus.GaugeVec
pendingCoinRemovalCount *prometheus.GaugeVec
unspentCoinCount *prometheus.GaugeVec

// Debug Metric
debug *prometheus.GaugeVec
}

// InitMetrics sets all the metrics properties
Expand All @@ -48,6 +51,9 @@ func (s *WalletServiceMetrics) InitMetrics() {
s.maxSendAmount = s.metrics.newGaugeVec(chiaServiceWallet, "max_send_amount", "", walletLabels)
s.pendingCoinRemovalCount = s.metrics.newGaugeVec(chiaServiceWallet, "pending_coin_removal_count", "", walletLabels)
s.unspentCoinCount = s.metrics.newGaugeVec(chiaServiceWallet, "unspent_coin_count", "", walletLabels)

// Debug Metric
s.debug = s.metrics.newGaugeVec(chiaServiceWallet, "debug_metrics", "misc debugging metrics distinguished by labels", []string{"key"})
}

// InitialData is called on startup of the metrics server, to allow seeding metrics with
Expand Down Expand Up @@ -98,6 +104,8 @@ func (s *WalletServiceMetrics) ReceiveResponse(resp *types.WebsocketResponse) {
s.GetWalletBalance(resp)
case "get_wallets":
s.GetWallets(resp)
case "debug":
debugHelper(resp, s.debug)
}
}

Expand Down

0 comments on commit 29d144f

Please sign in to comment.