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

chore(http sink): refactor to new style #18200

Merged
merged 22 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
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
6 changes: 6 additions & 0 deletions docs/tutorials/sinks/2_http_sink.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ where the data is actually sent.

# Service

**⚠ NOTE! This section implements an HTTP tower `Service` from scratch, for the
purpose of demonstration only. Many sinks will require implementing `Service`
in this way. Any new HTTP based sink should ideally utilize the structure
`HttpService`, which handles most of what this section discusses in a shared
structure that HTTP based sinks can utilize.**
neuronull marked this conversation as resolved.
Show resolved Hide resolved

We need to create a [`Tower`][tower] service that is responsible for actually
sending our final encoded data.

Expand Down
3 changes: 3 additions & 0 deletions src/sinks/appsignal/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ use super::request_builder::AppsignalRequest;

#[derive(Clone)]
pub(super) struct AppsignalService {
// TODO: `HttpBatchService` has been deprecated for direct use in sinks.
// This sink should undergo a refactor to utilize the `HttpService`
// instead, which extracts much of the boilerplate code for `Service`.
pub(super) batch_service:
HttpBatchService<Ready<Result<http::Request<Bytes>, crate::Error>>, AppsignalRequest>,
}
Expand Down
3 changes: 3 additions & 0 deletions src/sinks/datadog/events/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ impl DriverResponse for DatadogEventsResponse {

#[derive(Clone)]
pub struct DatadogEventsService {
// TODO: `HttpBatchService` has been deprecated for direct use in sinks.
// This sink should undergo a refactor to utilize the `HttpService`
// instead, which extracts much of the boilerplate code for `Service`.
batch_http_service:
HttpBatchService<Ready<Result<http::Request<Bytes>, crate::Error>>, DatadogEventsRequest>,
}
Expand Down
3 changes: 3 additions & 0 deletions src/sinks/elasticsearch/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ impl MetaDescriptive for ElasticsearchRequest {

#[derive(Clone)]
pub struct ElasticsearchService {
// TODO: `HttpBatchService` has been deprecated for direct use in sinks.
// This sink should undergo a refactor to utilize the `HttpService`
// instead, which extracts much of the boilerplate code for `Service`.
batch_service: HttpBatchService<
BoxFuture<'static, Result<http::Request<Bytes>, crate::Error>>,
ElasticsearchRequest,
Expand Down
Loading