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

View File

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

View File

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

View File

@ -401,12 +401,20 @@ impl StatBuffer {
// TODO: use stream::iter properly to avoid allocating this Vec
let mut points = vec![];
let now = chrono::Utc::now().to_rfc3339();
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
let new_frontend_requests = stat.frontend_requests;
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
{
Ok(point) => {
@ -423,7 +431,13 @@ impl StatBuffer {
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
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
{
Ok(point) => {

View File

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