prometheus

This commit is contained in:
aniketfuryrocks 2023-02-04 17:15:20 +05:30
parent f1e4215c82
commit 2ec0fc06af
No known key found for this signature in database
GPG Key ID: FA6BFCFAA7D4B764
10 changed files with 207 additions and 162 deletions

259
Cargo.lock generated
View File

@ -364,7 +364,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"solana-rpc-client", "solana-rpc-client",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"tokio", "tokio",
"tracing-subscriber", "tracing-subscriber",
] ]
@ -1144,12 +1144,6 @@ dependencies = [
"syn 0.15.44", "syn 0.15.44",
] ]
[[package]]
name = "doc-comment"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]] [[package]]
name = "eager" name = "eager"
version = "0.1.0" version = "0.1.0"
@ -1333,12 +1327,6 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "ftoa"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca45aac12b6c561b6289bc68957cb1db3dccf870e1951d590202de5e24f1dd35"
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.26" version = "0.3.26"
@ -1639,6 +1627,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "hermit-abi"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "856b5cb0902c2b6d65d5fd97dfa30f9b70c7538e770b98eab5ed52d8db923e01"
[[package]] [[package]]
name = "histogram" name = "histogram"
version = "0.6.9" version = "0.6.9"
@ -1717,9 +1711,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.23" version = "0.14.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
@ -1819,7 +1813,6 @@ checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown 0.12.3", "hashbrown 0.12.3",
"serde",
] ]
[[package]] [[package]]
@ -1870,14 +1863,14 @@ checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
[[package]] [[package]]
name = "is-terminal" name = "is-terminal"
version = "0.4.2" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef"
dependencies = [ dependencies = [
"hermit-abi 0.2.6", "hermit-abi 0.3.0",
"io-lifetimes", "io-lifetimes",
"rustix", "rustix",
"windows-sys 0.42.0", "windows-sys 0.45.0",
] ]
[[package]] [[package]]
@ -2205,17 +2198,18 @@ dependencies = [
"dashmap", "dashmap",
"futures", "futures",
"jsonrpsee", "jsonrpsee",
"lazy_static",
"log", "log",
"native-tls", "native-tls",
"postgres-native-tls", "postgres-native-tls",
"prometheus",
"serde", "serde",
"serde_json", "serde_json",
"serde_prometheus",
"solana-pubsub-client", "solana-pubsub-client",
"solana-quic-client", "solana-quic-client",
"solana-rpc-client", "solana-rpc-client",
"solana-rpc-client-api", "solana-rpc-client-api",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-tpu-client", "solana-tpu-client",
"solana-transaction-status", "solana-transaction-status",
"solana-version", "solana-version",
@ -2286,6 +2280,15 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "memoffset"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
dependencies = [
"autocfg",
]
[[package]] [[package]]
name = "merlin" name = "merlin"
version = "3.0.0" version = "3.0.0"
@ -2312,9 +2315,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.6.4" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2e212582ede878b109755efd0773a4f0f4ec851584cf0aefbeb4d9ecc114822" checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
dependencies = [ dependencies = [
"adler", "adler",
] ]
@ -2893,6 +2896,27 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "prometheus"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c"
dependencies = [
"cfg-if",
"fnv",
"lazy_static",
"memchr",
"parking_lot",
"protobuf",
"thiserror",
]
[[package]]
name = "protobuf"
version = "2.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94"
[[package]] [[package]]
name = "qstring" name = "qstring"
version = "0.7.2" version = "0.7.2"
@ -3233,16 +3257,16 @@ dependencies = [
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.36.7" version = "0.36.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"errno", "errno",
"io-lifetimes", "io-lifetimes",
"libc", "libc",
"linux-raw-sys", "linux-raw-sys",
"windows-sys 0.42.0", "windows-sys 0.45.0",
] ]
[[package]] [[package]]
@ -3434,21 +3458,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde_prometheus"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25fcd6131bac47a32328d1ba1ee15a27f8d91ab2e5920dba71dbe93d2648f6b1"
dependencies = [
"ftoa",
"indexmap",
"itoa 0.4.8",
"lazy_static",
"regex",
"serde",
"snafu",
]
[[package]] [[package]]
name = "serde_urlencoded" name = "serde_urlencoded"
version = "0.7.1" version = "0.7.1"
@ -3608,27 +3617,6 @@ version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
[[package]]
name = "snafu"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7"
dependencies = [
"doc-comment",
"snafu-derive",
]
[[package]]
name = "snafu-derive"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b"
dependencies = [
"proc-macro2 1.0.50",
"quote 1.0.23",
"syn 1.0.107",
]
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.4.7" version = "0.4.7"
@ -3671,7 +3659,7 @@ dependencies = [
"serde_json", "serde_json",
"solana-address-lookup-table-program", "solana-address-lookup-table-program",
"solana-config-program", "solana-config-program",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"spl-token", "spl-token",
"spl-token-2022", "spl-token-2022",
"thiserror", "thiserror",
@ -3690,11 +3678,11 @@ dependencies = [
"num-traits", "num-traits",
"rustc_version 0.4.0", "rustc_version 0.4.0",
"serde", "serde",
"solana-frozen-abi 1.15.0", "solana-frozen-abi 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-frozen-abi-macro 1.15.0", "solana-frozen-abi-macro 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-program 1.15.0", "solana-program 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-program-runtime", "solana-program-runtime",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"thiserror", "thiserror",
] ]
@ -3708,14 +3696,14 @@ dependencies = [
"serde", "serde",
"serde_derive", "serde_derive",
"solana-program-runtime", "solana-program-runtime",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
] ]
[[package]] [[package]]
name = "solana-frozen-abi" name = "solana-frozen-abi"
version = "1.14.13" version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f44a019070a6cec4d3ad8605c5caa65bdaa13f00b5f1849340f44ffea63b625b" checksum = "ffc55e72b77452b4469a7f46c3526cbddb4a43382370d5c1112dc108569cfe16"
dependencies = [ dependencies = [
"ahash", "ahash",
"blake3", "blake3",
@ -3740,7 +3728,7 @@ dependencies = [
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"sha2 0.10.6", "sha2 0.10.6",
"solana-frozen-abi-macro 1.14.13", "solana-frozen-abi-macro 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"subtle", "subtle",
"thiserror", "thiserror",
] ]
@ -3773,16 +3761,16 @@ dependencies = [
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"sha2 0.10.6", "sha2 0.10.6",
"solana-frozen-abi-macro 1.15.0", "solana-frozen-abi-macro 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"subtle", "subtle",
"thiserror", "thiserror",
] ]
[[package]] [[package]]
name = "solana-frozen-abi-macro" name = "solana-frozen-abi-macro"
version = "1.14.13" version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be23cc7a382f54dfe1348edb94610e5cc146b8eb21563cdd04062a403c75ba62" checksum = "a7084605b674cf344312c3a2a9c0de05126c2ff4d3d77cc6746f236ca3c4cb53"
dependencies = [ dependencies = [
"proc-macro2 1.0.50", "proc-macro2 1.0.50",
"quote 1.0.23", "quote 1.0.23",
@ -3803,9 +3791,9 @@ dependencies = [
[[package]] [[package]]
name = "solana-logger" name = "solana-logger"
version = "1.14.13" version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447d16a70a1b5383736ef44801050c0e1affd022303b22ed899352f958c2de4b" checksum = "dae1169570b4f086a42f340b86b698b8b64dfa0f931f2a4f0f3c5b18195d6711"
dependencies = [ dependencies = [
"env_logger", "env_logger",
"lazy_static", "lazy_static",
@ -3828,7 +3816,7 @@ version = "1.15.0"
source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f" source = "git+https://github.com/blockworks-foundation/solana?branch=lite_rpc#04daf93c153bdce7f461ad284843c21c63ca621f"
dependencies = [ dependencies = [
"log", "log",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
] ]
[[package]] [[package]]
@ -3841,7 +3829,7 @@ dependencies = [
"lazy_static", "lazy_static",
"log", "log",
"reqwest", "reqwest",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
] ]
[[package]] [[package]]
@ -3858,8 +3846,8 @@ dependencies = [
"serde", "serde",
"serde_derive", "serde_derive",
"socket2", "socket2",
"solana-logger 1.15.0", "solana-logger 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-version", "solana-version",
"tokio", "tokio",
"url", "url",
@ -3887,16 +3875,20 @@ dependencies = [
"serde", "serde",
"solana-metrics", "solana-metrics",
"solana-rayon-threadlimit", "solana-rayon-threadlimit",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-vote-program", "solana-vote-program",
] ]
[[package]] [[package]]
name = "solana-program" name = "solana-program"
version = "1.14.13" version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0937481f080f5dd495fae456c94718a7bacf30fb5fdabb02dcb8a9622e446d5" checksum = "3442ab665ded18fd8526213027a2c05035164b7696e7bf535b7c2d7fa75536fe"
dependencies = [ dependencies = [
"ark-bn254",
"ark-ec",
"ark-ff",
"array-bytes",
"base64 0.13.1", "base64 0.13.1",
"bincode", "bincode",
"bitflags", "bitflags",
@ -3917,7 +3909,8 @@ dependencies = [
"libc", "libc",
"libsecp256k1", "libsecp256k1",
"log", "log",
"memoffset 0.6.5", "memoffset 0.8.0",
"num-bigint 0.4.3",
"num-derive", "num-derive",
"num-traits", "num-traits",
"parking_lot", "parking_lot",
@ -3931,9 +3924,9 @@ dependencies = [
"serde_json", "serde_json",
"sha2 0.10.6", "sha2 0.10.6",
"sha3 0.10.6", "sha3 0.10.6",
"solana-frozen-abi 1.14.13", "solana-frozen-abi 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-frozen-abi-macro 1.14.13", "solana-frozen-abi-macro 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-sdk-macro 1.14.13", "solana-sdk-macro 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"thiserror", "thiserror",
"tiny-bip39", "tiny-bip39",
"wasm-bindgen", "wasm-bindgen",
@ -3984,9 +3977,9 @@ dependencies = [
"serde_json", "serde_json",
"sha2 0.10.6", "sha2 0.10.6",
"sha3 0.10.6", "sha3 0.10.6",
"solana-frozen-abi 1.15.0", "solana-frozen-abi 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-frozen-abi-macro 1.15.0", "solana-frozen-abi-macro 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-sdk-macro 1.15.0", "solana-sdk-macro 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"thiserror", "thiserror",
"tiny-bip39", "tiny-bip39",
"wasm-bindgen", "wasm-bindgen",
@ -4011,11 +4004,11 @@ dependencies = [
"rand 0.7.3", "rand 0.7.3",
"rustc_version 0.4.0", "rustc_version 0.4.0",
"serde", "serde",
"solana-frozen-abi 1.15.0", "solana-frozen-abi 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-frozen-abi-macro 1.15.0", "solana-frozen-abi-macro 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-measure", "solana-measure",
"solana-metrics", "solana-metrics",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana_rbpf", "solana_rbpf",
"thiserror", "thiserror",
] ]
@ -4035,7 +4028,7 @@ dependencies = [
"serde_json", "serde_json",
"solana-account-decoder", "solana-account-decoder",
"solana-rpc-client-api", "solana-rpc-client-api",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"thiserror", "thiserror",
"tokio", "tokio",
"tokio-stream", "tokio-stream",
@ -4063,7 +4056,7 @@ dependencies = [
"solana-metrics", "solana-metrics",
"solana-net-utils", "solana-net-utils",
"solana-rpc-client-api", "solana-rpc-client-api",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-streamer", "solana-streamer",
"solana-tpu-client", "solana-tpu-client",
"thiserror", "thiserror",
@ -4097,7 +4090,7 @@ dependencies = [
"serde_json", "serde_json",
"solana-account-decoder", "solana-account-decoder",
"solana-rpc-client-api", "solana-rpc-client-api",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-transaction-status", "solana-transaction-status",
"solana-version", "solana-version",
"solana-vote-program", "solana-vote-program",
@ -4118,7 +4111,7 @@ dependencies = [
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"solana-account-decoder", "solana-account-decoder",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-transaction-status", "solana-transaction-status",
"solana-version", "solana-version",
"spl-token-2022", "spl-token-2022",
@ -4127,9 +4120,9 @@ dependencies = [
[[package]] [[package]]
name = "solana-sdk" name = "solana-sdk"
version = "1.14.13" version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "390e7481c56dda2ceab2652beeda30a533e9667b34861a2eb4eec92fa1d826d7" checksum = "73788ea1793a23a3d24d1d9ed81a64dbbdd02dac058e0e363a604135e351e670"
dependencies = [ dependencies = [
"assert_matches", "assert_matches",
"base64 0.13.1", "base64 0.13.1",
@ -4154,6 +4147,7 @@ dependencies = [
"memmap2", "memmap2",
"num-derive", "num-derive",
"num-traits", "num-traits",
"num_enum",
"pbkdf2 0.11.0", "pbkdf2 0.11.0",
"qstring", "qstring",
"rand 0.7.3", "rand 0.7.3",
@ -4164,13 +4158,14 @@ dependencies = [
"serde_bytes", "serde_bytes",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"serde_with",
"sha2 0.10.6", "sha2 0.10.6",
"sha3 0.10.6", "sha3 0.10.6",
"solana-frozen-abi 1.14.13", "solana-frozen-abi 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-frozen-abi-macro 1.14.13", "solana-frozen-abi-macro 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-logger 1.14.13", "solana-logger 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-program 1.14.13", "solana-program 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-sdk-macro 1.14.13", "solana-sdk-macro 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"thiserror", "thiserror",
"uriparse", "uriparse",
"wasm-bindgen", "wasm-bindgen",
@ -4218,11 +4213,11 @@ dependencies = [
"serde_with", "serde_with",
"sha2 0.10.6", "sha2 0.10.6",
"sha3 0.10.6", "sha3 0.10.6",
"solana-frozen-abi 1.15.0", "solana-frozen-abi 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-frozen-abi-macro 1.15.0", "solana-frozen-abi-macro 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-logger 1.15.0", "solana-logger 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-program 1.15.0", "solana-program 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-sdk-macro 1.15.0", "solana-sdk-macro 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"thiserror", "thiserror",
"uriparse", "uriparse",
"wasm-bindgen", "wasm-bindgen",
@ -4230,9 +4225,9 @@ dependencies = [
[[package]] [[package]]
name = "solana-sdk-macro" name = "solana-sdk-macro"
version = "1.14.13" version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33d0acbad862093ea123f3a27364336dcb0c8373522cd6810496a34e932c56c1" checksum = "e9e216372c12c4bd820afd02ab90564472e14e1ff609b6737e9d832749370656"
dependencies = [ dependencies = [
"bs58", "bs58",
"proc-macro2 1.0.50", "proc-macro2 1.0.50",
@ -4277,7 +4272,7 @@ dependencies = [
"rustls", "rustls",
"solana-metrics", "solana-metrics",
"solana-perf", "solana-perf",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"thiserror", "thiserror",
"tokio", "tokio",
"x509-parser", "x509-parser",
@ -4302,7 +4297,7 @@ dependencies = [
"solana-pubsub-client", "solana-pubsub-client",
"solana-rpc-client", "solana-rpc-client",
"solana-rpc-client-api", "solana-rpc-client-api",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"thiserror", "thiserror",
"tokio", "tokio",
] ]
@ -4324,7 +4319,7 @@ dependencies = [
"serde_json", "serde_json",
"solana-account-decoder", "solana-account-decoder",
"solana-address-lookup-table-program", "solana-address-lookup-table-program",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"spl-associated-token-account", "spl-associated-token-account",
"spl-memo", "spl-memo",
"spl-token", "spl-token",
@ -4342,9 +4337,9 @@ dependencies = [
"semver 1.0.16", "semver 1.0.16",
"serde", "serde",
"serde_derive", "serde_derive",
"solana-frozen-abi 1.15.0", "solana-frozen-abi 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-frozen-abi-macro 1.15.0", "solana-frozen-abi-macro 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
] ]
[[package]] [[package]]
@ -4359,20 +4354,20 @@ dependencies = [
"rustc_version 0.4.0", "rustc_version 0.4.0",
"serde", "serde",
"serde_derive", "serde_derive",
"solana-frozen-abi 1.15.0", "solana-frozen-abi 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-frozen-abi-macro 1.15.0", "solana-frozen-abi-macro 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-metrics", "solana-metrics",
"solana-program 1.15.0", "solana-program 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"solana-program-runtime", "solana-program-runtime",
"solana-sdk 1.15.0", "solana-sdk 1.15.0 (git+https://github.com/blockworks-foundation/solana?branch=lite_rpc)",
"thiserror", "thiserror",
] ]
[[package]] [[package]]
name = "solana-zk-token-sdk" name = "solana-zk-token-sdk"
version = "1.14.13" version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cebca4083e982ae01583d1a590c4d679e6f648a4761364ddfb43026d2c433142" checksum = "ffa4276fd41317c7367f665684410430c8ddae065af6e997b98a26a201ca2c1e"
dependencies = [ dependencies = [
"aes-gcm-siv", "aes-gcm-siv",
"arrayref", "arrayref",
@ -4392,8 +4387,8 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"sha3 0.9.1", "sha3 0.9.1",
"solana-program 1.14.13", "solana-program 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-sdk 1.14.13", "solana-sdk 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"subtle", "subtle",
"thiserror", "thiserror",
"zeroize", "zeroize",
@ -4444,7 +4439,7 @@ dependencies = [
"borsh", "borsh",
"num-derive", "num-derive",
"num-traits", "num-traits",
"solana-program 1.14.13", "solana-program 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"spl-token", "spl-token",
"spl-token-2022", "spl-token-2022",
"thiserror", "thiserror",
@ -4456,7 +4451,7 @@ version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325" checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325"
dependencies = [ dependencies = [
"solana-program 1.14.13", "solana-program 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -4470,7 +4465,7 @@ dependencies = [
"num-derive", "num-derive",
"num-traits", "num-traits",
"num_enum", "num_enum",
"solana-program 1.14.13", "solana-program 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"thiserror", "thiserror",
] ]
@ -4485,7 +4480,7 @@ dependencies = [
"num-derive", "num-derive",
"num-traits", "num-traits",
"num_enum", "num_enum",
"solana-program 1.14.13", "solana-program 1.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"solana-zk-token-sdk", "solana-zk-token-sdk",
"spl-memo", "spl-memo",
"spl-token", "spl-token",
@ -4674,9 +4669,9 @@ dependencies = [
[[package]] [[package]]
name = "tinyvec_macros" name = "tinyvec_macros"
version = "0.1.0" version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"

View File

@ -40,4 +40,5 @@ tracing-subscriber = "0.3.16"
tokio-postgres = "0.7.7" tokio-postgres = "0.7.7"
native-tls = "0.2.11" native-tls = "0.2.11"
postgres-native-tls = "0.5.0" postgres-native-tls = "0.5.0"
serde_prometheus = "0.1.6" prometheus = "0.13.3"
lazy_static = "1.4.0"

View File

@ -1,7 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use dashmap::DashMap; use dashmap::DashMap;
use log::info;
use solana_rpc_client::nonblocking::rpc_client::RpcClient; use solana_rpc_client::nonblocking::rpc_client::RpcClient;
use solana_sdk::commitment_config::CommitmentConfig; use solana_sdk::commitment_config::CommitmentConfig;
use tokio::sync::RwLock; use tokio::sync::RwLock;
@ -92,7 +92,6 @@ impl BlockStore {
block_info: BlockInformation, block_info: BlockInformation,
commitment_config: CommitmentConfig, commitment_config: CommitmentConfig,
) { ) {
info!("{commitment_config:?} {blockhash:?}, {block_info:?}");
// Write to block store first in order to prevent // Write to block store first in order to prevent
// any race condition i.e prevent some one to // any race condition i.e prevent some one to
// ask the map what it doesn't have rn // ask the map what it doesn't have rn

View File

@ -17,6 +17,7 @@ use anyhow::bail;
use log::info; use log::info;
use jsonrpsee::{server::ServerBuilder, types::SubscriptionResult, SubscriptionSink}; use jsonrpsee::{server::ServerBuilder, types::SubscriptionResult, SubscriptionSink};
use solana_pubsub_client::nonblocking::pubsub_client::PubsubClient; use solana_pubsub_client::nonblocking::pubsub_client::PubsubClient;
use solana_rpc_client::{nonblocking::rpc_client::RpcClient, rpc_client::SerializableTransaction}; use solana_rpc_client::{nonblocking::rpc_client::RpcClient, rpc_client::SerializableTransaction};
use solana_rpc_client_api::{ use solana_rpc_client_api::{
@ -82,6 +83,7 @@ impl LiteBridge {
tx_send_interval: Duration, tx_send_interval: Duration,
clean_interval: Duration, clean_interval: Duration,
enable_postgres: bool, enable_postgres: bool,
prometheus_addr: T,
) -> anyhow::Result<Vec<JoinHandle<anyhow::Result<()>>>> { ) -> anyhow::Result<Vec<JoinHandle<anyhow::Result<()>>>> {
let (postgres, postgres_send) = if enable_postgres { let (postgres, postgres_send) = if enable_postgres {
let (postgres_send, postgres_recv) = mpsc::unbounded_channel(); let (postgres_send, postgres_recv) = mpsc::unbounded_channel();
@ -104,9 +106,8 @@ impl LiteBridge {
postgres_send.clone(), postgres_send.clone(),
); );
let metrics_capture = MetricsCapture::new(self.tx_sender.clone()); let metrics_capture = MetricsCapture::new(self.tx_sender.clone()).capture();
let prometheus_sync = PrometheusSync::new(metrics_capture.clone()).sync(); let prometheus_sync = PrometheusSync.sync(prometheus_addr);
let metrics_capture = metrics_capture.capture();
let finalized_block_listener = self let finalized_block_listener = self
.block_listner .block_listner

View File

@ -27,7 +27,10 @@ pub struct Args {
/// interval between clean /// interval between clean
#[arg(short = 'c', long, default_value_t = DEFAULT_CLEAN_INTERVAL_MS)] #[arg(short = 'c', long, default_value_t = DEFAULT_CLEAN_INTERVAL_MS)]
pub clean_interval_ms: u64, pub clean_interval_ms: u64,
/// addr to postgres /// enable logging to postgres
#[arg(short = 'p', long)] #[arg(short = 'p', long)]
pub enable_postgres: bool, pub enable_postgres: bool,
/// enable metrics to prometheus at addr
#[arg(short = 'm', long, default_value_t = String::from("[::]:9091"))]
pub prometheus_addr: String,
} }

View File

@ -19,6 +19,7 @@ pub async fn main() -> anyhow::Result<()> {
clean_interval_ms, clean_interval_ms,
fanout_size, fanout_size,
enable_postgres, enable_postgres,
prometheus_addr,
} = Args::parse(); } = Args::parse();
let tx_batch_interval_ms = Duration::from_millis(tx_batch_interval_ms); let tx_batch_interval_ms = Duration::from_millis(tx_batch_interval_ms);
@ -34,6 +35,7 @@ pub async fn main() -> anyhow::Result<()> {
tx_batch_interval_ms, tx_batch_interval_ms,
clean_interval_ms, clean_interval_ms,
enable_postgres, enable_postgres,
prometheus_addr,
) )
.await?; .await?;

View File

@ -5,6 +5,7 @@ use dashmap::DashMap;
use futures::StreamExt; use futures::StreamExt;
use jsonrpsee::SubscriptionSink; use jsonrpsee::SubscriptionSink;
use log::info; use log::info;
use prometheus::{histogram_opts, opts, register_counter, register_histogram, Counter, Histogram};
use solana_pubsub_client::nonblocking::pubsub_client::PubsubClient; use solana_pubsub_client::nonblocking::pubsub_client::PubsubClient;
use solana_rpc_client::rpc_client::SerializableTransaction; use solana_rpc_client::rpc_client::SerializableTransaction;
use solana_rpc_client_api::{ use solana_rpc_client_api::{
@ -27,6 +28,23 @@ use crate::{
use super::{PostgresMpscSend, TxProps, TxSender}; use super::{PostgresMpscSend, TxProps, TxSender};
lazy_static::lazy_static! {
static ref TT_RECV_CON_BLOCK: Histogram = register_histogram!(histogram_opts!(
"tt_recv_con_block",
"Time to receive confirmed block from block subscribe",
))
.unwrap();
static ref TT_RECV_FIN_BLOCK: Histogram = register_histogram!(histogram_opts!(
"tt_recv_fin_block",
"Time to receive finalized block from block subscribe",
))
.unwrap();
static ref TXS_CONFIRMED: Counter =
register_counter!(opts!("txs_confirmed", "Number of Transactions Confirmed")).unwrap();
static ref TXS_FINALIZED: Counter =
register_counter!(opts!("txs_finalized", "Number of Transactions Finalized")).unwrap();
}
/// Background worker which listen's to new blocks /// Background worker which listen's to new blocks
/// and keeps a track of confirmed txs /// and keeps a track of confirmed txs
#[derive(Clone)] #[derive(Clone)]
@ -114,7 +132,19 @@ impl BlockListener {
info!("Listening to {commitment:?} blocks"); info!("Listening to {commitment:?} blocks");
while let Some(block) = recv.as_mut().next().await { loop {
let timer = if commitment_config.is_finalized() {
TT_RECV_FIN_BLOCK.start_timer()
} else {
TT_RECV_CON_BLOCK.start_timer()
};
let Some(block) = recv.as_mut().next().await else {
bail!("PubSub broke");
};
timer.observe_duration();
let slot = block.context.slot; let slot = block.context.slot;
let Some(block) = block.value.block else { let Some(block) = block.value.block else {
@ -177,6 +207,17 @@ impl BlockListener {
let sig = tx.get_signature().to_string(); let sig = tx.get_signature().to_string();
if let Some(mut tx_status) = self.tx_sender.txs_sent.get_mut(&sig) { if let Some(mut tx_status) = self.tx_sender.txs_sent.get_mut(&sig) {
//
// Metrics
//
if status.is_ok() {
if commitment_config.is_finalized() {
TXS_FINALIZED.inc();
} else {
TXS_CONFIRMED.inc();
}
}
tx_status.value_mut().status = Some(TransactionStatus { tx_status.value_mut().status = Some(TransactionStatus {
slot, slot,
confirmations: None, confirmations: None,
@ -220,8 +261,6 @@ impl BlockListener {
} }
} }
} }
bail!("Stopped Listening to {commitment:?} blocks")
}) })
} }
} }

View File

@ -2,12 +2,12 @@ mod block_listenser;
mod cleaner; mod cleaner;
mod metrics_capture; mod metrics_capture;
mod postgres; mod postgres;
mod prometheus; mod prometheus_sync;
mod tx_sender; mod tx_sender;
pub use block_listenser::*; pub use block_listenser::*;
pub use cleaner::*; pub use cleaner::*;
pub use metrics_capture::*; pub use metrics_capture::*;
pub use postgres::*; pub use postgres::*;
pub use prometheus::*; pub use prometheus_sync::*;
pub use tx_sender::*; pub use tx_sender::*;

View File

@ -1,23 +1,13 @@
use std::collections::HashMap; use prometheus::{Encoder, TextEncoder};
use tokio::{ use tokio::{
io::AsyncWriteExt, io::AsyncWriteExt,
net::{TcpListener, TcpStream}, net::{TcpListener, TcpStream, ToSocketAddrs},
task::JoinHandle, task::JoinHandle,
}; };
use super::MetricsCapture; pub struct PrometheusSync;
#[derive(Clone)]
pub struct PrometheusSync {
metrics_capture: MetricsCapture,
}
impl PrometheusSync { impl PrometheusSync {
pub fn new(metrics_capture: MetricsCapture) -> Self {
Self { metrics_capture }
}
fn create_response(payload: &str) -> String { fn create_response(payload: &str) -> String {
format!( format!(
"HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n{}", "HTTP/1.1 200 OK\r\nContent-Length: {}\r\n\r\n{}",
@ -27,10 +17,16 @@ impl PrometheusSync {
} }
async fn handle_stream(&self, stream: &mut TcpStream) -> anyhow::Result<()> { async fn handle_stream(&self, stream: &mut TcpStream) -> anyhow::Result<()> {
let metrics = self.metrics_capture.get_metrics().await; let mut metrics_buffer = Vec::new();
let metrics = serde_prometheus::to_string(&metrics, Some("literpc"), HashMap::new())?; let encoder = TextEncoder::new();
let response = Self::create_response(&metrics); let metric_families = prometheus::gather();
encoder
.encode(&metric_families, &mut metrics_buffer)
.unwrap();
let metrics_buffer = String::from_utf8(metrics_buffer).unwrap();
let response = Self::create_response(&metrics_buffer);
stream.writable().await?; stream.writable().await?;
stream.write_all(response.as_bytes()).await?; stream.write_all(response.as_bytes()).await?;
@ -40,10 +36,10 @@ impl PrometheusSync {
Ok(()) Ok(())
} }
pub fn sync(self) -> JoinHandle<anyhow::Result<()>> { pub fn sync(self, addr: impl ToSocketAddrs + Send + 'static) -> JoinHandle<anyhow::Result<()>> {
#[allow(unreachable_code)] #[allow(unreachable_code)]
tokio::spawn(async move { tokio::spawn(async move {
let listener = TcpListener::bind("[::]:9091").await?; let listener = TcpListener::bind(addr).await?;
loop { loop {
let Ok((mut stream, _addr)) = listener.accept().await else { let Ok((mut stream, _addr)) = listener.accept().await else {

View File

@ -7,6 +7,7 @@ use anyhow::bail;
use dashmap::DashMap; use dashmap::DashMap;
use log::{info, warn}; use log::{info, warn};
use prometheus::{register_counter, Counter};
use solana_transaction_status::TransactionStatus; use solana_transaction_status::TransactionStatus;
use tokio::{ use tokio::{
sync::mpsc::{error::TryRecvError, UnboundedReceiver}, sync::mpsc::{error::TryRecvError, UnboundedReceiver},
@ -20,6 +21,11 @@ use crate::{
use super::PostgresMpscSend; use super::PostgresMpscSend;
lazy_static::lazy_static! {
static ref TXS_SENT: Counter =
register_counter!("txs_sent", "Number of transactions forwarded to tpu").unwrap();
}
pub type WireTransaction = Vec<u8>; pub type WireTransaction = Vec<u8>;
/// Retry transactions to a maximum of `u16` times, keep a track of confirmed transactions /// Retry transactions to a maximum of `u16` times, keep a track of confirmed transactions
@ -77,6 +83,9 @@ impl TxSender {
for (sig, _) in &sigs_and_slots { for (sig, _) in &sigs_and_slots {
txs_sent.insert(sig.to_owned(), TxProps::default()); txs_sent.insert(sig.to_owned(), TxProps::default());
} }
// metrics
TXS_SENT.inc_by(sigs_and_slots.len() as f64);
1 1
} }
Err(err) => { Err(err) => {