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

feat(new sink): Add AppSignal sink #16650

Merged
merged 23 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ab78025
feat(new sink): Add AppSignal sink
tombruijn Feb 22, 2023
864238f
Auto configure TLS settings for AppSignal sink
tombruijn Mar 17, 2023
d2fca64
Set default AppSignal endpoint with Serde
tombruijn Mar 17, 2023
3fb4f54
Fix clippy warning by removing unnecessary clone
tombruijn Mar 17, 2023
d1deaec
Update generated AppSignal sink docs
tombruijn Mar 17, 2023
9b9e85f
Add AppSignal sink integration test
tombruijn Mar 20, 2023
b732764
Simplify the AppSignal endpoint_uri function
tombruijn Mar 27, 2023
28c5bab
Add AppSignal error case integration scenario
tombruijn Mar 27, 2023
351a0f0
Use write_all helper function for payload encoding
tombruijn Mar 27, 2023
8bc473a
Handle compression error without panic
tombruijn Mar 27, 2023
f07ae12
Apply fixes from a couple review feedback items
tombruijn Mar 27, 2023
af88729
Add basic AppSignal module documentation
tombruijn Mar 27, 2023
4a72874
Merge branch 'master' into appsignal-sink-json
tombruijn Mar 27, 2023
09d88d0
Add zlib compression support to AppSignal sink
tombruijn Mar 29, 2023
01c615e
Update AppSignal sink copy
tombruijn Mar 29, 2023
ec9d5fe
Merge branch 'master' into appsignal-sink-json
tombruijn Mar 29, 2023
efa7631
Simplify AppSignal sink compression step
tombruijn Mar 30, 2023
f287fc3
Update appsignal.cue file
tombruijn Mar 30, 2023
ffe2831
Fix review feedback
tombruijn Apr 3, 2023
bcae1f7
Change encoder comments to be doc comments
tombruijn Apr 4, 2023
c042735
Revert custom compression struct
tombruijn Apr 4, 2023
1c4e189
Use gzip compression as default for AppSignal sink
tombruijn Apr 5, 2023
4b7b860
Simplify compression header on AppSignal sink
tombruijn Apr 5, 2023
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
3 changes: 3 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Apanda
apikey
apimachinery
apiserver
appsignal
Appsignal
neuronull marked this conversation as resolved.
Show resolved Hide resolved
APPSIGNAL
archlinux
Archos
Arival
Expand Down
1 change: 1 addition & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ scopes:

