diff --git a/NEWS.md b/NEWS.md index 1470de669b2..952c50f0c5b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,10 @@ ## Unreleased +- The ElasticSearch index to which `graph-node` logs can now be configured + with the `GRAPH_ELASTIC_SEARCH_INDEX` environment variable which defaults + to `subgraph` + ## v0.34.0 ### What's New @@ -23,7 +27,7 @@ - Addressed a bug in the deduplication logic for Cosmos events, ensuring all distinct events are properly indexed and handled, especially when similar but not identical events occur within the same block. [(#5112)](https://github.com/graphprotocol/graph-node/pull/5112) - Fixed compatibility issues with ElasticSearch 8.X, ensuring proper log functionality. [(#5013)](https://github.com/graphprotocol/graph-node/pull/5013) -- Resolved an issue when rewinding data sources across multiple blocks. In rare cases, when a subgraph had been rewound by multiple blocks, data sources 'from the future' could have been left behind. This release adds a database migration that fixes that. With very unlucky timing this migration might miss some subgraphs, which will later lead to an error `assertion failed: self.hosts.last().and_then(|h| h.creation_block_number()) <= data_source.creation_block()`. Should that happen, the [migration script](https://github.com/graphprotocol/graph-node/blob/master/store/postgres/migrations/2024-01-05-170000_ds_corruption_fix_up/up.sql) should be rerun against the affected shard. [(#5083)](https://github.com/graphprotocol/graph-node/pull/5083) + - Resolved an issue when rewinding data sources across multiple blocks. In rare cases, when a subgraph had been rewound by multiple blocks, data sources 'from the future' could have been left behind. This release adds a database migration that fixes that. With very unlucky timing this migration might miss some subgraphs, which will later lead to an error `assertion failed: self.hosts.last().and_then(|h| h.creation_block_number()) <= data_source.creation_block()`. Should that happen, the [migration script](https://github.com/graphprotocol/graph-node/blob/master/store/postgres/migrations/2024-01-05-170000_ds_corruption_fix_up/up.sql) should be rerun against the affected shard. [(#5083)](https://github.com/graphprotocol/graph-node/pull/5083) - Increased the base backoff time for RPC, enhancing stability and reliability under load. [(#4984)](https://github.com/graphprotocol/graph-node/pull/4984) - Resolved an issue related to spawning offchain data sources from existing offchain data source mappings. [(#5051)](https://github.com/graphprotocol/graph-node/pull/5051)[(#5092)](https://github.com/graphprotocol/graph-node/pull/5092) - Resolved an issue where eth-call results for reverted calls were being cached in call cache. [(#4879)](https://github.com/graphprotocol/graph-node/pull/4879) diff --git a/graph/src/env/mod.rs b/graph/src/env/mod.rs index 9e73abfde5f..86d970853fc 100644 --- a/graph/src/env/mod.rs +++ b/graph/src/env/mod.rs @@ -86,6 +86,9 @@ pub struct EnvVars { /// Set by the environment variable /// `GRAPH_ELASTIC_SEARCH_MAX_RETRIES`. The default value is 5. pub elastic_search_max_retries: usize, + /// The name of the index in ElasticSearch to which we should log. Set + /// by `GRAPH_ELASTIC_SEARCH_INDEX`. The default is `subgraph`. + pub elastic_search_index: String, /// If an instrumented lock is contended for longer than the specified /// duration, a warning will be logged. /// @@ -224,6 +227,7 @@ impl EnvVars { inner.elastic_search_flush_interval_in_secs, ), elastic_search_max_retries: inner.elastic_search_max_retries, + elastic_search_index: inner.elastic_search_index, lock_contention_log_threshold: Duration::from_millis( inner.lock_contention_log_threshold_in_ms, ), @@ -326,6 +330,8 @@ struct Inner { elastic_search_flush_interval_in_secs: u64, #[envconfig(from = "GRAPH_ELASTIC_SEARCH_MAX_RETRIES", default = "5")] elastic_search_max_retries: usize, + #[envconfig(from = "GRAPH_ELASTIC_SEARCH_INDEX", default = "subgraph")] + elastic_search_index: String, #[envconfig(from = "GRAPH_LOCK_CONTENTION_LOG_THRESHOLD_MS", default = "100")] lock_contention_log_threshold_in_ms: u64, diff --git a/graph/src/log/factory.rs b/graph/src/log/factory.rs index 52269f1a7ed..1e8aef33b2e 100644 --- a/graph/src/log/factory.rs +++ b/graph/src/log/factory.rs @@ -101,7 +101,7 @@ impl LoggerFactory { elastic_logger( ElasticDrainConfig { general: elastic_config, - index: String::from("subgraph-logs"), + index: ENV_VARS.elastic_search_index.clone(), custom_id_key: String::from("subgraphId"), custom_id_value: loc.hash.to_string(), flush_interval: ENV_VARS.elastic_search_flush_interval,