Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
40762b6
Refactor rebase master prometheus_v0.3
nodebreaker0-0 Nov 28, 2019
472aca1
Milestone1: Final Version of v0.3
nodebreaker0-0 Dec 10, 2019
1974f94
no-std or warm compatibility issues, grapana-data -source code refere…
nodebreaker0-0 Jan 2, 2020
62a873d
Cargo.lock paritytech/master rebase
nodebreaker0-0 Jan 2, 2020
97e37e4
prometheus networking.rs del, grafana-data-source networking.rs pub e…
nodebreaker0-0 Jan 3, 2020
f3e444e
chore: reflect various feedback
nodebreaker0-0 Jan 10, 2020
8145df7
Spaces to tabs.
gavofyork Jan 6, 2020
fca71be
Replace grafana and tidy
expenses Jan 10, 2020
855ceed
Add generics
expenses Jan 10, 2020
70c6bcc
Add photo back
expenses Jan 10, 2020
5941041
Re-fix spaces in primitives/consensus/babe/src/inherents.rs
expenses Jan 10, 2020
c93a0a3
custom weight function wrapper (#4158)
kianenigma Jan 14, 2020
b443dda
Take `genesis_storage` by ref (#4617)
bkchr Jan 14, 2020
012c5ef
Add trivial EnsureFounder verifier to society (#4615)
gavofyork Jan 14, 2020
410ce11
Update the service to std futures (#4447)
expenses Jan 14, 2020
45995b4
fixed panic on empty remote read request (#4619)
svyatonik Jan 14, 2020
8cb71bd
Add `pallet-society` and `pallet-recovery` to substrate node (#4622)
bkchr Jan 14, 2020
37be263
Make offchain worker calls more future proof. (#4618)
tomusdrw Jan 14, 2020
05ce617
network: add logging for extra requests (#4625)
andresilva Jan 15, 2020
5649259
Add more logging to the network (#4621)
tomaka Jan 15, 2020
33b3c23
Return early when fees/balances/values are zero (#4628)
shawntabrizi Jan 15, 2020
c2b0c0f
reset a couple of versions down from v2.0 (#4572)
rphmeier Jan 15, 2020
af1bc8c
fix some discrepancies in generic-asset (#4221)
kigawas Jan 15, 2020
1dafa60
Make Proposer instantiation potentially async. (#4630)
rphmeier Jan 15, 2020
f21eb1a
remove old test (#4637)
gui1117 Jan 16, 2020
4c4ee3d
use default in-memory for commands that don't use keystore (#4634)
NikVolf Jan 16, 2020
3fa5f09
Getting configuration from commands (#4643)
cecton Jan 16, 2020
47c36e6
Rename basic-authority to basic-authorship (#4640)
tomusdrw Jan 16, 2020
879e28a
Implement runtime version checks in `set_code` (#4548)
bkchr Jan 16, 2020
99430a5
grandpa: generic voting rule for backing off from best block (#4635)
andresilva Jan 16, 2020
1e0c679
Make the sync_cycle_from_offline_to_syncing_to_offline test non flaky…
tomaka Jan 16, 2020
f931588
Merge remote-tracking branch 'nodebreaker/prometheus_v0.3' into ashle…
expenses Jan 16, 2020
5796c85
Merge remote-tracking branch 'parity/master' into ashley-prometheus
expenses Jan 16, 2020
8e98643
Allow updating configuration of changes tries (#3201)
svyatonik Jan 16, 2020
2a45de8
Merge remote-tracking branch 'parity/master' into ashley-prometheus
expenses Jan 16, 2020
6a7137f
remove unused safe-mix dependency (#4656)
xlc Jan 17, 2020
394bcf4
Add typedefs for storage types (#4654)
stanislav-tkach Jan 17, 2020
7248ac2
add debug logs (#4657)
NikVolf Jan 17, 2020
188d59e
CODEOWNERS: Add myself to pow and EVM module (#4653)
sorpaas Jan 17, 2020
8bae73b
Merge remote-tracking branch 'parity/master' into ashley-prometheus
expenses Jan 17, 2020
d4fbb89
client/finality-grandpa: Reintegrate periodic neighbor packet worker …
mxinden Jan 17, 2020
2d15616
grandpa: bump finality-grandpa crate to v0.10.3 (#4659)
andresilva Jan 17, 2020
10bebed
add missing bits (#4660)
NikVolf Jan 17, 2020
083ada5
Patch practical usability issues with Society (#4651)
shawntabrizi Jan 17, 2020
36a6de0
Expose proof generation and verifying api. (#4646)
montekki Jan 17, 2020
1caa0f1
Merge remote-tracking branch 'parity/master' into ashley-prometheus
expenses Jan 17, 2020
ffb4746
Tidy
expenses Jan 17, 2020
e581e3c
Drive by fix of doc of `Value`. (#4658)
pepyakin Jan 17, 2020
f0c1852
client/finality-grandpa: Reintegrate gossip validator report stream (…
mxinden Jan 17, 2020
8a6e3c5
Use local registry
expenses Jan 17, 2020
8de5340
Society: Ensure all votes are removed after tally (#4666)
shawntabrizi Jan 17, 2020
0097939
make compute_fee public (#4669)
xlc Jan 18, 2020
a31ad6e
`sp-runtime-interface` add table about FFI types (#4668)
bkchr Jan 18, 2020
8131288
Add rules and unfounding to society. (#4671)
gavofyork Jan 18, 2020
6cf45f2
Make use of `cfg(doc)` in `sp-runtime-interface` (#4673)
bkchr Jan 19, 2020
3d1634b
Merge remote-tracking branch 'nodebreaker/prometheus_v0.3' into ashle…
expenses Jan 20, 2020
55ac4f8
Merge remote-tracking branch 'parity/master' into ashley-prometheus
expenses Jan 20, 2020
3cfe43c
endpoint -> exporter
expenses Jan 20, 2020
0af2369
fix readme
expenses Jan 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add generics
  • Loading branch information
expenses committed Jan 10, 2020
commit 855ceed68ed9c5a523fd6a7b08b4f61f48a882aa
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions client/cli/src/informant/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ use sp_runtime::traits::{
};
use sc_service::NetworkStatus;
use std::{convert::{TryFrom, TryInto}, fmt, time};
use prometheus_endpoint::{create_gauge, Gauge};
use prometheus_endpoint::{create_gauge, Gauge, U64};

prometheus_endpoint::lazy_static! {
pub static ref SYNC_TARGET: Gauge = create_gauge(
pub static ref SYNC_TARGET: Gauge<U64> = create_gauge(
"sync_target_number",
"block sync target number"
);
Expand Down Expand Up @@ -74,7 +74,7 @@ impl<B: BlockT> InformantDisplay<B> {
(SyncState::Idle, _) => ("Idle".into(), "".into()),
(SyncState::Downloading, None) => (format!("Syncing{}", speed), "".into()),
(SyncState::Downloading, Some(n)) => {
SYNC_TARGET.set(n.unique_saturated_into() as i64);
SYNC_TARGET.set(n.unique_saturated_into() as u64);
(format!("Syncing{}", speed), format!(", target=#{}", n))
}
};
Expand Down
42 changes: 17 additions & 25 deletions client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,46 +54,38 @@ use sysinfo::{get_current_pid, ProcessExt, System, SystemExt};
use sc_telemetry::{telemetry, SUBSTRATE_INFO};
use sp_transaction_pool::{TransactionPool, TransactionPoolMaintainer};
use sp_blockchain;
use prometheus_endpoint::{create_gauge, Gauge};
use prometheus_endpoint::{create_gauge, Gauge, U64, F64};

prometheus_endpoint::lazy_static! {
pub static ref FINALITY_HEIGHT: Gauge = create_gauge(
pub static ref FINALITY_HEIGHT: Gauge<U64> = create_gauge(
"consensus_finality_block_height_number",
"block is finality HEIGHT"
);
pub static ref BEST_HEIGHT: Gauge = create_gauge(
pub static ref BEST_HEIGHT: Gauge<U64> = create_gauge(
"consensus_best_block_height_number",
"block is best HEIGHT"
);
pub static ref BLOCK_INTERVAL_SECONDS: Gauge = create_gauge(
"consensus_block_interval_seconds",
"Time between this and last block(Block.Header.Time) in seconds"
);
pub static ref P2P_PEERS_NUM: Gauge = create_gauge(
pub static ref P2P_PEERS_NUM: Gauge<U64> = create_gauge(
"p2p_peers_number",
"network gosip peers number"
);
pub static ref TX_COUNT: Gauge = create_gauge(
pub static ref TX_COUNT: Gauge<U64> = create_gauge(
"consensus_num_txs",
"Number of transactions"
);
pub static ref NODE_MEMORY: Gauge = create_gauge(
pub static ref NODE_MEMORY: Gauge<U64> = create_gauge(
"consensus_node_memory",
"node memory"
);
pub static ref NODE_CPU: Gauge = create_gauge(
pub static ref NODE_CPU: Gauge<F64> = create_gauge(
"consensus_node_cpu",
"node cpu"
);
pub static ref STATE_CACHE_SIZE: Gauge = create_gauge(
"consensus_state_cache_size",
"used state cache size"
);
pub static ref P2P_NODE_DOWNLOAD: Gauge = create_gauge(
pub static ref P2P_NODE_DOWNLOAD: Gauge<U64> = create_gauge(
"p2p_peers_receive_byte_per_sec",
"p2p_node_download_per_sec_byte"
);
pub static ref P2P_NODE_UPLOAD: Gauge = create_gauge(
pub static ref P2P_NODE_UPLOAD: Gauge<U64> = create_gauge(
"p2p_peers_send_byte_per_sec",
"p2p_node_upload_per_sec_byte"
);
Expand Down Expand Up @@ -996,14 +988,14 @@ ServiceBuilder<
"bandwidth_upload" => bandwidth_upload,
"used_state_cache_size" => used_state_cache_size,
);
NODE_MEMORY.set(memory as i64);
NODE_CPU.set(cpu_usage as i64);
TX_COUNT.set(txpool_status.ready as i64);
FINALITY_HEIGHT.set(finalized_number as i64);
BEST_HEIGHT.set(best_number as i64);
P2P_PEERS_NUM.set(num_peers as i64);
P2P_NODE_DOWNLOAD.set(net_status.average_download_per_sec as i64);
P2P_NODE_UPLOAD.set(net_status.average_upload_per_sec as i64);
NODE_MEMORY.set(memory);
NODE_CPU.set(f64::from(cpu_usage));
TX_COUNT.set(txpool_status.ready as u64);
FINALITY_HEIGHT.set(finalized_number);
BEST_HEIGHT.set(best_number);
P2P_PEERS_NUM.set(num_peers as u64);
P2P_NODE_DOWNLOAD.set(net_status.average_download_per_sec);
P2P_NODE_UPLOAD.set(net_status.average_upload_per_sec);
Ok(())
}).select(exit.clone().map(Ok).compat()).then(|_| Ok(()));
let _ = to_spawn_tx.unbounded_send(Box::new(tel_task));
Expand Down
1 change: 0 additions & 1 deletion utils/prometheus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ prometheus = { version = "0.7", features = ["nightly", "process"]}
tokio = "0.2"
futures-util = { version = "0.3.1", default-features = false, features = ["io"] }
lazy_static = "1.4"
sp-runtime = { package = "sp-runtime",path = "../../primitives/runtime" }
derive_more = "0.99"

[target.'cfg(not(target_os = "unknown"))'.dependencies]
Expand Down
44 changes: 18 additions & 26 deletions utils/prometheus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,22 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.


#[macro_use]
extern crate lazy_static;
use futures_util::{FutureExt,future::{Future}};

use futures_util::{FutureExt, future::Future};
use hyper::http::StatusCode;
use hyper::Server;
use hyper::{Body, Request, Response, service::{service_fn, make_service_fn}};
pub use prometheus::{Encoder, HistogramOpts, Opts, TextEncoder};
pub use prometheus::{Histogram, IntCounter};
pub use prometheus::IntGauge as Gauge;
pub use sp_runtime::traits::SaturatedConversion;
use hyper::{Server, Body, Request, Response, service::{service_fn, make_service_fn}};
use prometheus::{Encoder, Opts, TextEncoder, core::Atomic};
use std::net::SocketAddr;
#[cfg(not(target_os = "unknown"))]
mod networking;

pub use prometheus::core::{
GenericGauge as Gauge, AtomicF64 as F64, AtomicI64 as I64, AtomicU64 as U64
};
pub use lazy_static::lazy_static;

pub fn create_gauge(name: &str, description: &str) -> Gauge {
pub fn create_gauge<T: Atomic + 'static>(name: &str, description: &str) -> Gauge<T> {
let opts = Opts::new(name, description);
let gauge = Gauge::with_opts(opts).expect("Creating Gauge Failed");
prometheus::register(Box::new(gauge.clone())).expect("Registering gauge failed");
Expand All @@ -58,22 +56,16 @@ impl std::error::Error for Error {
}

async fn request_metrics(req: Request<Body>) -> Result<Response<Body>, Error> {
if req.uri().path() == "/metrics" {
let metric_families = prometheus::gather();
let mut buffer = vec![];
let encoder = TextEncoder::new();
encoder.encode(&metric_families, &mut buffer).unwrap();
Response::builder()
.status(StatusCode::OK)
.header("Content-Type", encoder.format_type())
.body(Body::from(buffer))
.map_err(Error::Http)
} else {
Response::builder()
.status(StatusCode::NOT_FOUND)
.body(Body::from("Not found."))
.map_err(Error::Http)
}
let metric_families = prometheus::gather();
let mut buffer = vec![];
let encoder = TextEncoder::new();
encoder.encode(&metric_families, &mut buffer).unwrap();

Response::builder()
.status(StatusCode::OK)
.header("Content-Type", encoder.format_type())
.body(Body::from(buffer))
.map_err(Error::Http)
}

#[derive(Clone)]
Expand Down