Status: Development
Table of Contents
A Resource is a representation of the entity producing telemetry as Attributes. For example, You could have a process producing telemetry that is running in a container on Kubernetes, which is associated to a Pod running on a Node that is a VM but also is in a namespace and possibly is part of a Deployment. Resource could have attributes to denote information about the Container, the Pod, the Node, the VM or the Deployment. All of these help identify what produced the telemetry. Note that there are certain attributes that have prescribed meanings.
A resource is composed of 0 or more Entities and 0
or more attributes not associated with any entity.
The data model below defines a logical model for an Resource (irrespective of the physical format and encoding of how resource data is recorded).
| Field | Type | Description |
|---|---|---|
| Entities | set<Entity> | Defines the set of Entities associated with this resource. |
| Attributes | map<string, attribute value> | Additional Attributes that identify the resource. MUST not change during the lifetime of the resource. Follows OpenTelemetry attribute definition. |
Most resources are a composition of Entity.
Entity includes its own notion of identity. The identity of a resource is
the set of entities contained within it. Two resources are considered
different if one contains an entity not found in the other.
Some resources include raw attributes in addition to Entities. Raw attributes are considered identifying on a resource. That is, if the key-value pairs of raw attributes are different, then you can assume the resource is different.
Note: The current SDK specification outlines a merge algorithm. This specification updates the algorithm to be compliant with entities. This section will replace that section upon stabilization of entities. SDKs SHOULD NOT update their merge algorithm until full Entity SDK support is provided.
Merging resources is an action of joining together the context of observation. That is, we can look at the resource context for a signal and expand that context to include more details (see telescoping identity). As such, a merge SHOULD preserve any identity that already existed on a Resource while adding in new identifying information or descriptive attributes.
We define the following algorithm for merging entities into an existing resource.
- Construct a set of existing entities on the resource,
E.- For each entity,
new_entity, in priority order (highest first), do one of the following:- If an entity
eexists inEwith the same entity type asnew_entity:- Perform an Entity DataModel Merge with
eandnew_entity - Note: If unable to merge
eandnew_entity, then no change is made.
- Perform an Entity DataModel Merge with
- Otherwise, add the entity
new_entityto setE
- If an entity
- For each entity,
- Update the Resource to use the set of entities
E.- If all entities within
Ehave the sameschema_url, set the resourcesschema_urlto match. - Otherwise set the Resource
schema_urlblank. - Remove any attribute from
Attributeswhich exists in either the description or identity of an entity inE.
- If all entities within
- Solve for resource flattening issues (See
Attribute Referencing Model).
- If, for all entities, there are now overlapping attribute keys, then nothing is needed.
- If there is a conflict where two entities use the same attribute key, but both have the same value, then nothing is needed.
- If there is a conflict where two entities use the same attribute key, and one of those entities treats has the attribute in its description, then remove this attribute from the entity's description.
- If there is a conflict where two entities use the same attribute key and both use that attribute for the entity identity, then remove the lower priority entity from the Resource.