drop Origin (it was none everywhere already anyways)
This commit is contained in:
parent
66def0627d
commit
489cd7c326
@ -12,7 +12,6 @@ use crate::errors::{Web3ProxyError, Web3ProxyResult};
|
|||||||
use crate::frontend::authorization::{Authorization, RequestMetadata};
|
use crate::frontend::authorization::{Authorization, RequestMetadata};
|
||||||
use crate::rpcs::one::Web3Rpc;
|
use crate::rpcs::one::Web3Rpc;
|
||||||
use anyhow::{anyhow, Context};
|
use anyhow::{anyhow, Context};
|
||||||
use axum::headers::Origin;
|
|
||||||
use chrono::{DateTime, Months, TimeZone, Utc};
|
use chrono::{DateTime, Months, TimeZone, Utc};
|
||||||
use derive_more::From;
|
use derive_more::From;
|
||||||
use entities::{referee, referrer, rpc_accounting_v2};
|
use entities::{referee, referrer, rpc_accounting_v2};
|
||||||
@ -86,8 +85,6 @@ pub struct RpcQueryKey {
|
|||||||
user_error_response: bool,
|
user_error_response: bool,
|
||||||
/// the rpc method used.
|
/// the rpc method used.
|
||||||
method: Cow<'static, str>,
|
method: Cow<'static, str>,
|
||||||
/// origin tracking **was** opt-in. Now, it is always "None"
|
|
||||||
origin: Option<Origin>,
|
|
||||||
/// None if the public url was used.
|
/// None if the public url was used.
|
||||||
rpc_secret_key_id: Option<NonZeroU64>,
|
rpc_secret_key_id: Option<NonZeroU64>,
|
||||||
/// None if the public url was used.
|
/// None if the public url was used.
|
||||||
@ -113,27 +110,23 @@ impl RpcQueryStats {
|
|||||||
fn accounting_key(&self, period_seconds: i64) -> RpcQueryKey {
|
fn accounting_key(&self, period_seconds: i64) -> RpcQueryKey {
|
||||||
let response_timestamp = round_timestamp(self.response_timestamp, period_seconds);
|
let response_timestamp = round_timestamp(self.response_timestamp, period_seconds);
|
||||||
|
|
||||||
// TODO: change this to use 0 for anonymous queries
|
|
||||||
let rpc_secret_key_id = self.authorization.checks.rpc_secret_key_id;
|
let rpc_secret_key_id = self.authorization.checks.rpc_secret_key_id;
|
||||||
|
let rpc_key_user_id = self.authorization.checks.user_id.try_into().ok();
|
||||||
|
|
||||||
let method = self.method.clone();
|
let method = self.method.clone();
|
||||||
|
|
||||||
// we used to optionally store origin, but wallets don't set it, so its almost always None
|
|
||||||
let origin = None;
|
|
||||||
|
|
||||||
// user_error_response is always set to false because we don't bother tracking this in the database
|
// user_error_response is always set to false because we don't bother tracking this in the database
|
||||||
let user_error_response = false;
|
let user_error_response = false;
|
||||||
|
|
||||||
// Depending on method, add some arithmetic around calculating credits_used
|
// Depending on method, add some arithmetic around calculating credits_used
|
||||||
// I think balance should not go here, this looks more like a key thingy
|
// I think balance should not go here, this looks more like a key thingy
|
||||||
RpcQueryKey {
|
RpcQueryKey {
|
||||||
response_timestamp,
|
|
||||||
archive_needed: self.archive_request,
|
archive_needed: self.archive_request,
|
||||||
error_response: self.error_response,
|
error_response: self.error_response,
|
||||||
method,
|
method,
|
||||||
|
response_timestamp,
|
||||||
|
rpc_key_user_id,
|
||||||
rpc_secret_key_id,
|
rpc_secret_key_id,
|
||||||
rpc_key_user_id: self.authorization.checks.user_id.try_into().ok(),
|
|
||||||
origin,
|
|
||||||
user_error_response,
|
user_error_response,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,8 +136,6 @@ impl RpcQueryStats {
|
|||||||
fn global_timeseries_key(&self) -> RpcQueryKey {
|
fn global_timeseries_key(&self) -> RpcQueryKey {
|
||||||
// we include the method because that can be helpful for predicting load
|
// we include the method because that can be helpful for predicting load
|
||||||
let method = self.method.clone();
|
let method = self.method.clone();
|
||||||
// we don't store origin in the timeseries db. its only used for optional accounting
|
|
||||||
let origin = None;
|
|
||||||
// everyone gets grouped together
|
// everyone gets grouped together
|
||||||
let rpc_secret_key_id = None;
|
let rpc_secret_key_id = None;
|
||||||
let rpc_key_user_id = None;
|
let rpc_key_user_id = None;
|
||||||
@ -157,7 +148,6 @@ impl RpcQueryStats {
|
|||||||
rpc_secret_key_id,
|
rpc_secret_key_id,
|
||||||
rpc_key_user_id,
|
rpc_key_user_id,
|
||||||
user_error_response: self.user_error_response,
|
user_error_response: self.user_error_response,
|
||||||
origin,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,9 +157,6 @@ impl RpcQueryStats {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we don't store origin in the timeseries db. its only optionaly used for accounting
|
|
||||||
let origin = None;
|
|
||||||
|
|
||||||
let method = self.method.clone();
|
let method = self.method.clone();
|
||||||
|
|
||||||
let key = RpcQueryKey {
|
let key = RpcQueryKey {
|
||||||
@ -180,7 +167,6 @@ impl RpcQueryStats {
|
|||||||
rpc_secret_key_id: self.authorization.checks.rpc_secret_key_id,
|
rpc_secret_key_id: self.authorization.checks.rpc_secret_key_id,
|
||||||
rpc_key_user_id: self.authorization.checks.user_id.try_into().ok(),
|
rpc_key_user_id: self.authorization.checks.user_id.try_into().ok(),
|
||||||
user_error_response: self.user_error_response,
|
user_error_response: self.user_error_response,
|
||||||
origin,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Some(key)
|
Some(key)
|
||||||
|
Loading…
Reference in New Issue
Block a user