1
- //! # Resource
1
+ //! Representations of entities producing telemetry.
2
2
//!
3
- //! A `Resource` is an immutable representation of the entity producing telemetry. For example, a
4
- //! process producing telemetry that is running in a container on Kubernetes has a Pod name, it is
5
- //! in a namespace, and possibly is part of a Deployment which also has a name. All three of these
6
- //! attributes can be included in the `Resource`.
3
+ //! A [Resource] is an immutable representation of the entity producing
4
+ //! telemetry as attributes. For example, a process producing telemetry that is
5
+ //! running in a container on Kubernetes has a Pod name, it is in a namespace
6
+ //! and possibly is part of a Deployment which also has a name. All three of
7
+ //! these attributes can be included in the `Resource`. Note that there are
8
+ //! certain ["standard attributes"] that have prescribed meanings.
7
9
//!
8
- //! The primary purpose of resources as a first-class concept in the SDK is decoupling of discovery
9
- //! of resource information from exporters. This allows for independent development and easy
10
- //! customization for users that need to integrate with closed source environments. When used with
11
- //! distributed tracing, a resource can be associated with the [`TracerProvider`] when it is created.
12
- //! That association cannot be changed later. When associated with a `TracerProvider`, all `Span`s
13
- //! produced by any `Tracer` from the provider are associated with this `Resource`.
14
- //!
15
- //! [`TracerProvider`]: crate::trace::TracerProvider
10
+ //! ["standard attributes"]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.9.0/specification/resource/semantic_conventions/README.md
16
11
//!
17
12
//! # Resource detectors
18
13
//!
19
- //! `ResourceDetector`s are used to detect resource from runtime or environmental variables. The
20
- //! following `ResourceDetector`s are provided along with this SDK.
14
+ //! [`ResourceDetector`]s are used to detect resource from runtime or
15
+ //! environmental variables. The following are provided by default with this
16
+ //! SDK.
21
17
//!
22
- //! - EnvResourceDetector, detect resource from environmental variables.
23
- //! - OsResourceDetector, detect OS from runtime.
24
- //! - ProcessResourceDetector, detect process information
18
+ //! - [` EnvResourceDetector`] - detect resource from environmental variables.
19
+ //! - [` OsResourceDetector`] - detect OS from runtime.
20
+ //! - [` ProcessResourceDetector`] - detect process information.
25
21
mod env;
26
22
mod os;
27
23
mod process;
@@ -38,9 +34,7 @@ use std::collections::{btree_map, BTreeMap};
38
34
use std:: ops:: Deref ;
39
35
use std:: time:: Duration ;
40
36
41
- /// Describes an entity about which identifying information and metadata is exposed.
42
- ///
43
- /// Items are sorted by their key, and are only overwritten if the value is an empty string.
37
+ /// An immutable representation of the entity producing telemetry as attributes.
44
38
#[ derive( Clone , Debug , PartialEq ) ]
45
39
pub struct Resource {
46
40
attrs : BTreeMap < Key , Value > ,
0 commit comments