add another field to try to handle improper de-duplication

This commit is contained in:
Bryan Stitt 2023-07-21 16:29:10 -07:00
parent 0ef8bb50e8
commit b08a279b60
4 changed files with 20 additions and 4 deletions

@ -335,7 +335,7 @@ impl Web3ProxyApp {
rpc_secret_key_cache.clone(), rpc_secret_key_cache.clone(),
user_balance_cache.clone(), user_balance_cache.clone(),
stat_buffer_shutdown_receiver, stat_buffer_shutdown_receiver,
30, 1,
flush_stat_buffer_sender.clone(), flush_stat_buffer_sender.clone(),
flush_stat_buffer_receiver, flush_stat_buffer_receiver,
)? { )? {

@ -481,6 +481,7 @@ impl BufferedRpcQueryStats {
chain_id: u64, chain_id: u64,
key: RpcQueryKey, key: RpcQueryKey,
instance: &str, instance: &str,
now: &str,
) -> anyhow::Result<DataPoint> { ) -> anyhow::Result<DataPoint> {
let mut builder = DataPoint::builder(measurement) let mut builder = DataPoint::builder(measurement)
.tag("archive_needed", key.archive_needed.to_string()) .tag("archive_needed", key.archive_needed.to_string())
@ -489,6 +490,7 @@ impl BufferedRpcQueryStats {
.tag("instance", instance) .tag("instance", instance)
.tag("method", key.method) .tag("method", key.method)
.tag("user_error_response", key.user_error_response.to_string()) .tag("user_error_response", key.user_error_response.to_string())
.tag("save_time", now)
.timestamp(key.response_timestamp) .timestamp(key.response_timestamp)
.field("backend_requests", self.backend_requests as i64) .field("backend_requests", self.backend_requests as i64)
.field("cache_hits", self.cache_hits as i64) .field("cache_hits", self.cache_hits as i64)

@ -401,12 +401,20 @@ impl StatBuffer {
// TODO: use stream::iter properly to avoid allocating this Vec // TODO: use stream::iter properly to avoid allocating this Vec
let mut points = vec![]; let mut points = vec![];
let now = chrono::Utc::now().to_rfc3339();
for (key, stat) in self.global_timeseries_buffer.drain() { for (key, stat) in self.global_timeseries_buffer.drain() {
// TODO: i don't like passing key (which came from the stat) to the function on the stat. but it works for now // TODO: i don't like passing key (which came from the stat) to the function on the stat. but it works for now
let new_frontend_requests = stat.frontend_requests; let new_frontend_requests = stat.frontend_requests;
match stat match stat
.build_timeseries_point("global_proxy", self.chain_id, key, &self.instance_hash) .build_timeseries_point(
"global_proxy",
self.chain_id,
key,
&self.instance_hash,
&now,
)
.await .await
{ {
Ok(point) => { Ok(point) => {
@ -423,7 +431,13 @@ impl StatBuffer {
for (key, stat) in self.opt_in_timeseries_buffer.drain() { for (key, stat) in self.opt_in_timeseries_buffer.drain() {
// TODO: i don't like passing key (which came from the stat) to the function on the stat. but it works for now // TODO: i don't like passing key (which came from the stat) to the function on the stat. but it works for now
match stat match stat
.build_timeseries_point("opt_in_proxy", self.chain_id, key, &self.instance_hash) .build_timeseries_point(
"opt_in_proxy",
self.chain_id,
key,
&self.instance_hash,
&now,
)
.await .await
{ {
Ok(point) => { Ok(point) => {

@ -88,7 +88,7 @@ impl MigrateStatsToV2SubCommand {
rpc_secret_key_cache, rpc_secret_key_cache,
user_balance_cache, user_balance_cache,
rpc_account_shutdown_recevier, rpc_account_shutdown_recevier,
30, 60,
flush_sender, flush_sender,
flush_receiver, flush_receiver,
) )