Skip to content

Commit

Permalink
Fixed datadog agent test
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Wakely <fungus.humungus@gmail.com>
  • Loading branch information
StephenWakely committed Jul 27, 2023
1 parent 18c087c commit 0fbe38e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/sinks/datadog/metrics/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ impl DatadogMetricsEncoder {
self.state.written += n;

let raw_bytes_written = self.state.written;
let byte_size = self.state.byte_size.clone();

// Consume the encoder state so we can do our final checks and return the necessary data.
let state = self.reset_state();
let payload = state
Expand All @@ -357,7 +359,7 @@ impl DatadogMetricsEncoder {
if recommended_splits == 1 {
// "One" split means no splits needed: our payload didn't exceed either of the limits.
Ok((
EncodeResult::compressed(payload, raw_bytes_written, self.state.byte_size.clone()),
EncodeResult::compressed(payload, raw_bytes_written, byte_size),
processed,
))
} else {
Expand Down
15 changes: 14 additions & 1 deletion src/sinks/datadog/metrics/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use futures::{channel::mpsc::Receiver, stream, StreamExt};
use hyper::StatusCode;
use indoc::indoc;
use rand::{thread_rng, Rng};
use vector_core::event::{BatchNotifier, BatchStatus, Event, Metric, MetricKind, MetricValue};
use vector_core::{
config::{init_telemetry, Tags, Telemetry},
event::{BatchNotifier, BatchStatus, Event, Metric, MetricKind, MetricValue},
};

use super::DatadogMetricsConfig;
use crate::{
Expand Down Expand Up @@ -207,5 +210,15 @@ async fn real_endpoint() {

#[tokio::test]
async fn data_volume_tags() {
init_telemetry(
Telemetry {
tags: Tags {
emit_service: true,
emit_source: true,
},
},
true,
);

assert_data_volume_sink_compliance(&DATA_VOLUME_SINK_TAGS, async { run_sink().await }).await;
}

0 comments on commit 0fbe38e

Please sign in to comment.