opentelemetry_http

Trait HttpClient

Source
pub trait HttpClient:
    Debug
    + Send
    + Sync {
    // Required method
    fn send<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Vec<u8>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A minimal interface necessary for sending requests over HTTP. Used primarily for exporting telemetry over HTTP. Also used for fetching sampling strategies for JaegerRemoteSampler

Users sometime choose HTTP clients that relay on a certain async runtime. This trait allows users to bring their choice of HTTP client.

Required Methods§

Source

fn send<'life0, 'async_trait>( &'life0 self, request: Request<Vec<u8>>, ) -> Pin<Box<dyn Future<Output = Result<Response<Bytes>, HttpError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send the specified HTTP request

Returns the HTTP response including the status code and body.

Returns an error if it can’t connect to the server or the request could not be completed, e.g. because of a timeout, infinite redirects, or a loss of connection.

Implementors§