Skip to content

Commit

Permalink
Clarify the association between resource and API objects.
Browse files Browse the repository at this point in the history
Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Sep 27, 2019
1 parent 5693b4f commit 8eab6a9
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions specification/sdk-resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,42 @@ with closed source environments. API MUST allow for creation of `Resources` and
for associating them with telemetry.

When used with distributed tracing, a resource can be associated with the
[Tracer](sdk-tracing.md#tracer-sdk). When associated with `Tracer`, all `Span`s
produced by this `Tracer` will automatically be associated with this `Resource`.
[TracerSdk](sdk-tracing.md#tracer-sdk). When associated with `TracerSdk`, all
`Span`s produced by the `Tracer`, that is implemented by this `TracerSdk`, will
automatically be associated with this `Resource`.

When used with distributed tracing, a resource can be associated with the
[Meter](sdk-metrics.md#meter-sdk). When associated with `Meter`, all `Metrics`
produced by this `Meter` will automatically be associated with this `Resource`.
When used with metrics, a resource can be associated with the
[MeterSdk](sdk-metrics.md#meter-sdk). When associated with `MeterSdk`, all
`Metrics` produced by this `Meter`, that is implemented by this `MeterSdk`, will
automatically be associated with this `Resource`.

## Resource creation

The API interface must support two ways to instantiate new resources. Those
are:
The API interface must support two ways to instantiate new resources. Those are:

### Create

The interface MUST provide a way to create a new resource, from a collection
of labels. Examples include a factory method or a constructor for
a resource object. A factory method is recommended to enable support for
cached objects.
The interface MUST provide a way to create a new resource, from a collection of
labels. Examples include a factory method or a constructor for a resource
object. A factory method is recommended to enable support for cached objects.

Required parameters:

- a collection of name/value labels, where name and value are both strings.

### Merge

The interface MUST provide a way for a primary resource to merge with a
secondary resource, resulting in the creation of a brand new resource. The
The interface MUST provide a way for a primary resource to merge with a
secondary resource, resulting in the creation of a brand new resource. The
original resources should be unmodified.

This is utilized for merging of resources whose labels come from different
sources, such as environment variables, or metadata extracted from the host or
sources, such as environment variables, or metadata extracted from the host or
container.

Already set labels MUST NOT be overwritten unless they are the empty string.
Already set labels MUST NOT be overwritten unless they are the empty string.

Label key namespacing SHOULD be used to prevent collisions across different
Label key namespacing SHOULD be used to prevent collisions across different
resource detection steps.

Required parameters:
Expand All @@ -53,7 +53,7 @@ Required parameters:

### The empty resource

It is recommended, but not required, to provide a way to quickly create an empty
It is recommended, but not required, to provide a way to quickly create an empty
resource.

Note that the OpenTelemetry project documents certain ["standard
Expand All @@ -66,12 +66,12 @@ In addition to resource creation, the following operations should be provided:
### Retrieve labels

The API should provide a way to retrieve a read only collection of labels
associated with a resource. The labels should consist of the name and values,
associated with a resource. The labels should consist of the name and values,
both of which should be strings.

There is no need to guarantee the order of the labels.

The most common operation when retrieving labels is to enumerate over them.
As such, it is recommended to optimize the resulting collection for fast
enumeration over other considerations such as a way to quickly retrieve a
value for a label with a specific key.
The most common operation when retrieving labels is to enumerate over them. As
such, it is recommended to optimize the resulting collection for fast
enumeration over other considerations such as a way to quickly retrieve a value
for a label with a specific key.

0 comments on commit 8eab6a9

Please sign in to comment.