Skip to content

Commit

Permalink
chore(deps): Switch to apache_avro (#15603)
Browse files Browse the repository at this point in the history
Replaces apache_rs.

Closes: #15597

Signed-off-by: Jesse Szwedko <[email protected]>

Signed-off-by: Jesse Szwedko <[email protected]>
  • Loading branch information
jszwedko authored Dec 21, 2022
1 parent 72ce41d commit a7001a7
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 69 deletions.
109 changes: 48 additions & 61 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ vrl-stdlib = { path = "lib/vrl/stdlib" }
# External libs
arc-swap = { version = "1.5", default-features = false, optional = true }
async-compression = { version = "0.3.15", default-features = false, features = ["tokio", "gzip", "zstd"], optional = true }
avro-rs = { version = "0.13.0", default-features = false, optional = true }
apache-avro = { version = "0.14.0", default-features = false, optional = true }
axum = { version = "0.6.1", default-features = false }
base64 = { version = "0.13.1", default-features = false, optional = true }
bloom = { version = "0.3.2", default-features = false, optional = true }
Expand Down Expand Up @@ -696,7 +696,7 @@ sinks-new_relic_logs = ["sinks-http"]
sinks-new_relic = []
sinks-papertrail = ["dep:syslog"]
sinks-prometheus = ["aws-core", "dep:base64", "dep:prometheus-parser", "dep:snap", "dep:serde_with"]
sinks-pulsar = ["dep:avro-rs", "dep:pulsar"]
sinks-pulsar = ["dep:apache-avro", "dep:pulsar"]
sinks-redis = ["dep:redis"]
sinks-sematext = ["sinks-elasticsearch", "sinks-influxdb"]
sinks-socket = ["sinks-utils-udp"]
Expand Down
2 changes: 1 addition & 1 deletion lib/codecs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
publish = false

[dependencies]
avro-rs = { version = "0.13.0", default-features = false }
apache-avro = { version = "0.14.0", default-features = false }
bytes = { version = "1", default-features = false }
chrono = { version = "0.4", default-features = false }
derivative = { version = "2", default-features = false }
Expand Down
10 changes: 5 additions & 5 deletions lib/codecs/src/encoding/format/avro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl AvroSerializerConfig {

/// Build the `AvroSerializer` from this configuration.
pub fn build(&self) -> Result<AvroSerializer, BuildError> {
let schema = avro_rs::Schema::parse_str(&self.avro.schema)
let schema = apache_avro::Schema::parse_str(&self.avro.schema)
.map_err(|error| format!("Failed building Avro serializer: {}", error))?;
Ok(AvroSerializer { schema })
}
Expand Down Expand Up @@ -53,12 +53,12 @@ pub struct AvroSerializerOptions {
/// Serializer that converts an `Event` to bytes using the Apache Avro format.
#[derive(Debug, Clone)]
pub struct AvroSerializer {
schema: avro_rs::Schema,
schema: apache_avro::Schema,
}

impl AvroSerializer {
/// Creates a new `AvroSerializer`.
pub const fn new(schema: avro_rs::Schema) -> Self {
pub const fn new(schema: apache_avro::Schema) -> Self {
Self { schema }
}
}
Expand All @@ -68,9 +68,9 @@ impl Encoder<Event> for AvroSerializer {

fn encode(&mut self, event: Event, buffer: &mut BytesMut) -> Result<(), Self::Error> {
let log = event.into_log();
let value = avro_rs::to_value(log)?;
let value = apache_avro::to_value(log)?;
let value = value.resolve(&self.schema)?;
let bytes = avro_rs::to_avro_datum(&self.schema, value)?;
let bytes = apache_avro::to_avro_datum(&self.schema, value)?;
buffer.put_slice(&bytes);
Ok(())
}
Expand Down

0 comments on commit a7001a7

Please sign in to comment.