Skip to content

Commit b948c7f

Browse files
authored
Merge pull request #9 from place-labs/fix/remove-response-assumption
Remove assumption that yielded exec returns `HTTP::Client::Response`
2 parents f091422 + 5014580 commit b948c7f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/opentelemetry/instrumentation/crystal/http_client.cr

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,14 @@ unless_enabled?("OTEL_CRYSTAL_DISABLE_INSTRUMENTATION_HTTP_CLIENT") do
117117

118118
response = yield request
119119

120-
span["http.status_code"] = response.status_code
121-
if response.success?
122-
# span.status.ok!
123-
else
124-
span.status.error!
125-
span["http.status_message"] = response.status_message.to_s
120+
if response.is_a?(HTTP::Client::Response)
121+
span["http.status_code"] = response.status_code
122+
if response.success?
123+
# span.status.ok!
124+
else
125+
span.status.error!
126+
span["http.status_message"] = response.status_message.to_s
127+
end
126128
end
127129

128130
response

0 commit comments

Comments
 (0)