Skip to content

Commit

Permalink
fix(chronicle-udm-events): remove encoding config from udm-events config
Browse files Browse the repository at this point in the history
  • Loading branch information
ChocPanda committed Jan 15, 2025
1 parent 8b65f82 commit d6315a5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
4 changes: 0 additions & 4 deletions src/sinks/gcp_chronicle/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use vector_lib::config::AcknowledgementsConfig;
use vector_lib::configurable::configurable_component;

use crate::{
codecs::EncodingConfig,
gcp::GcpAuthConfig,
sinks::{
gcp_chronicle::{
Expand Down Expand Up @@ -127,9 +126,6 @@ pub struct ChronicleCommonConfig {
#[serde(default)]
pub batch: BatchConfig<ChronicleDefaultBatchSettings>,

#[configurable(derived)]
pub encoding: EncodingConfig,

#[serde(default)]
#[configurable(derived)]
pub compression: ChronicleCompression,
Expand Down
7 changes: 1 addition & 6 deletions src/sinks/gcp_chronicle/udm_events/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use vector_lib::{
};

use crate::{
codecs,
gcp::GcpAuthenticator,
http::HttpClient,
sinks::{
Expand All @@ -45,7 +44,6 @@ struct ChronicleUDMEventsRequestBody {
#[derive(Clone, Debug)]
struct ChronicleUDMEventsEncoder {
customer_id: String,
transformer: codecs::Transformer,
}

impl Encoder<Vec<Event>> for ChronicleUDMEventsEncoder {
Expand All @@ -58,7 +56,6 @@ impl Encoder<Vec<Event>> for ChronicleUDMEventsEncoder {
let events = input
.into_iter()
.filter_map(|mut event| {
self.transformer.transform(&mut event);
if let Log(ref mut log_event) = event {
byte_size.add_event(log_event, log_event.estimated_json_encoded_size_of());
Some(log_event.clone())
Expand Down Expand Up @@ -90,11 +87,9 @@ struct ChronicleUDMEventsRequestBuilder {

impl ChronicleUDMEventsRequestBuilder {
fn new(config: &ChronicleUDMEventsConfig) -> crate::Result<Self> {
let transformer = config.chronicle_common.encoding.transformer();
let compression = Compression::from(config.chronicle_common.compression);
let encoder = ChronicleUDMEventsEncoder {
customer_id: config.chronicle_common.customer_id.clone(),
transformer,
customer_id: config.chronicle_common.customer_id.clone()
};
Ok(Self {
encoder,
Expand Down
4 changes: 4 additions & 0 deletions src/sinks/gcp_chronicle/unstructured_logs/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::collections::HashMap;
use vector_lib::configurable::configurable_component;

use crate::{
codecs::EncodingConfig,
config::{SinkConfig, SinkContext},
http::HttpClient,
schema,
Expand Down Expand Up @@ -46,6 +47,9 @@ pub struct ChronicleUnstructuredConfig {
#[configurable(metadata(docs::additional_props_description = "A Chronicle label."))]
pub labels: Option<HashMap<String, String>>,

#[configurable(derived)]
pub encoding: EncodingConfig,

/// The type of log entries in a request.
///
/// This must be one of the [supported log types][unstructured_log_types_doc], otherwise
Expand Down
4 changes: 2 additions & 2 deletions src/sinks/gcp_chronicle/unstructured_logs/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ struct Label {

impl ChronicleUnstructuredRequestBuilder {
fn new(config: &ChronicleUnstructuredConfig) -> crate::Result<Self> {
let transformer = config.chronicle_common.encoding.transformer();
let serializer = config.chronicle_common.encoding.config().build()?;
let transformer = config.encoding.transformer();
let serializer = config.encoding.config().build()?;
let compression = Compression::from(config.chronicle_common.compression);
let encoder = crate::codecs::Encoder::<()>::new(serializer);
let encoder = ChronicleUnstructuredEncoder {
Expand Down

0 comments on commit d6315a5

Please sign in to comment.