From 4e35efd7fb245b9944a848abbb53858f85d917f2 Mon Sep 17 00:00:00 2001 From: incrypto32 Date: Thu, 14 Mar 2024 18:53:16 +0530 Subject: [PATCH] graph: Change env variable name for gas metrics --- graph/src/env/mod.rs | 17 ++++++++++++----- graph/src/runtime/gas/mod.rs | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/graph/src/env/mod.rs b/graph/src/env/mod.rs index 86d970853fc..9e2b41c75be 100644 --- a/graph/src/env/mod.rs +++ b/graph/src/env/mod.rs @@ -188,9 +188,9 @@ pub struct EnvVars { pub subgraph_settings: Option, /// Whether to prefer substreams blocks streams over firehose when available. pub prefer_substreams_block_streams: bool, - /// Set by the flag `GRAPH_ENABLE_GAS_METRICS`. Whether to enable + /// Set by the flag `GRAPH_ENABLE_DIPS_METRICS`. Whether to enable /// gas metrics. Off by default. - pub enable_gas_metrics: bool, + pub enable_dips_metrics: bool, /// Set by the env var `GRAPH_HISTORY_BLOCKS_OVERRIDE`. Defaults to None /// Sets an override for the amount history to keep regardless of the /// historyBlocks set in the manifest @@ -199,6 +199,10 @@ pub struct EnvVars { /// The amount of history to keep when using 'min' historyBlocks /// in the manifest pub min_history_blocks: BlockNumber, + + /// Set by the env var `dips_metrics_object_store_url` + /// The name of the object store bucket to store DIPS metrics + pub dips_metrics_object_store_url: Option, } impl EnvVars { @@ -263,11 +267,12 @@ impl EnvVars { ingestor_polling_interval: Duration::from_millis(inner.ingestor_polling_interval), subgraph_settings: inner.subgraph_settings, prefer_substreams_block_streams: inner.prefer_substreams_block_streams, - enable_gas_metrics: inner.enable_gas_metrics.0, + enable_dips_metrics: inner.enable_dips_metrics.0, history_blocks_override: inner.history_blocks_override, min_history_blocks: inner .min_history_blocks .unwrap_or(2 * inner.reorg_threshold), + dips_metrics_object_store_url: inner.dips_metrics_object_store_url, }) } @@ -399,12 +404,14 @@ struct Inner { default = "false" )] prefer_substreams_block_streams: bool, - #[envconfig(from = "GRAPH_ENABLE_GAS_METRICS", default = "false")] - enable_gas_metrics: EnvVarBoolean, + #[envconfig(from = "GRAPH_ENABLE_DIPS_METRICS", default = "false")] + enable_dips_metrics: EnvVarBoolean, #[envconfig(from = "GRAPH_HISTORY_BLOCKS_OVERRIDE")] history_blocks_override: Option, #[envconfig(from = "GRAPH_MIN_HISTORY_BLOCKS")] min_history_blocks: Option, + #[envconfig(from = "GRAPH_DIPS_METRICS_OBJECT_STORE_URL")] + dips_metrics_object_store_url: Option, } #[derive(Clone, Debug)] diff --git a/graph/src/runtime/gas/mod.rs b/graph/src/runtime/gas/mod.rs index e137207d274..4148378682a 100644 --- a/graph/src/runtime/gas/mod.rs +++ b/graph/src/runtime/gas/mod.rs @@ -101,7 +101,7 @@ impl GasCounter { amount += costs::HOST_EXPORT_GAS; // If gas metrics are enabled, track the gas used - if ENV_VARS.enable_gas_metrics { + if ENV_VARS.enable_dips_metrics { if let Some(method) = method { self.metrics.track_gas(method, amount.0); self.metrics.track_operations(method, 1);