Skip to content

Commit

Permalink
Merge branch 'main' into macpie/custom_tracing_everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldjeffrey committed May 16, 2024
2 parents 0e2642a + bdabe6b commit d282b04
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 67 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions boost_manager/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ fn default_activation_check_interval() -> Duration {
humantime::parse_duration("15 minutes").unwrap()
}

pub fn default_start_after() -> DateTime<Utc> {
fn default_start_after() -> DateTime<Utc> {
DateTime::UNIX_EPOCH
}

pub fn default_log() -> String {
fn default_log() -> String {
"boost_manager=info".to_string()
}

Expand Down
4 changes: 2 additions & 2 deletions denylist/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ pub struct Settings {
pub sign_keys: Vec<String>,
}

pub fn default_log() -> String {
fn default_log() -> String {
"denylist=debug".to_string()
}

pub fn default_denylist_url() -> String {
fn default_denylist_url() -> String {
"https://api.github.com/repos/helium/denylist/releases/latest".to_string()
}

Expand Down
10 changes: 5 additions & 5 deletions ingest/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ pub struct Settings {
pub metrics: poc_metrics::Settings,
}

pub fn default_session_key_timeout() -> Duration {
fn default_session_key_timeout() -> Duration {
humantime::parse_duration("30 minutes").unwrap()
}

pub fn default_session_key_offer_timeout() -> Duration {
fn default_session_key_offer_timeout() -> Duration {
humantime::parse_duration("5 seconds").unwrap()
}

pub fn default_listen_addr() -> SocketAddr {
fn default_listen_addr() -> SocketAddr {
"0.0.0.0:9081".parse().unwrap()
}

pub fn default_log() -> String {
fn default_log() -> String {
"ingest=debug,poc_store=info".to_string()
}

pub fn default_sink() -> String {
fn default_sink() -> String {
"/var/data/ingest".to_string()
}

Expand Down
6 changes: 3 additions & 3 deletions iot_config/src/client/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ pub struct Settings {
pub batch_size: u32,
}

pub fn default_connect_timeout() -> u64 {
fn default_connect_timeout() -> u64 {
5
}

pub fn default_rpc_timeout() -> u64 {
fn default_rpc_timeout() -> u64 {
5
}

pub fn default_batch_size() -> u32 {
fn default_batch_size() -> u32 {
1000
}

Expand Down
6 changes: 3 additions & 3 deletions iot_config/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ pub struct Settings {
pub metrics: poc_metrics::Settings,
}

pub fn default_log() -> String {
fn default_log() -> String {
"iot_config=debug".to_string()
}

pub fn default_listen_addr() -> SocketAddr {
fn default_listen_addr() -> SocketAddr {
"0.0.0.0:8080".parse().unwrap()
}

pub fn default_deleted_entry_retention() -> Duration {
fn default_deleted_entry_retention() -> Duration {
humantime::parse_duration("48 hours").unwrap()
}

Expand Down
10 changes: 5 additions & 5 deletions iot_packet_verifier/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ pub struct Settings {
pub monitor_funds_period: Duration,
}

pub fn default_start_after() -> DateTime<Utc> {
fn default_start_after() -> DateTime<Utc> {
DateTime::UNIX_EPOCH
}

pub fn default_burn_period() -> Duration {
fn default_burn_period() -> Duration {
humantime::parse_duration("1 minute").unwrap()
}

pub fn default_log() -> String {
fn default_log() -> String {
"iot_packet_verifier=debug".to_string()
}

pub fn default_minimum_allowed_balance() -> u64 {
fn default_minimum_allowed_balance() -> u64 {
3_500_000
}

pub fn default_monitor_funds_period() -> Duration {
fn default_monitor_funds_period() -> Duration {
humantime::parse_duration("30 minutes").unwrap()
}

Expand Down
17 changes: 0 additions & 17 deletions iot_verifier/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ pub struct Settings {
/// beaconing bucket sizes
#[serde(with = "humantime_serde", default = "default_beacon_interval")]
pub beacon_interval: Duration,
// FIXME: unused
/// Trigger interval for generating a transmit scaling map
#[serde(with = "humantime_serde", default = "default_transmit_scale_interval")]
pub transmit_scale_interval: Duration,
// roll up time defined in the ingestors ( in seconds )
// ie the time after which they will write out files to s3
// this will be used when padding out the witness
Expand All @@ -72,10 +68,6 @@ pub struct Settings {
/// cadence for how often to look for poc reports from s3 buckets
#[serde(with = "humantime_serde", default = "default_poc_loader_poll_time")]
pub poc_loader_poll_time: Duration,
// FIXME: unused
/// the lifespan of a piece of entropy
#[serde(with = "humantime_serde", default = "default_entropy_lifespan ")]
pub entropy_lifespan: Duration,
/// max window age for the poc report loader ( in seconds )
/// the starting point of the window will never be older than now - max age
#[serde(
Expand Down Expand Up @@ -125,10 +117,6 @@ fn default_entropy_interval() -> Duration {
humantime::parse_duration("5 minutes").unwrap()
}

fn default_entropy_lifespan() -> Duration {
humantime::parse_duration("5 minutes").unwrap()
}

fn default_poc_loader_window_width() -> Duration {
humantime::parse_duration("5 minutes").unwrap()
}
Expand All @@ -151,10 +139,6 @@ fn default_beacon_interval() -> Duration {
humantime::parse_duration("6 hours").unwrap()
}

fn default_transmit_scale_interval() -> Duration {
humantime::parse_duration("30 minutes").unwrap()
}

fn default_log() -> String {
"iot_verifier=debug,poc_store=info".to_string()
}
Expand Down Expand Up @@ -230,7 +214,6 @@ impl Settings {
}

pub fn beacon_interval(&self) -> anyhow::Result<Duration> {
// FIXME:
// validate the beacon_interval value is a factor of 24, if not bail out
if (24 * 60 * 60) % self.beacon_interval.as_secs() != 0 {
bail!("beacon interval is not a factor of 24")
Expand Down
1 change: 1 addition & 0 deletions mobile_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ triggered = { workspace = true }
task-manager = { path = "../task_manager" }
solana-sdk = { workspace = true }
custom-tracing = { path = "../custom_tracing", features = ["grpc"] }
humantime-serde = { workspace = true }

[dev-dependencies]
rand = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion mobile_config/src/client/authorization_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl AuthorizationClient {
client: settings.connect_authorization_client(),
signing_key: settings.signing_keypair()?,
config_pubkey: settings.config_pubkey()?,
cache_ttl: settings.cache_ttl(),
cache_ttl: settings.cache_ttl,
cache,
})
}
Expand Down
2 changes: 1 addition & 1 deletion mobile_config/src/client/carrier_service_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl CarrierServiceClient {
client: settings.connect_carrier_service_client(),
signing_key: settings.signing_keypair()?,
config_pubkey: settings.config_pubkey()?,
cache_ttl: settings.cache_ttl(),
cache_ttl: settings.cache_ttl,
cache,
})
}
Expand Down
2 changes: 1 addition & 1 deletion mobile_config/src/client/entity_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl EntityClient {
client: settings.connect_entity_client(),
signing_key: settings.signing_keypair()?,
config_pubkey: settings.config_pubkey()?,
cache_ttl: settings.cache_ttl(),
cache_ttl: settings.cache_ttl,
cache,
})
}
Expand Down
2 changes: 1 addition & 1 deletion mobile_config/src/client/gateway_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl GatewayClient {
signing_key: settings.signing_keypair()?,
config_pubkey: settings.config_pubkey()?,
batch_size: settings.batch_size,
cache_ttl: settings.cache_ttl(),
cache_ttl: settings.cache_ttl,
cache,
})
}
Expand Down
37 changes: 17 additions & 20 deletions mobile_config/src/client/settings.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use helium_proto::services::{mobile_config, Channel, Endpoint};
use humantime_serde::re::humantime;
use serde::Deserialize;
use std::{str::FromStr, sync::Arc, time::Duration};

Expand All @@ -12,39 +13,39 @@ pub struct Settings {
/// B58 encoded public key of the mobile config server for verification
pub config_pubkey: String,
/// Connect timeout for the mobile config client in seconds. Default 5
#[serde(default = "default_connect_timeout")]
pub connect_timeout: u64,
#[serde(with = "humantime_serde", default = "default_connect_timeout")]
pub connect_timeout: Duration,
/// RPC timeout for mobile config client in seconds. Default 5
#[serde(default = "default_rpc_timeout")]
pub rpc_timeout: u64,
#[serde(with = "humantime_serde", default = "default_rpc_timeout")]
pub rpc_timeout: Duration,
/// Batch size for hotspot metadata stream results. Default 100
#[serde(default = "default_batch_size")]
pub batch_size: u32,
/// Batch size for hex boosting stream results. Default 100
#[serde(default = "default_hex_boosting_batch_size")]
pub hex_boosting_batch_size: u32,
#[serde(default = "default_cache_ttl_in_secs")]
pub cache_ttl_in_secs: u64,
#[serde(with = "humantime_serde", default = "default_cache_ttl_in_secs")]
pub cache_ttl: Duration,
}

pub fn default_connect_timeout() -> u64 {
5
fn default_connect_timeout() -> Duration {
humantime::parse_duration("5 seconds").unwrap()
}

pub fn default_rpc_timeout() -> u64 {
5
fn default_rpc_timeout() -> Duration {
humantime::parse_duration("5 seconds").unwrap()
}

pub fn default_batch_size() -> u32 {
fn default_batch_size() -> u32 {
100
}

pub fn default_hex_boosting_batch_size() -> u32 {
fn default_hex_boosting_batch_size() -> u32 {
100
}

pub fn default_cache_ttl_in_secs() -> u64 {
60 * 60
fn default_cache_ttl_in_secs() -> Duration {
humantime::parse_duration("1 hour").unwrap()
}

impl Settings {
Expand Down Expand Up @@ -83,15 +84,11 @@ impl Settings {
pub fn config_pubkey(&self) -> Result<helium_crypto::PublicKey, helium_crypto::Error> {
helium_crypto::PublicKey::from_str(&self.config_pubkey)
}

pub fn cache_ttl(&self) -> std::time::Duration {
std::time::Duration::from_secs(self.cache_ttl_in_secs)
}
}

fn connect_channel(settings: &Settings) -> Channel {
Endpoint::from(settings.url.clone())
.connect_timeout(Duration::from_secs(settings.connect_timeout))
.timeout(Duration::from_secs(settings.rpc_timeout))
.connect_timeout(settings.connect_timeout)
.timeout(settings.rpc_timeout)
.connect_lazy()
}
4 changes: 2 additions & 2 deletions mobile_config/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ pub struct Settings {
pub metrics: poc_metrics::Settings,
}

pub fn default_log() -> String {
fn default_log() -> String {
"mobile_config=debug".to_string()
}

pub fn default_listen_addr() -> SocketAddr {
fn default_listen_addr() -> SocketAddr {
"0.0.0.0:8080".parse().unwrap()
}

Expand Down
6 changes: 3 additions & 3 deletions poc_entropy/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ pub struct Settings {
pub metrics: poc_metrics::Settings,
}

pub fn default_log() -> String {
fn default_log() -> String {
"poc_entropy=debug,poc_store=info".to_string()
}

pub fn default_cache() -> String {
fn default_cache() -> String {
"/var/data/entropy".to_string()
}

pub fn default_listen_addr() -> String {
fn default_listen_addr() -> String {
"0.0.0.0:8080".to_string()
}

Expand Down
2 changes: 1 addition & 1 deletion price/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn default_stale_price_duration() -> Duration {
humantime::parse_duration("12 hours").unwrap()
}

pub fn default_cache() -> String {
fn default_cache() -> String {
"/var/data/price".to_string()
}

Expand Down

0 comments on commit d282b04

Please sign in to comment.