mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 08:27:55 +00:00
client/network: Expose DHT query duration to Prometheus (#6784)
Expose duration of DHT put and get request as a Prometheus histogram.
This commit is contained in:
@@ -145,8 +145,9 @@ pub enum BehaviourOut<B: BlockT> {
|
||||
messages: Vec<(ConsensusEngineId, Bytes)>,
|
||||
},
|
||||
|
||||
/// Event generated by a DHT.
|
||||
Dht(DhtEvent),
|
||||
/// Events generated by a DHT as a response to get_value or put_value requests as well as the
|
||||
/// request duration.
|
||||
Dht(DhtEvent, Duration),
|
||||
}
|
||||
|
||||
impl<B: BlockT, H: ExHashT> Behaviour<B, H> {
|
||||
@@ -454,17 +455,17 @@ impl<B: BlockT, H: ExHashT> NetworkBehaviourEventProcess<DiscoveryOut>
|
||||
DiscoveryOut::Discovered(peer_id) => {
|
||||
self.substrate.add_discovered_nodes(iter::once(peer_id));
|
||||
}
|
||||
DiscoveryOut::ValueFound(results) => {
|
||||
self.events.push_back(BehaviourOut::Dht(DhtEvent::ValueFound(results)));
|
||||
DiscoveryOut::ValueFound(results, duration) => {
|
||||
self.events.push_back(BehaviourOut::Dht(DhtEvent::ValueFound(results), duration));
|
||||
}
|
||||
DiscoveryOut::ValueNotFound(key) => {
|
||||
self.events.push_back(BehaviourOut::Dht(DhtEvent::ValueNotFound(key)));
|
||||
DiscoveryOut::ValueNotFound(key, duration) => {
|
||||
self.events.push_back(BehaviourOut::Dht(DhtEvent::ValueNotFound(key), duration));
|
||||
}
|
||||
DiscoveryOut::ValuePut(key) => {
|
||||
self.events.push_back(BehaviourOut::Dht(DhtEvent::ValuePut(key)));
|
||||
DiscoveryOut::ValuePut(key, duration) => {
|
||||
self.events.push_back(BehaviourOut::Dht(DhtEvent::ValuePut(key), duration));
|
||||
}
|
||||
DiscoveryOut::ValuePutFailed(key) => {
|
||||
self.events.push_back(BehaviourOut::Dht(DhtEvent::ValuePutFailed(key)));
|
||||
DiscoveryOut::ValuePutFailed(key, duration) => {
|
||||
self.events.push_back(BehaviourOut::Dht(DhtEvent::ValuePutFailed(key), duration));
|
||||
}
|
||||
DiscoveryOut::RandomKademliaStarted(protocols) => {
|
||||
for protocol in protocols {
|
||||
|
||||
Reference in New Issue
Block a user