Skip to content

Commit

Permalink
Added provider_endpoint to lava_consumer_latest_provider_block
Browse files Browse the repository at this point in the history
  • Loading branch information
fbjohnny committed Dec 19, 2024
1 parent 6c60e63 commit 9e0a80b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion protocol/lavasession/consumer_session_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1093,9 +1093,10 @@ func (csm *ConsumerSessionManager) updateMetricsManager(consumerSession *SingleC
lastQosExcellence = &qosEx
}
publicProviderAddress := consumerSession.Parent.PublicLavaAddress
publicProviderEndpoint := consumerSession.Parent.Endpoints[0].NetworkAddress

go func() {
csm.consumerMetricsManager.SetQOSMetrics(chainId, apiInterface, publicProviderAddress, lastQos, lastQosExcellence, consumerSession.LatestBlock, consumerSession.RelayNum, relayLatency, sessionSuccessful)
csm.consumerMetricsManager.SetQOSMetrics(chainId, apiInterface, publicProviderAddress, publicProviderEndpoint, lastQos, lastQosExcellence, consumerSession.LatestBlock, consumerSession.RelayNum, relayLatency, sessionSuccessful)
}()
}

Expand Down
6 changes: 3 additions & 3 deletions protocol/metrics/consumer_metrics_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func NewConsumerMetricsManager(options ConsumerMetricsManagerOptions) *ConsumerM
latestBlockMetric := prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "lava_consumer_latest_provider_block",
Help: "The latest block reported by provider",
}, []string{"spec", "provider_address", "apiInterface"})
}, []string{"spec", "provider_address", "apiInterface", "provider_endpoint"})

latestProviderRelay := prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "lava_consumer_latest_provider_relay_time",
Expand Down Expand Up @@ -449,7 +449,7 @@ func (pme *ConsumerMetricsManager) getKeyForProcessingLatency(chainId string, ap
return header + "_" + chainId + "_" + apiInterface
}

func (pme *ConsumerMetricsManager) SetQOSMetrics(chainId string, apiInterface string, providerAddress string, qos *pairingtypes.QualityOfServiceReport, qosExcellence *pairingtypes.QualityOfServiceReport, latestBlock int64, relays uint64, relayLatency time.Duration, sessionSuccessful bool) {
func (pme *ConsumerMetricsManager) SetQOSMetrics(chainId string, apiInterface string, providerAddress string, providerEndpoint string, qos *pairingtypes.QualityOfServiceReport, qosExcellence *pairingtypes.QualityOfServiceReport, latestBlock int64, relays uint64, relayLatency time.Duration, sessionSuccessful bool) {
if pme == nil {
return
}
Expand Down Expand Up @@ -509,7 +509,7 @@ func (pme *ConsumerMetricsManager) SetQOSMetrics(chainId string, apiInterface st
setMetricsForQos(qos, pme.qosMetric, apiInterface)
setMetricsForQos(qosExcellence, pme.qosExcellenceMetric, "") // it's one for all of them

pme.LatestBlockMetric.WithLabelValues(chainId, providerAddress, apiInterface).Set(float64(latestBlock))
pme.LatestBlockMetric.WithLabelValues(chainId, providerAddress, apiInterface, providerEndpoint).Set(float64(latestBlock))
}

func (pme *ConsumerMetricsManager) SetVirtualEpoch(virtualEpoch uint64) {
Expand Down

0 comments on commit 9e0a80b

Please sign in to comment.