AttributeContext

Struct AttributeContext 

Source
#[non_exhaustive]
pub struct AttributeContext { pub origin: Option<Peer>, pub source: Option<Peer>, pub destination: Option<Peer>, pub request: Option<Request>, pub response: Option<Response>, pub resource: Option<Resource>, pub api: Option<Api>, pub extensions: Vec<Any>, /* private fields */ }
Expand description

This message defines the standard attribute vocabulary for Google APIs.

An attribute is a piece of metadata that describes an activity on a network service. For example, the size of an HTTP request, or the status code of an HTTP response.

Each attribute has a type and a name, which is logically defined as a proto message field in AttributeContext. The field type becomes the attribute type, and the field path becomes the attribute name. For example, the attribute source.ip maps to field AttributeContext.source.ip.

This message definition is guaranteed not to have any wire breaking change. So you can use it directly for passing attributes across different systems.

NOTE: Different system may generate different subset of attributes. Please verify the system specification before relying on an attribute generated a system.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§origin: Option<Peer>

The origin of a network activity. In a multi hop network activity, the origin represents the sender of the first hop. For the first hop, the source and the origin must have the same content.

§source: Option<Peer>

The source of a network activity, such as starting a TCP connection. In a multi hop network activity, the source represents the sender of the last hop.

§destination: Option<Peer>

The destination of a network activity, such as accepting a TCP connection. In a multi hop network activity, the destination represents the receiver of the last hop.

§request: Option<Request>

Represents a network request, such as an HTTP request.

§response: Option<Response>

Represents a network response, such as an HTTP response.

§resource: Option<Resource>

Represents a target resource that is involved with a network activity. If multiple resources are involved with an activity, this must be the primary one.

§api: Option<Api>

Represents an API operation that is involved to a network activity.

§extensions: Vec<Any>

Supports extensions for advanced use cases, such as logs and metrics.

Implementations§

Source§

impl AttributeContext

Source

pub fn new() -> Self

Source

pub fn set_origin<T>(self, v: T) -> Self
where T: Into<Peer>,

Sets the value of origin.

Source

pub fn set_or_clear_origin<T>(self, v: Option<T>) -> Self
where T: Into<Peer>,

Sets or clears the value of origin.

Source

pub fn set_source<T>(self, v: T) -> Self
where T: Into<Peer>,

Sets the value of source.

Source

pub fn set_or_clear_source<T>(self, v: Option<T>) -> Self
where T: Into<Peer>,

Sets or clears the value of source.

Source

pub fn set_destination<T>(self, v: T) -> Self
where T: Into<Peer>,

Sets the value of destination.

Source

pub fn set_or_clear_destination<T>(self, v: Option<T>) -> Self
where T: Into<Peer>,

Sets or clears the value of destination.

Source

pub fn set_request<T>(self, v: T) -> Self
where T: Into<Request>,

Sets the value of request.

Source

pub fn set_or_clear_request<T>(self, v: Option<T>) -> Self
where T: Into<Request>,

Sets or clears the value of request.

Source

pub fn set_response<T>(self, v: T) -> Self
where T: Into<Response>,

Sets the value of response.

Source

pub fn set_or_clear_response<T>(self, v: Option<T>) -> Self
where T: Into<Response>,

Sets or clears the value of response.

Source

pub fn set_resource<T>(self, v: T) -> Self
where T: Into<Resource>,

Sets the value of resource.

Source

pub fn set_or_clear_resource<T>(self, v: Option<T>) -> Self
where T: Into<Resource>,

Sets or clears the value of resource.

Source

pub fn set_api<T>(self, v: T) -> Self
where T: Into<Api>,

Sets the value of api.

Source

pub fn set_or_clear_api<T>(self, v: Option<T>) -> Self
where T: Into<Api>,

Sets or clears the value of api.

Source

pub fn set_extensions<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Any>,

Sets the value of extensions.

Trait Implementations§

Source§

impl Clone for AttributeContext

Source§

fn clone(&self) -> AttributeContext

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AttributeContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AttributeContext

Source§

fn default() -> AttributeContext

Returns the “default value” for a type. Read more
Source§

impl Message for AttributeContext

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for AttributeContext

Source§

fn eq(&self, other: &AttributeContext) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AttributeContext

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,