Skip to content

Commit 89de3d1

Browse files
committed
PR feedback
1 parent 3a59cea commit 89de3d1

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

specification/entities/sdk-environment-variables.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,32 @@ OTEL_ENTITIES="service{service.name=my%2Capp,service.instance.id=inst-1}[config=
138138
The SDK SHOULD be resilient to malformed input and follow these error handling rules:
139139

140140
1. **Invalid syntax**: If the environment variable contains invalid syntax, the SDK SHOULD log a warning and ignore the malformed portions while processing valid parts
141+
142+
Example: `OTEL_ENTITIES="service{service.name=app1};invalid{syntax;service{service.name=app2}"` processes the first valid entity and skips the malformed part
143+
141144
2. **Missing required fields**: If an entity is missing required fields (type or identifying attributes), the SDK SHOULD log a warning and skip that entity
142-
3. **Empty entities list**: An empty `OTEL_ENTITIES` environment variable is valid and indicates no entities are defined
143-
4. **Empty entity strings**: Empty strings between semicolons (including leading and trailing semicolons) SHOULD be ignored during parsing
144-
5. **Duplicate entities**: If multiple entities of the same type with identical identifying attributes are defined, the SDK SHOULD use the last occurrence and SHOULD log a warning
145-
6. **Invalid characters**: If unencoded reserved characters are found in attribute keys or values, the SDK SHOULD log a warning and attempt to parse the value as-is
146-
7. **Schema URL validation**: If a schema URL is present but invalid, the SDK SHOULD log a warning and ignore the URL while processing the entity
147-
8. **Conflicting identifying attributes**: If two entities of the same type define different values for the same identifying attribute key, the SDK SHOULD treat them as separate entities. If this results in ambiguous entity identification, the SDK SHOULD log a warning and use the last valid definition
148-
9. **Conflicting descriptive attributes**: If two entities define different values for the same descriptive attribute key, the SDK SHOULD use the value from the last entity definition and SHOULD log a warning. The conflicting attributes SHOULD NOT be recorded for entities other than the last one
149-
10. **Conflict with resource attributes**: If an entity attribute conflicts with a resource attribute, the SDK SHOULD log a warning and apply the conflict resolution rules defined below
145+
146+
Example: `OTEL_ENTITIES="service{};host{host.id=123}"` skips the service entity (no identifying attributes) and processes the host entity
147+
148+
3. **Duplicate entities**: If multiple entities of the same type with identical identifying attributes are defined, the SDK SHOULD use the last occurrence and SHOULD log a warning
149+
150+
Example: `OTEL_ENTITIES="service{service.name=app1}[version=1.0];service{service.name=app1}[version=2.0]"` uses `version=2.0`
151+
152+
4. **Schema URL validation**: If a schema URL is present but invalid, the SDK SHOULD log a warning and ignore the URL while processing the entity
153+
154+
Example: `OTEL_ENTITIES="service{service.name=app1}@invalid-url"` processes the entity but ignores the invalid URL
155+
156+
5. **Conflicting identifying attributes**: If two entities of the same type define different values for the same identifying attribute key, the SDK SHOULD treat them as separate entities. If this results in ambiguous entity identification, the SDK SHOULD log a warning and preserve only the last entity
157+
158+
Example: `OTEL_ENTITIES="service{service.name=app1};service{service.name=app2}"` creates only service.name=app2 entity
159+
160+
6. **Conflicting descriptive attributes**: If two entities define different values for the same descriptive attribute key, the SDK SHOULD use the value from the last entity definition and SHOULD log a warning. The conflicting attributes SHOULD NOT be recorded for entities other than the last one
161+
162+
Example: `OTEL_ENTITIES="service{service.name=app1}[version=1.0];service{service.name=app2}[version=2.0]"` results in app1 service without version attribute and app2 service with `version=2.0`
150163

151164
### Environment Variable Conflict Resolution
152165

153-
When multiple environment variables define overlapping configuration, the following precedence order applies (highest to lowest precedence):
166+
When multiple environment variables define overlapping configuration, a warning should be logged and the following precedence order applied (highest to lowest precedence):
154167

155168
1. **Programmatic configuration**: Entities configured via SDK API take highest precedence and override all environment variable configurations
156169
2. **OTEL_ENTITIES**: Entity definitions from this environment variable override resource attributes and other OTEL_* environment variables for the same attribute keys

0 commit comments

Comments
 (0)