-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: allow default uri as openobserve ingestion endpoint
- Loading branch information
Showing
2 changed files
with
17 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
use http::Uri; | ||
use vector_lib::codecs::encoding::{FramingConfig, JsonSerializerConfig, SerializerConfig}; | ||
use vector_lib::configurable::configurable_component; | ||
|
||
|
@@ -21,6 +22,7 @@ use crate::{ | |
#[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, | ||
|
||
|
@@ -65,7 +67,7 @@ impl GenerateConfig for OpenObserveConfig { | |
fn generate_config() -> toml::Value { | ||
toml::from_str( | ||
r#" | ||
endpoint = "http://localhost:5080/api/default/default/_json" | ||
uri = "http://localhost:5080/api/default/default/_json" | ||
Auth = "user: [email protected], password: your_ingestion_password" | ||
encoding.codec = "json" | ||
"#, | ||
|
@@ -74,14 +76,21 @@ impl GenerateConfig for OpenObserveConfig { | |
} | ||
} | ||
|
||
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 | ||
// the vector HTTP sink to provide official support for OpenObserve. This sink will | ||
// 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 { | ||
|
This file contains 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