logo
pub struct Resource { /* private fields */ }
Expand description

An immutable representation of the entity producing telemetry as attributes.

Implementations

Creates an empty resource.

Create a new Resource from key value pairs.

Values are de-duplicated by key, and the first key-value pair with a non-empty string value will be retained

Create a new Resource from a key value pairs and schema url.

Values are de-duplicated by key, and the first key-value pair with a non-empty string value will be retained.

schema_url must be a valid URL using HTTP or HTTPS protocol.

Create a new Resource from resource detectors.

timeout will be applied to each detector.

Create a new Resource by combining two resources.

Key value pairs

Keys from the other resource have priority over keys from this resource, even if the updated value is empty.

Schema url

If both of the resource are not empty. Schema url is determined by the following rules, in order:

  1. If this resource has a schema url, it will be used.
  2. If this resource does not have a schema url, and the other resource has a schema url, it will be used.
  3. If both resources have a schema url and it’s the same, it will be used.
  4. If both resources have a schema url and it’s different, the schema url will be empty.
  5. If both resources do not have a schema url, the schema url will be empty.

Return the schema url of the resource. If the resource does not have a schema url, return None.

Returns the number of attributes for this resource

Returns true if the resource contains no attributes.

Gets an iterator over the attributes of this resource, sorted by key.

Retrieve the value from resource associate with given key.

Available on crate feature metrics only.

Encoded attributes

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more

Attaches the current Context to this type, returning a WithContext wrapper. Read more

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.