-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add OpenObserve as an officially supported sink #21531
base: master
Are you sure you want to change the base?
Changes from 9 commits
2a46d42
6857318
734a2e9
ad1cc57
4d8db24
835cdee
378e0db
9308824
456cfc1
552c0ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,7 @@ Nextbook | |
Nextcloud | ||
OVH | ||
Odys | ||
openobserve | ||
Openpeak | ||
Oppo | ||
Ovi | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -709,6 +709,7 @@ sinks-logs = [ | |
"sinks-new_relic", | ||
"sinks-papertrail", | ||
"sinks-pulsar", | ||
"sinks-openobserve", | ||
"sinks-redis", | ||
"sinks-sematext", | ||
"sinks-socket", | ||
|
@@ -772,6 +773,7 @@ sinks-mqtt = ["dep:rumqttc"] | |
sinks-nats = ["dep:async-nats", "dep:nkeys"] | ||
sinks-new_relic_logs = ["sinks-http"] | ||
sinks-new_relic = [] | ||
sinks-openobserve = ["sinks-http"] | ||
sinks-papertrail = ["dep:syslog"] | ||
sinks-prometheus = ["dep:base64", "dep:prost", "vector-lib/prometheus"] | ||
sinks-pulsar = ["dep:apache-avro", "dep:pulsar", "dep:lru"] | ||
|
@@ -821,6 +823,7 @@ all-integration-tests = [ | |
"nats-integration-tests", | ||
"nginx-integration-tests", | ||
"opentelemetry-integration-tests", | ||
"openobserve-integration-tests", | ||
"postgresql_metrics-integration-tests", | ||
"prometheus-integration-tests", | ||
"pulsar-integration-tests", | ||
|
@@ -885,6 +888,7 @@ mqtt-integration-tests = ["sinks-mqtt"] | |
nats-integration-tests = ["sinks-nats", "sources-nats"] | ||
nginx-integration-tests = ["sources-nginx_metrics"] | ||
opentelemetry-integration-tests = ["sources-opentelemetry", "dep:prost"] | ||
openobserve-integration-tests = ["sinks-openobserve"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any use of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes |
||
postgresql_metrics-integration-tests = ["sources-postgresql_metrics"] | ||
prometheus-integration-tests = ["sinks-prometheus", "sources-prometheus", "sinks-influxdb"] | ||
pulsar-integration-tests = ["sinks-pulsar", "sources-pulsar"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -367,7 +367,7 @@ test-integration: ## Runs all integration tests | |
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-greptimedb 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 | ||
test-integration: test-integration-kafka test-integration-logstash test-integration-loki test-integration-mongodb test-integration-nats test-integration-openobserve | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any use of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure |
||
test-integration: test-integration-nginx test-integration-opentelemetry test-integration-postgres test-integration-prometheus test-integration-pulsar | ||
test-integration: test-integration-redis test-integration-splunk test-integration-dnstap test-integration-datadog-agent test-integration-datadog-logs test-integration-e2e-datadog-logs | ||
test-integration: test-integration-datadog-traces test-integration-shutdown | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
use http::Uri; | ||
use vector_lib::codecs::encoding::{FramingConfig, JsonSerializerConfig, SerializerConfig}; | ||
use vector_lib::configurable::configurable_component; | ||
|
||
use crate::{ | ||
codecs::{EncodingConfig, EncodingConfigWithFraming}, | ||
config::{AcknowledgementsConfig, DataType, GenerateConfig, Input, SinkConfig, SinkContext}, | ||
http::{Auth, MaybeAuth}, | ||
sinks::{ | ||
http::config::{HttpMethod, HttpSinkConfig}, | ||
util::{ | ||
http::RequestConfig, BatchConfig, Compression, RealtimeSizeBasedDefaultBatchSettings, | ||
UriSerde, | ||
}, | ||
Healthcheck, VectorSink, | ||
}, | ||
tls::TlsConfig, | ||
}; | ||
|
||
/// Configuration for the `openobserve` sink. | ||
#[configurable_component(sink("openobserve", "Deliver log events to OpenObserve."))] | ||
#[derive(Clone, Debug)] | ||
pub struct OpenObserveConfig { | ||
/// The OpenObserve endpoint to send data to. | ||
#[serde(default = "default_endpoint")] | ||
#[configurable(metadata(docs::examples = "http://localhost:5080/api/default/default/_json"))] | ||
uri: UriSerde, | ||
|
||
/// The user and password to authenticate with OpenObserve endpoint. | ||
#[configurable(derived)] | ||
auth: Option<Auth>, | ||
|
||
#[configurable(derived)] | ||
#[serde(default)] | ||
request: RequestConfig, | ||
|
||
/// The compression algorithm to use. | ||
#[configurable(derived)] | ||
#[serde(default = "Compression::gzip_default")] | ||
compression: Compression, | ||
|
||
#[configurable(derived)] | ||
encoding: EncodingConfig, | ||
|
||
/// The batch settings for the sink. | ||
#[configurable(derived)] | ||
#[serde(default)] | ||
pub batch: BatchConfig<RealtimeSizeBasedDefaultBatchSettings>, | ||
|
||
/// Controls how acknowledgements are handled for this sink. | ||
#[configurable(derived)] | ||
#[serde( | ||
default, | ||
deserialize_with = "crate::serde::bool_or_struct", | ||
skip_serializing_if = "crate::serde::is_default" | ||
)] | ||
acknowledgements: AcknowledgementsConfig, | ||
|
||
/// The TLS settings for the connection. | ||
/// | ||
/// Optional, constrains TLS settings for this sink. | ||
#[configurable(derived)] | ||
tls: Option<TlsConfig>, | ||
} | ||
|
||
impl GenerateConfig for OpenObserveConfig { | ||
fn generate_config() -> toml::Value { | ||
toml::from_str( | ||
r#" | ||
uri = "http://localhost:5080/api/default/default/_json" | ||
Auth = "user: [email protected], password: your_ingestion_password" | ||
encoding.codec = "json" | ||
"#, | ||
) | ||
.unwrap() | ||
} | ||
} | ||
|
||
fn default_endpoint() -> UriSerde { | ||
UriSerde { | ||
uri: Uri::from_static("http://localhost:5080/api/default/default/_json"), | ||
auth: None, | ||
} | ||
} | ||
|
||
#[async_trait::async_trait] | ||
#[typetag::serde(name = "openobserve")] | ||
impl SinkConfig for OpenObserveConfig { | ||
async fn build(&self, cx: SinkContext) -> crate::Result<(VectorSink, Healthcheck)> { | ||
let request = self.request.clone(); | ||
|
||
// OpenObserve supports native HTTP ingest endpoint. This configuration wraps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would move this above
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
// the vector HTTP sink to provide official support for OpenObserve. This sink will | ||
// allow maintaining the vector OpenObserve sink independent of the vector HTTP sink | ||
// configuration and will allow to accomodate any future changes to the interface. | ||
let http_sink_config = HttpSinkConfig { | ||
uri: self.uri.clone(), | ||
compression: self.compression, | ||
auth: self.auth.choose_one(&self.uri.auth)?, | ||
method: HttpMethod::Post, | ||
tls: self.tls.clone(), | ||
request, | ||
acknowledgements: self.acknowledgements, | ||
batch: self.batch, | ||
headers: None, | ||
encoding: EncodingConfigWithFraming::new( | ||
Some(FramingConfig::Bytes), | ||
SerializerConfig::Json(JsonSerializerConfig::default()), | ||
self.encoding.transformer(), | ||
), | ||
payload_prefix: "".into(), // Always newline delimited JSON | ||
payload_suffix: "".into(), // Always newline delimited JSON | ||
}; | ||
|
||
http_sink_config.build(cx).await | ||
} | ||
|
||
fn input(&self) -> Input { | ||
Input::new(self.encoding.config().input_type() & DataType::Log) | ||
} | ||
|
||
fn acknowledgements(&self) -> &AcknowledgementsConfig { | ||
&self.acknowledgements | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod test { | ||
#[test] | ||
fn generate_config() { | ||
crate::test_util::test_generate_config::<super::OpenObserveConfig>(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this used anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was following #21514 (comment). Could you guide me on where to open a PR to be able to be added on https://vector.dev/guides/ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @chaitanya-sistla, thank you for pointing me to this. That proposal makes sense to me.
Since there is no precedent, let's think about it a bit:
Overall, I am happy with both options. But if we go with (1), we might need to do a few iterations since there is no precedent. Option (2) is more straightforward to do. For option (3), the guides live in
website/content/en/guides
.Also, I would like to cc @jszwedko for awareness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @pront I would like to follow the first approach if that is ideal. Does my PR reflect the Option (1)? Please let me know if I have to make any changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is precedent for (1). An example would be the recent changes to the Axiom sink: #21362
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the CLA, can you try from a different browser or cleaning your cookies? Seems like the Github signin failed for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I opened in other browsers, it doesn't show an option called Agree anywhere and auto redirects me to github once I signed in with my github.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue might be that your commits don't have an email address associated. Could you set an email address via
git config user.email
and the usegit rebase
to squash and thengit commit --amend --reset-author
to add an email address to the commits? The email you use should be associated with your GitHub account.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes here only modify documentation. We need to actually implement another sink to follow existing precedent (i.e. write Rust code). See the
axiom
sink for an example: https://github.com/vectordotdev/vector/blob/master/src/sinks/axiom.rs. That sink also just wraps thehttp
sink as you would do. Let me know if that is unclear!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, the cla issue is now resolved. Let me look into this.