Skip to content
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

filters: add extra logging, fix filters config updates #23

Merged
merged 7 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bd-log-filter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ bd-client-stats-store.path = "../bd-client-stats-store"
bd-log-matcher.path = "../bd-log-matcher"
bd-log-primitives.path = "../bd-log-primitives"
bd-proto.path = "../bd-proto"
itertools.workspace = true
regex.workspace = true
log.workspace = true
time.workspace = true
Expand Down
15 changes: 14 additions & 1 deletion bd-log-filter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use bd_log_primitives::{FieldsRef, Log, LogField, LogFields};
use bd_proto::protos::filter::filter::filter::{self};
use bd_proto::protos::filter::filter::{Filter as FilterProto, FiltersConfiguration};
use filter::transform::Transform_type;
use itertools::Itertools;
use regex::Regex;
use std::borrow::Cow;

Expand Down Expand Up @@ -54,7 +55,13 @@ impl FilterChain {
})
.ok()
})
.collect();
.collect_vec();

log::debug!(
"{} filters created, {} failed",
filters.len(),
failures_count
);

(Self { filters }, failures_count)
}
Expand All @@ -69,6 +76,12 @@ impl FilterChain {
continue;
}

log::trace!(
"filter matched {:?} log, applying {} transforms",
log.message,
filter.transforms.len()
);

for transform in &filter.transforms {
transform.apply(log);
}
Expand Down
4 changes: 2 additions & 2 deletions bd-logger/src/client_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ impl ApplyConfig for LoggerUpdate {
workflows,
insights,
bdtail,
..
filters,
} = configuration;

let maybe_stream_buffer = self
Expand All @@ -272,7 +272,7 @@ impl ApplyConfig for LoggerUpdate {
WorkflowsConfiguration::default()
};

let (filter_chain, filter_config_parse_failure_count) = FilterChain::new(configuration.filters);
let (filter_chain, filter_config_parse_failure_count) = FilterChain::new(filters);
self
.filter_config_parse_failure
.inc_by(filter_config_parse_failure_count);
Expand Down
1 change: 1 addition & 0 deletions bd-logger/src/log_replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ impl ProcessingPipeline {
self.buffer_selector = config.buffer_selector;
self.buffer_producers = config.buffer_producers;
self.tail_configs = config.tail_configs;
self.filter_chain = config.filter_chain;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was missing, it made is so that filters config update that happened while SDK was up and running were effectively invisible to the SDK until the next relaunch.


if self.workflows_enabled_flag.read_mark_update() {
let workflows_engine_config = WorkflowsEngineConfig::new(
Expand Down
Loading