@@ -56,6 +56,9 @@ object. A factory method is recommended to enable support for cached objects.
56
56
Required parameters:
57
57
58
58
- [ ` Attributes ` ] ( ../common/common.md#attributes )
59
+ - [ since 1.4.0] ` schema_url ` (optional): Specifies the Schema URL that should be
60
+ recorded in the emitted resource. If the ` schema_url ` parameter is unspecified
61
+ then the created resource will have an empty Schema URL.
59
62
60
63
### Merge
61
64
@@ -70,6 +73,17 @@ The resulting resource MUST have all attributes that are on any of the two input
70
73
If a key exists on both the old and updating resource, the value of the updating
71
74
resource MUST be picked (even if the updated value is empty).
72
75
76
+ The resulting resource will have the Schema URL calculated as follows:
77
+
78
+ - If the old resource's Schema URL is empty then the resulting resource's Schema
79
+ URL will be set to the Schema URL of the updating resource,
80
+ - Else if the updating resource's Schema URL is empty then the resulting
81
+ resource's Schema URL will be set to the Schema URL of the old resource,
82
+ - Else if the Schema URLs of the old and updating resources are the same then
83
+ that will be the Schema URL of the resulting resource,
84
+ - Else this is a merging error (this is the case when the Schema URL of the old
85
+ and updating resources are not empty and are different).
86
+
73
87
Required parameters:
74
88
75
89
- the old resource
@@ -102,6 +116,16 @@ failure to detect any resource information MUST NOT be considered an error,
102
116
whereas an error that occurs during an attempt to detect resource information
103
117
SHOULD be considered an error.
104
118
119
+ Resource detectors that populate resource attributes according to OpenTelemetry
120
+ semantic conventions MUST ensure that the resource has a Schema URL set to a
121
+ value that matches the semantic conventions. Empty Schema URL SHOULD be used if
122
+ the detector does not populate the resource with any known attributes that have
123
+ a semantic convention or if the detector does not know what attributes it will
124
+ populate (e.g. the detector that reads the attributes from environment values
125
+ will not know what Schema URL to use). If multiple detectors are combined and
126
+ the detectors use different non-empty Schema URL it MUST be an error since it is
127
+ impossible to merge such resources.
128
+
105
129
### Specifying resource information via an environment variable
106
130
107
131
The SDK MUST extract information from the ` OTEL_RESOURCE_ATTRIBUTES ` environment
0 commit comments