pub struct WriteRequest {
pub timeseries: Vec<TimeSeries>,
}Expand description
A write request.
.proto:
message WriteRequest {
repeated TimeSeries timeseries = 1;
// Cortex uses this field to determine the source of the write request.
// We reserve it to avoid any compatibility issues.
reserved 2;
// Prometheus uses this field to send metadata, but this is
// omitted from v1 of the spec as it is experimental.
reserved 3;
}Fields§
§timeseries: Vec<TimeSeries>Implementations§
Source§impl WriteRequest
impl WriteRequest
Sourcepub fn sort(&mut self)
pub fn sort(&mut self)
Prepare the write request for sending.
Ensures that the request conforms to the specification. See https://prometheus.io/docs/concepts/remote_write_spec.
pub fn sorted(self) -> Self
Sourcepub fn encode_proto3(self) -> Vec<u8> ⓘ
pub fn encode_proto3(self) -> Vec<u8> ⓘ
Encode this write request as a protobuf message.
NOTE: The API requires snappy compression, not a raw protobuf message.
pub fn encode_compressed(self) -> Result<Vec<u8>, Error>
Sourcepub fn from_metric_families(
metric_families: Vec<MetricFamily>,
custom_labels: Option<Vec<(String, String)>>,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub fn from_metric_families( metric_families: Vec<MetricFamily>, custom_labels: Option<Vec<(String, String)>>, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Encode Prometheus metric families into a WriteRequest
pub fn build_http_request( self, client: Client, endpoint: &str, user_agent: &str, ) -> Result<Request, Error>
Trait Implementations§
Source§impl Clone for WriteRequest
impl Clone for WriteRequest
Source§fn clone(&self) -> WriteRequest
fn clone(&self) -> WriteRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WriteRequest
impl Debug for WriteRequest
Source§impl Default for WriteRequest
impl Default for WriteRequest
Source§impl Message for WriteRequest
impl Message for WriteRequest
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes an instance of the message from a buffer. Read more
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.Source§impl PartialEq for WriteRequest
impl PartialEq for WriteRequest
impl StructuralPartialEq for WriteRequest
Auto Trait Implementations§
impl Freeze for WriteRequest
impl RefUnwindSafe for WriteRequest
impl Send for WriteRequest
impl Sync for WriteRequest
impl Unpin for WriteRequest
impl UnwindSafe for WriteRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more