-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(new sink): Add AppSignal sink #16650
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
Merged
Merged
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 864238f
Auto configure TLS settings for AppSignal sink
tombruijn d2fca64
Set default AppSignal endpoint with Serde
tombruijn 3fb4f54
Fix clippy warning by removing unnecessary clone
tombruijn d1deaec
Update generated AppSignal sink docs
tombruijn 9b9e85f
Add AppSignal sink integration test
tombruijn b732764
Simplify the AppSignal endpoint_uri function
tombruijn 28c5bab
Add AppSignal error case integration scenario
tombruijn 351a0f0
Use write_all helper function for payload encoding
tombruijn 8bc473a
Handle compression error without panic
tombruijn f07ae12
Apply fixes from a couple review feedback items
tombruijn af88729
Add basic AppSignal module documentation
tombruijn 4a72874
Merge branch 'master' into appsignal-sink-json
tombruijn 09d88d0
Add zlib compression support to AppSignal sink
tombruijn 01c615e
Update AppSignal sink copy
tombruijn ec9d5fe
Merge branch 'master' into appsignal-sink-json
tombruijn efa7631
Simplify AppSignal sink compression step
tombruijn f287fc3
Update appsignal.cue file
tombruijn ffe2831
Fix review feedback
tombruijn bcae1f7
Change encoder comments to be doc comments
tombruijn c042735
Revert custom compression struct
tombruijn 1c4e189
Use gzip compression as default for AppSignal sink
tombruijn 4b7b860
Simplify compression header on AppSignal sink
tombruijn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,9 @@ Apanda | |
| apikey | ||
| apimachinery | ||
| apiserver | ||
| appsignal | ||
| Appsignal | ||
| APPSIGNAL | ||
| archlinux | ||
| Archos | ||
| Arival | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.