Skip to content

Commit b277682

Browse files
authored
Fixing resource auto-inference algorithm (#465)
1 parent b97abba commit b277682

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

specs/agents/tracing-spans-destination.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,25 @@ exit = exit || context.destination || context.db || context.message || context.h
100100

101101
If no value is set to the `context.destination.service.resource` field, the logic for automatically inferring
102102
it MUST be the following:
103+
103104
```groovy
104-
if (context.db?.instance) "${subtype ?: type}/${context.db?.instance}"
105-
else if (context.message?.queue?.name) "${subtype ?: type}/${context.message.queue.name}"
106-
else if (context.http?.url) "${context.http.url.host}:${context.http.url.port}"
107-
else subtype ?: type
105+
if (context.db)
106+
if (context.db.instance)
107+
"${subtype ?: type}/${context.db.instance}"
108+
else
109+
subtype ?: type
110+
else if (context.message)
111+
if (context.message.queue?.name)
112+
"${subtype ?: type}/${context.message.queue.name}"
113+
else
114+
subtype ?: type
115+
else if (context.http?.url)
116+
if (context.http.url.port > 0)
117+
"${context.http.url.host}:${context.http.url.port}"
118+
else if (context.http.url.host)
119+
context.http.url.host
120+
else
121+
subtype ?: type
108122
```
109123

110124
If an agent API was used to set the `context.destination.service.resource` to `null` or an empty string, agents MUST

0 commit comments

Comments
 (0)