Skip to content

Commit d3a6235

Browse files
authored
chore(http sink): refactor to new style (vectordotdev#18200)
* First iteration, unit tests pass. * Extract common Service functionality for HTTP based stream sinks. * docs touchup * Touch ups * spell checker * fix rust doc * hopefully fix encoding regression * Try item sized batching * Refactor a bit * cleanup * cleanup * doc clean up * extract common service code for re use in other HTTP sinks * feeback sw * duplicate * feedback ds * feedback ds * clippy * fix write issue * fix docs
1 parent 31ec4b3 commit d3a6235

File tree

17 files changed

+1465
-1044
lines changed

17 files changed

+1465
-1044
lines changed

docs/tutorials/sinks/2_http_sink.md

+6
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ where the data is actually sent.
290290

291291
# Service
292292

293+
**⚠ NOTE! This section implements an HTTP tower `Service` from scratch, for the
294+
purpose of demonstration only. Many sinks will require implementing `Service`
295+
in this way. Any new HTTP-based sink should ideally utilize the
296+
`HttpService` structure, which abstracts away most of the logic shared
297+
amongst HTTP-based sinks.**
298+
293299
We need to create a [`Tower`][tower] service that is responsible for actually
294300
sending our final encoded data.
295301

src/sinks/appsignal/service.rs

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ use super::request_builder::AppsignalRequest;
2424

2525
#[derive(Clone)]
2626
pub(super) struct AppsignalService {
27+
// TODO: `HttpBatchService` has been deprecated for direct use in sinks.
28+
// This sink should undergo a refactor to utilize the `HttpService`
29+
// instead, which extracts much of the boilerplate code for `Service`.
2730
pub(super) batch_service:
2831
HttpBatchService<Ready<Result<http::Request<Bytes>, crate::Error>>, AppsignalRequest>,
2932
}

src/sinks/datadog/events/service.rs

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ impl DriverResponse for DatadogEventsResponse {
4343

4444
#[derive(Clone)]
4545
pub struct DatadogEventsService {
46+
// TODO: `HttpBatchService` has been deprecated for direct use in sinks.
47+
// This sink should undergo a refactor to utilize the `HttpService`
48+
// instead, which extracts much of the boilerplate code for `Service`.
4649
batch_http_service:
4750
HttpBatchService<Ready<Result<http::Request<Bytes>, crate::Error>>, DatadogEventsRequest>,
4851
}

src/sinks/elasticsearch/service.rs

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ impl MetaDescriptive for ElasticsearchRequest {
6868

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

0 commit comments

Comments
 (0)