# sinks
- amqp sink # Anything `amqp` sink related
- appsignal sink # Anything `appsignal` sink related
- aws_cloudwatch_logs sink # Anything `aws_cloudwatch_logs` sink related
- aws_cloudwatch_metrics sink # Anything `aws_cloudwatch_metrics` sink related
- aws_kinesis_firehose sink # Anything `aws_kinesis_firehose` sink related
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
matrix:
include:
- test: 'amqp'
- test: 'appsignal'
- test: 'aws'
- test: 'axiom'
- test: 'azure'
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ transforms-throttle = ["dep:governor"]
sinks = ["sinks-logs", "sinks-metrics"]
sinks-logs = [
"sinks-amqp",
"sinks-appsignal",
"sinks-aws_cloudwatch_logs",
"sinks-aws_kinesis_firehose",
"sinks-aws_kinesis_streams",
Expand Down Expand Up @@ -635,6 +636,7 @@ sinks-logs = [
"sinks-websocket",
]
sinks-metrics = [
"sinks-appsignal",
"sinks-aws_cloudwatch_metrics",
"sinks-blackhole",
"sinks-console",
Expand All @@ -650,6 +652,7 @@ sinks-metrics = [
]

sinks-amqp = ["lapin"]
sinks-appsignal = []
sinks-aws_cloudwatch_logs = ["aws-core", "dep:aws-sdk-cloudwatchlogs"]
sinks-aws_cloudwatch_metrics = ["aws-core", "dep:aws-sdk-cloudwatch"]
sinks-aws_kinesis_firehose = ["aws-core", "dep:aws-sdk-firehose"]
Expand Down Expand Up @@ -714,6 +717,7 @@ nightly = []
# Testing-related features
all-integration-tests = [
"amqp-integration-tests",
"appsignal-integration-tests",
"aws-integration-tests",
"axiom-integration-tests",
"azure-integration-tests",
Expand Down Expand Up @@ -751,6 +755,7 @@ all-integration-tests = [
]

amqp-integration-tests = ["sources-amqp", "sinks-amqp"]
appsignal-integration-tests = ["sinks-appsignal"]

aws-integration-tests = [
"aws-cloudwatch-logs-integration-tests",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ test-behavior: test-behavior-transforms test-behavior-formats test-behavior-conf

.PHONY: test-integration
test-integration: ## Runs all integration tests
test-integration: test-integration-amqp test-integration-aws test-integration-axiom test-integration-azure test-integration-chronicle test-integration-clickhouse
test-integration: test-integration-amqp test-integration-appsignal test-integration-aws test-integration-axiom test-integration-azure test-integration-chronicle test-integration-clickhouse
test-integration: test-integration-databend test-integration-docker-logs test-integration-elasticsearch
test-integration: test-integration-eventstoredb test-integration-fluent test-integration-gcp test-integration-humio test-integration-http-client test-integration-influxdb
test-integration: test-integration-kafka test-integration-logstash test-integration-loki test-integration-mongodb test-integration-nats
Expand Down
11 changes: 11 additions & 0 deletions scripts/integration/appsignal/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
features:
- appsignal-integration-tests

test_filter: '::appsignal::integration_tests::'

runner:
env:
TEST_APPSIGNAL_PUSH_API_KEY:

matrix:
version: [latest]
93 changes: 93 additions & 0 deletions src/sinks/appsignal/integration_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
use futures::stream;
use indoc::indoc;
use vector_core::event::{BatchNotifier, BatchStatus, Event, Metric, MetricKind, MetricValue};

use crate::{
config::SinkConfig,
sinks::appsignal::AppsignalSinkConfig,
sinks::util::test::load_sink,
test_util::{
components::{
assert_sink_compliance, assert_sink_error, run_and_assert_sink_compliance,
COMPONENT_ERROR_TAGS, SINK_TAGS,
},
generate_lines_with_stream, map_event_batch_stream,
},
};

tombruijn marked this conversation as resolved.
Show resolved Hide resolved
#[tokio::test]
async fn logs_real_endpoint() {
let config = indoc! {r#"
push_api_key = "${TEST_APPSIGNAL_PUSH_API_KEY}"
"#};
let api_key = std::env::var("TEST_APPSIGNAL_PUSH_API_KEY")
.expect("couldn't find the AppSignal push API key in environment variables");
assert!(!api_key.is_empty(), "$TEST_APPSIGNAL_PUSH_API_KEY required");
let config = config.replace("${TEST_APPSIGNAL_PUSH_API_KEY}", &api_key);
let (config, cx) = load_sink::<AppsignalSinkConfig>(config.as_str()).unwrap();

let (sink, _) = config.build(cx).await.unwrap();
let (batch, receiver) = BatchNotifier::new_with_receiver();
let generator = |index| format!("this is a log with index {}", index);
let (_, events) = generate_lines_with_stream(generator, 10, Some(batch));

run_and_assert_sink_compliance(sink, events, &SINK_TAGS).await;

assert_eq!(receiver.await, BatchStatus::Delivered);
}

#[tokio::test]
async fn metrics_real_endpoint() {
assert_sink_compliance(&SINK_TAGS, async {
let config = indoc! {r#"
push_api_key = "${TEST_APPSIGNAL_PUSH_API_KEY}"
"#};
let api_key = std::env::var("TEST_APPSIGNAL_PUSH_API_KEY")
.expect("couldn't find the AppSignal push API key in environment variables");
assert!(!api_key.is_empty(), "$TEST_APPSIGNAL_PUSH_API_KEY required");
let config = config.replace("${TEST_APPSIGNAL_PUSH_API_KEY}", &api_key);
let (config, cx) = load_sink::<AppsignalSinkConfig>(config.as_str()).unwrap();

let (sink, _) = config.build(cx).await.unwrap();
let (batch, receiver) = BatchNotifier::new_with_receiver();
let events: Vec<_> = (0..10)
.map(|index| {
Event::Metric(Metric::new(
"counter",
MetricKind::Absolute,
MetricValue::Counter {
value: index as f64,
},
))
})
.collect();
let stream = map_event_batch_stream(stream::iter(events.clone()), Some(batch));

sink.run(stream).await.unwrap();
assert_eq!(receiver.await, BatchStatus::Delivered);
})
.await;
}

#[tokio::test]
async fn error_scenario_real_endpoint() {
assert_sink_error(&COMPONENT_ERROR_TAGS, async {
let config = indoc! {r#"
push_api_key = "invalid key"
"#};
let (config, cx) = load_sink::<AppsignalSinkConfig>(config).unwrap();

let (sink, _) = config.build(cx).await.unwrap();
let (batch, receiver) = BatchNotifier::new_with_receiver();
let events = vec![Event::Metric(Metric::new(
"counter",
MetricKind::Absolute,
MetricValue::Counter { value: 1.0 },
))];
let stream = map_event_batch_stream(stream::iter(events.clone()), Some(batch));

sink.run(stream).await.unwrap();
assert_eq!(receiver.await, BatchStatus::Rejected);
})
.await;
}
Loading