-
Notifications
You must be signed in to change notification settings - Fork 92
feat(log-ingestor): Make database connection pool size configurable (fixes #2039). #2413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
junhaoliao
wants to merge
12
commits into
y-scope:main
Choose a base branch
from
junhaoliao:feat/log-ingestor-database-connection-pool-size
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0b0d073
feat(log-ingestor): Make database connection pool size configurable
junhaoliao e903945
Merge remote-tracking branch 'origin/main' into feat/log-ingestor-dat…
junhaoliao 747c291
Merge branch 'main' into feat/log-ingestor-database-connection-pool-size
junhaoliao 09c8109
refactor(log-ingestor): Use context for missing configuration
junhaoliao 1a8431a
Merge remote-tracking branch 'junhao/feat/log-ingestor-database-conne…
junhaoliao 41f8bcc
docs(log-ingestor): Order connection errors consistently
junhaoliao 0acbd71
feat(helm): Expose log-ingestor database pool size
junhaoliao 3b04ecc
Merge remote-tracking branch 'origin/main' into feat/log-ingestor-dat…
junhaoliao b6a8b32
refactor(clp-rust-utils): Inline log-ingestor pool default
junhaoliao 562cd8e
Merge remote-tracking branch 'origin/main' into feat/log-ingestor-dat…
junhaoliao 956f27c
style(rust): Align tests and error messages
junhaoliao cce43e8
chore(chart): bump version to 0.4.1-dev.3
junhaoliao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| use std::num::NonZeroU32; | ||
|
|
||
| use serde::Deserialize; | ||
|
|
||
| use crate::clp_config::{AwsAuthentication, S3Config}; | ||
|
|
@@ -227,6 +229,9 @@ impl Default for StreamOutputStorage { | |
| } | ||
| } | ||
|
|
||
| const DEFAULT_LOG_INGESTOR_DATABASE_CONNECTION_POOL_SIZE: NonZeroU32 = | ||
| NonZeroU32::new(100).unwrap(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| /// Mirror of `clp_py_utils.clp_config.LogIngestor`. | ||
| /// | ||
| /// # NOTE | ||
|
|
@@ -237,6 +242,7 @@ impl Default for StreamOutputStorage { | |
| pub struct LogIngestor { | ||
| pub host: String, | ||
| pub port: u16, | ||
| pub database_connection_pool_size: NonZeroU32, | ||
| pub logging_level: String, | ||
| } | ||
|
|
||
|
|
@@ -245,6 +251,7 @@ impl Default for LogIngestor { | |
| Self { | ||
| host: "localhost".to_owned(), | ||
| port: 3002, | ||
| database_connection_pool_size: DEFAULT_LOG_INGESTOR_DATABASE_CONNECTION_POOL_SIZE, | ||
| logging_level: "INFO".to_owned(), | ||
| } | ||
| } | ||
|
|
@@ -339,7 +346,25 @@ impl Default for Telemetry { | |
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::LogsInput; | ||
| use super::{LogIngestor, LogsInput}; | ||
|
|
||
| #[test] | ||
| fn deserialize_log_ingestor_database_connection_pool_size() { | ||
| let default_config = serde_json::from_str::<LogIngestor>("{}") | ||
| .expect("failed to deserialize default `LogIngestor` config"); | ||
| assert_eq!(100, default_config.database_connection_pool_size.get()); | ||
|
|
||
| let custom_config = | ||
| serde_json::from_str::<LogIngestor>(r#"{"database_connection_pool_size": 42}"#) | ||
| .expect("failed to deserialize custom `LogIngestor` config"); | ||
| assert_eq!(42, custom_config.database_connection_pool_size.get()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn reject_zero_log_ingestor_database_connection_pool_size() { | ||
| let result = serde_json::from_str::<LogIngestor>(r#"{"database_connection_pool_size": 0}"#); | ||
| assert!(result.is_err()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn deserialize_logs_input_s3_config() { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.