Skip to content

Commit

Permalink
Add Loki flush threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
tazz4843 committed Feb 2, 2024
1 parent e249d0c commit 85d2640
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripty_config/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ pub struct LokiConfig {

/// Maximum size of one message before being dropped. Defaults to infinite.
pub max_message_size: Option<usize>,

/// Number of messages to buffer before sending all to Loki. Defaults to 1000.
pub flush_threshold: Option<usize>,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down
1 change: 1 addition & 0 deletions scripty_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async fn init_logging() {
.network(NetworkingBackend::Reqwest)
.format(SerializationFormat::Json)
.max_message_size(cfg.loki.max_message_size)
.flush_threshold(cfg.loki.flush_threshold.unwrap_or(1_000))
.include_level();

for field in cfg.loki.labels.iter() {
Expand Down

0 comments on commit 85d2640

Please sign in to comment.