From dc7b9dcddf4d6474015b86d056de8984958ad429 Mon Sep 17 00:00:00 2001 From: Chris Smith <1979423+chris13524@users.noreply.github.com> Date: Fri, 18 Aug 2023 08:23:55 -0400 Subject: [PATCH] chore: remove debug_secret who's usage was removed in https://github.com/WalletConnect/rpc-proxy/pull/249 (#293) --- .env.example | 1 - src/env/mod.rs | 6 +++--- src/lib.rs | 8 ++++---- src/{debug => profiler}/mod.rs | 6 ++---- terraform/ecs/main.tf | 2 -- terraform/ecs/variables.tf | 5 ----- terraform/main.tf | 2 -- terraform/variables.tf | 5 ----- 8 files changed, 9 insertions(+), 26 deletions(-) rename src/{debug => profiler}/mod.rs (77%) diff --git a/.env.example b/.env.example index f3ab96e07..b6ab5dfc9 100644 --- a/.env.example +++ b/.env.example @@ -25,6 +25,5 @@ export TF_VAR_infura_project_id="" export TF_VAR_pokt_project_id="" export TF_VAR_grafana_endpoint=$(aws grafana list-workspaces | jq -r '.workspaces[] | select( .tags.Env == "prod") | select( .tags.Name == "grafana-9") | .endpoint') export TF_VAR_registry_api_auth_token="" -export TF_VAR_debug_secret="" export GRAFANA_AUTH="Grab one at https://$TF_VAR_grafana_endpoint" diff --git a/src/env/mod.rs b/src/env/mod.rs index 209049fca..7920edffa 100644 --- a/src/env/mod.rs +++ b/src/env/mod.rs @@ -1,8 +1,8 @@ use { crate::{ analytics::Config as AnalyticsConfig, - debug::DebugConfig, error, + profiler::ProfilerConfig, project::{storage::Config as StorageConfig, Config as RegistryConfig}, providers::{ProviderKind, Weight}, }, @@ -35,7 +35,7 @@ pub struct Config { pub registry: RegistryConfig, pub storage: StorageConfig, pub analytics: AnalyticsConfig, - pub debug: DebugConfig, + pub profiler: ProfilerConfig, } impl Config { @@ -45,7 +45,7 @@ impl Config { registry: from_env("RPC_PROXY_REGISTRY_")?, storage: from_env("RPC_PROXY_STORAGE_")?, analytics: from_env("RPC_PROXY_ANALYTICS_")?, - debug: from_env("RPC_PROXY_DEBUG_")?, + profiler: from_env("RPC_PROXY_PROFILER_")?, }) } } diff --git a/src/lib.rs b/src/lib.rs index 62ea6f076..9330f5882 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,13 +52,13 @@ const KEEPALIVE_INTERVAL: Duration = Duration::from_secs(5); const KEEPALIVE_RETRIES: u32 = 1; mod analytics; -pub mod debug; pub mod env; pub mod error; mod extractors; mod handlers; mod json_rpc; mod metrics; +pub mod profiler; mod project; mod providers; mod state; @@ -185,8 +185,8 @@ pub async fn bootstrap(config: Config) -> RpcResult<()> { } }; - let memory_debug_data_collector = async move { - if let Err(e) = tokio::spawn(debug::debug_metrics()).await { + let profiler = async move { + if let Err(e) = tokio::spawn(profiler::run()).await { warn!("Memory debug stats collection failed with: {:?}", e); } Ok(()) @@ -196,7 +196,7 @@ pub async fn bootstrap(config: Config) -> RpcResult<()> { tokio::spawn(public_server), tokio::spawn(private_server), tokio::spawn(updater), - tokio::spawn(memory_debug_data_collector), + tokio::spawn(profiler), ]; if let Err(e) = futures_util::future::select_all(services).await.0 { diff --git a/src/debug/mod.rs b/src/profiler/mod.rs similarity index 77% rename from src/debug/mod.rs rename to src/profiler/mod.rs index 58820a779..4a2c77349 100644 --- a/src/debug/mod.rs +++ b/src/profiler/mod.rs @@ -1,9 +1,7 @@ #[derive(Debug, Clone, serde::Deserialize)] -pub struct DebugConfig { - pub secret: String, -} +pub struct ProfilerConfig {} -pub async fn debug_metrics() { +pub async fn run() { loop { if let Err(err) = wc::alloc::stats::update_jemalloc_metrics() { tracing::warn!(?err, "failed to collect jemalloc stats"); diff --git a/terraform/ecs/main.tf b/terraform/ecs/main.tf index 5b7a5f59c..24acc048f 100644 --- a/terraform/ecs/main.tf +++ b/terraform/ecs/main.tf @@ -87,8 +87,6 @@ resource "aws_ecs_task_definition" "app_task" { { "name" : "RPC_PROXY_ANALYTICS_GEOIP_DB_BUCKET", "value" : var.analytics_geoip_db_bucket_name }, { "name" : "RPC_PROXY_ANALYTICS_GEOIP_DB_KEY", "value" : var.analytics_geoip_db_key }, - { "name" : "RPC_PROXY_DEBUG_SECRET", "value" : var.debug_secret }, - { "name" : "SIG_PROXY_URL", "value" : "http://127.0.0.1:8080/workspaces/${var.prometheus_workspace_id}" }, { "name" : "SIG_PROM_WORKSPACE_HEADER", "value" : "aps-workspaces.${var.region}.amazonaws.com" }, ], diff --git a/terraform/ecs/variables.tf b/terraform/ecs/variables.tf index fa0d1c7e2..3fdb67eb8 100644 --- a/terraform/ecs/variables.tf +++ b/terraform/ecs/variables.tf @@ -144,8 +144,3 @@ variable "analytics_geoip_db_bucket_name" { description = "The name of the bucket containing the GeoIP database" type = string } - -variable "debug_secret" { - description = "The secret used to run profiler endpoint" - type = string -} \ No newline at end of file diff --git a/terraform/main.tf b/terraform/main.tf index 9b55a3e07..9be08c9d0 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -116,8 +116,6 @@ module "ecs" { analytics_data_lake_bucket_name = local.analytics_data_lake_bucket_name analytics_data_lake_kms_key_arn = var.analytics_data_lake_kms_key_arn analytics_geoip_db_bucket_name = local.analytics_geoip_db_bucket_name - - debug_secret = var.debug_secret } module "redis" { diff --git a/terraform/variables.tf b/terraform/variables.tf index 18b3ae240..5dcb6be00 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -51,8 +51,3 @@ variable "analytics_data_lake_kms_key_arn" { description = "The ARN of KMS encryption key for the data-lake bucket." type = string } - -variable "debug_secret" { - description = "The secret used to run memory profile endpoint." - type = string -} \ No newline at end of file