|
| 1 | +# Entity Data Model |
| 2 | + |
| 3 | +**Status**: [Development](../document-status.md) |
| 4 | + |
| 5 | +<details> |
| 6 | +<summary>Table of Contents</summary> |
| 7 | + |
| 8 | +<!-- toc --> |
| 9 | + |
| 10 | +- [Minimally Sufficient Identity](#minimally-sufficient-identity) |
| 11 | +- [Repeatable Identity](#repeatable-identity) |
| 12 | +- [Examples of Entities](#examples-of-entities) |
| 13 | + |
| 14 | +<!-- tocstop --> |
| 15 | + |
| 16 | +</details> |
| 17 | + |
| 18 | +Entity represents an object of interest associated with produced telemetry: |
| 19 | +traces, metrics, profiles, or logs. |
| 20 | + |
| 21 | +For example, telemetry produced using an OpenTelemetry SDK is normally |
| 22 | +associated with a `service` entity. Similarly, OpenTelemetry defines system |
| 23 | +metrics for a `host`. The `host` is the entity we want to associate metrics with |
| 24 | +in this case. |
| 25 | + |
| 26 | +Entities may be also associated with produced telemetry indirectly. |
| 27 | +For example a service that produces |
| 28 | +telemetry is also related to a process in which the service runs, so we say that |
| 29 | +the `service` entity is related to the `process` entity. The process normally |
| 30 | +also runs on a host, so we say that the `process` entity is related to the |
| 31 | +`host` entity. |
| 32 | + |
| 33 | +> Note: Entity relationship modelling will be refined in future specification |
| 34 | +> work. |
| 35 | +
|
| 36 | +The data model below defines a logical model for an entity (irrespective of the |
| 37 | +physical format and encoding of how entity data is recorded). |
| 38 | + |
| 39 | +<table> |
| 40 | + <tr> |
| 41 | + <td><strong>Field</strong> |
| 42 | + </td> |
| 43 | + <td><strong>Type</strong> |
| 44 | + </td> |
| 45 | + <td><strong>Description</strong> |
| 46 | + </td> |
| 47 | + </tr> |
| 48 | + <tr> |
| 49 | + <td>Type |
| 50 | + </td> |
| 51 | + <td>string |
| 52 | + </td> |
| 53 | + <td>Defines the type of the entity. MUST not change during the |
| 54 | +lifetime of the entity. For example: "service" or "host". This field is |
| 55 | +required and MUST not be empty for valid entities. |
| 56 | + </td> |
| 57 | + </tr> |
| 58 | + <tr> |
| 59 | + <td>Id |
| 60 | + </td> |
| 61 | + <td>map<string, standard attribute value> |
| 62 | + </td> |
| 63 | + <td>Attributes that identify the entity. |
| 64 | +<p> |
| 65 | +MUST not change during the lifetime of the entity. The Id must contain |
| 66 | +at least one attribute. |
| 67 | +<p> |
| 68 | +Follows OpenTelemetry <a |
| 69 | +href="../../specification/common/README.md#standard-attribute">Standard |
| 70 | +attribute definition</a>. SHOULD follow OpenTelemetry <a |
| 71 | +href="https://github.com/open-telemetry/semantic-conventions">semantic |
| 72 | +conventions</a> for attributes. |
| 73 | + </td> |
| 74 | + </tr> |
| 75 | + <tr> |
| 76 | + <td>Description |
| 77 | + </td> |
| 78 | + <td>map<string, any> |
| 79 | + </td> |
| 80 | + <td>Descriptive (non-identifying) attributes of the entity. |
| 81 | +<p> |
| 82 | +MAY change over the lifetime of the entity. MAY be empty. These |
| 83 | +attributes are not part of entity's identity. |
| 84 | +<p> |
| 85 | +Follows <a |
| 86 | +href="../../specification/logs/data-model.md#type-any">any</a> |
| 87 | +value definition in the OpenTelemetry spec. Arbitrary deep nesting of values |
| 88 | +for arrays and maps is allowed. |
| 89 | +<p> |
| 90 | +SHOULD follow OpenTelemetry <a |
| 91 | +href="https://github.com/open-telemetry/semantic-conventions">semantic |
| 92 | +conventions</a> for attributes. |
| 93 | + </td> |
| 94 | + </tr> |
| 95 | +</table> |
| 96 | + |
| 97 | +## Minimally Sufficient Identity |
| 98 | + |
| 99 | +Commonly, a number of attributes of an entity are readily available for the telemetry |
| 100 | +producer to compose an Id from. Of the available attributes the entity Id should |
| 101 | +include the minimal set of attributes that is sufficient for uniquely identifying |
| 102 | +that entity. For example a Process on a host can be uniquely identified by |
| 103 | +(`process.pid`,`process.start_time`) attributes. Adding for example `process.executable.name` attribute to the Id is unnecessary and violates the |
| 104 | +Minimally Sufficient Identity rule. |
| 105 | + |
| 106 | +## Repeatable Identity |
| 107 | + |
| 108 | +The identifying attributes for entity SHOULD be values that can be repeatably |
| 109 | +obtained by observers of that entity. For example, a `process` entity SHOULD |
| 110 | +have the same identity (and be recognized as the same process), regardless of whether |
| 111 | +the identity was generated from the process itself, e.g. via SDK, or by an |
| 112 | +OpenTelemetry Collector running on the same host, or by some other system |
| 113 | +describing the process. |
| 114 | + |
| 115 | +> Aside: There are many ways to accomplish repeatable identifying attributes |
| 116 | +> across multiple observers. While many successful systems rely on pushing down |
| 117 | +> identity from a central registry or knowledge store, OpenTelemetry must |
| 118 | +> support all possible scenarios. |
| 119 | +
|
| 120 | +## Examples of Entities |
| 121 | + |
| 122 | +_This section is non-normative and is present only for the purposes of |
| 123 | +demonstrating the data model._ |
| 124 | + |
| 125 | +Here are examples of entities, the typical identifying attributes they |
| 126 | +have and some examples of descriptive attributes that may be |
| 127 | +associated with the entity. |
| 128 | + |
| 129 | +_Note: These examples MAY diverge from semantic conventions._ |
| 130 | + |
| 131 | +<table> |
| 132 | + <tr> |
| 133 | + <td><strong>Entity</strong> |
| 134 | + </td> |
| 135 | + <td><strong>Entity Type</strong> |
| 136 | + </td> |
| 137 | + <td><strong>Identifying Attributes</strong> |
| 138 | + </td> |
| 139 | + <td><strong>Descriptive Attributes</strong> |
| 140 | + </td> |
| 141 | + </tr> |
| 142 | + <tr> |
| 143 | + <td>Container |
| 144 | + </td> |
| 145 | + <td><pre>container</pre> |
| 146 | + </td> |
| 147 | + <td>container.id |
| 148 | + </td> |
| 149 | + <td>container.image.id<br/> |
| 150 | + container.image.name<br/> |
| 151 | + container.image.tag.{key}<br/> |
| 152 | + container.label.{key}<br/> |
| 153 | + container.name<br/> |
| 154 | + container.runtime<br/> |
| 155 | + oci.manifest.digest<br/> |
| 156 | + container.command<br/> |
| 157 | + </td> |
| 158 | + </tr> |
| 159 | + <tr> |
| 160 | + <td>Host |
| 161 | + </td> |
| 162 | + <td><pre>host</pre> |
| 163 | + </td> |
| 164 | + <td>host.id |
| 165 | + </td> |
| 166 | + <td>host.arch<br/> |
| 167 | + host.name<br/> |
| 168 | + host.type<br/> |
| 169 | + host.image.id<br/> |
| 170 | + host.image.name<br/> |
| 171 | + host.image.version<br/> |
| 172 | + host.type |
| 173 | + </td> |
| 174 | + </tr> |
| 175 | + <tr> |
| 176 | + <td>Kubernetes Node |
| 177 | + </td> |
| 178 | + <td><pre>k8s.node</pre> |
| 179 | + </td> |
| 180 | + <td>k8s.node.uid |
| 181 | + </td> |
| 182 | + <td>k8s.node.name |
| 183 | + </td> |
| 184 | + </tr> |
| 185 | + <tr> |
| 186 | + <td>Kubernetes Pod |
| 187 | + </td> |
| 188 | + <td><pre>k8s.pod</pre> |
| 189 | + </td> |
| 190 | + <td>k8s.pod.uid |
| 191 | + </td> |
| 192 | + <td>k8s.pod.name<br/> |
| 193 | + k8s.pod.label.{key}<br/> |
| 194 | + k8s.pod.annotation.{key}<br/> |
| 195 | + </td> |
| 196 | + </tr> |
| 197 | + <tr> |
| 198 | + <td>Service Instance |
| 199 | + </td> |
| 200 | + <td><pre>service.instance</pre> |
| 201 | + </td> |
| 202 | + <td>service.instance.id<br/> |
| 203 | + service.name<br/> |
| 204 | + service.namesapce |
| 205 | + </td> |
| 206 | + <td>service.version |
| 207 | + </td> |
| 208 | + </tr> |
| 209 | +</table> |
0 commit comments