mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Complex headers+messages Millau<->Rialto relay (#878)
* complex headers+messages relay * post-merge fix * fix + test issue with on-demand not starting
This commit is contained in:
committed by
Bastian Köcher
parent
0d60f42b5e
commit
e2131724fb
@@ -19,7 +19,7 @@ use crate::client::Client;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use codec::Decode;
|
||||
use relay_utils::metrics::{register, Gauge, Metrics, Registry, StandaloneMetrics, F64};
|
||||
use relay_utils::metrics::{metric_name, register, Gauge, PrometheusError, Registry, StandaloneMetrics, F64};
|
||||
use sp_core::storage::StorageKey;
|
||||
use sp_runtime::{traits::UniqueSaturatedInto, FixedPointNumber};
|
||||
use std::time::Duration;
|
||||
@@ -39,29 +39,20 @@ pub struct FloatStorageValueMetric<C: Chain, T: Clone> {
|
||||
impl<C: Chain, T: Decode + FixedPointNumber> FloatStorageValueMetric<C, T> {
|
||||
/// Create new metric.
|
||||
pub fn new(
|
||||
registry: &Registry,
|
||||
prefix: Option<&str>,
|
||||
client: Client<C>,
|
||||
storage_key: StorageKey,
|
||||
maybe_default_value: Option<T>,
|
||||
name: String,
|
||||
help: String,
|
||||
) -> Self {
|
||||
FloatStorageValueMetric {
|
||||
) -> Result<Self, PrometheusError> {
|
||||
Ok(FloatStorageValueMetric {
|
||||
client,
|
||||
storage_key,
|
||||
maybe_default_value,
|
||||
metric: Gauge::new(name, help).expect(
|
||||
"only fails if gauge options are customized;\
|
||||
we use default options;\
|
||||
qed",
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: Chain, T: Clone + Send + Sync + 'static> Metrics for FloatStorageValueMetric<C, T> {
|
||||
fn register(&self, registry: &Registry) -> Result<(), String> {
|
||||
register(self.metric.clone(), registry).map_err(|e| e.to_string())?;
|
||||
Ok(())
|
||||
metric: register(Gauge::new(metric_name(prefix, &name), help)?, registry)?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ use crate::client::Client;
|
||||
use crate::error::Error;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use relay_utils::metrics::{register, Gauge, Metrics, Registry, StandaloneMetrics, U64};
|
||||
use relay_utils::metrics::{metric_name, register, Gauge, PrometheusError, Registry, StandaloneMetrics, U64};
|
||||
use sp_core::storage::StorageKey;
|
||||
use sp_runtime::traits::Header as HeaderT;
|
||||
use sp_storage::well_known_keys::CODE;
|
||||
@@ -49,15 +49,17 @@ impl<C: Chain> Clone for StorageProofOverheadMetric<C> {
|
||||
|
||||
impl<C: Chain> StorageProofOverheadMetric<C> {
|
||||
/// Create new metric instance with given name and help.
|
||||
pub fn new(client: Client<C>, name: String, help: String) -> Self {
|
||||
StorageProofOverheadMetric {
|
||||
pub fn new(
|
||||
registry: &Registry,
|
||||
prefix: Option<&str>,
|
||||
client: Client<C>,
|
||||
name: String,
|
||||
help: String,
|
||||
) -> Result<Self, PrometheusError> {
|
||||
Ok(StorageProofOverheadMetric {
|
||||
client,
|
||||
metric: Gauge::new(name, help).expect(
|
||||
"only fails if gauge options are customized;\
|
||||
we use default options;\
|
||||
qed",
|
||||
),
|
||||
}
|
||||
metric: register(Gauge::new(metric_name(prefix, &name), help)?, registry)?,
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns approximate storage proof size overhead.
|
||||
@@ -85,13 +87,6 @@ impl<C: Chain> StorageProofOverheadMetric<C> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: Chain> Metrics for StorageProofOverheadMetric<C> {
|
||||
fn register(&self, registry: &Registry) -> Result<(), String> {
|
||||
register(self.metric.clone(), registry).map_err(|e| e.to_string())?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<C: Chain> StandaloneMetrics for StorageProofOverheadMetric<C> {
|
||||
fn update_interval(&self) -> Duration {
|
||||
|
||||
Reference in New Issue
Block a user