@@ -90,21 +90,30 @@ defmodule Sentry.OpenTelemetry.SpanProcessor do
9090
9191 defp build_otel_context ( span_record ) , do: span_record . attributes
9292
93- defp get_op_description ( % { attributes: % { unquote ( to_string ( HTTPAttributes . http_request_method ( ) ) ) => http_request_method } } = span_record ) do
93+ defp get_op_description (
94+ % {
95+ attributes: % {
96+ unquote ( to_string ( HTTPAttributes . http_request_method ( ) ) ) => http_request_method
97+ }
98+ } = span_record
99+ ) do
94100 op = "http.#{ span_record . kind } "
95101 client_address = Map . get ( span_record . attributes , to_string ( ClientAttributes . client_address ( ) ) )
96102 url_path = Map . get ( span_record . attributes , to_string ( URLAttributes . url_path ( ) ) )
97103
98104 description =
99105 to_string ( http_request_method ) <>
100- ( client_address && " from #{ client_address } " || "" ) <>
101- ( url_path && " #{ url_path } " || "" )
106+ ( ( client_address && " from #{ client_address } " ) || "" ) <>
107+ ( ( url_path && " #{ url_path } " ) || "" )
102108
103109 { op , description }
104110 end
105111
106- defp get_op_description ( % { attributes: % { unquote ( to_string ( DBAttributes . db_system ( ) ) ) => _db_system } } = span_record ) do
107- db_query_text = Map . get ( span_record . attributes , to_string ( DBAttributes . db_statement ( ) ) )
112+ defp get_op_description (
113+ % { attributes: % { unquote ( to_string ( DBAttributes . db_system ( ) ) ) => _db_system } } =
114+ span_record
115+ ) do
116+ db_query_text = Map . get ( span_record . attributes , "db.statement" )
108117
109118 { "db" , db_query_text }
110119 end
@@ -130,7 +139,12 @@ defmodule Sentry.OpenTelemetry.SpanProcessor do
130139 }
131140 end
132141
133- defp span_status ( % { attributes: % { unquote ( to_string ( HTTPAttributes . http_response_status_code ( ) ) ) => http_response_status_code } } ) do
142+ defp span_status ( % {
143+ attributes: % {
144+ unquote ( to_string ( HTTPAttributes . http_response_status_code ( ) ) ) =>
145+ http_response_status_code
146+ }
147+ } ) do
134148 to_status ( http_response_status_code )
135149 end
136150
@@ -142,18 +156,18 @@ defmodule Sentry.OpenTelemetry.SpanProcessor do
142156 defp to_status ( status ) when status in 200 .. 299 , do: "ok"
143157
144158 for { status , string } <- % {
145- 400 => "invalid_argument" ,
146- 401 => "unauthenticated" ,
147- 403 => "permission_denied" ,
148- 404 => "not_found" ,
149- 409 => "already_exists" ,
150- 429 => "resource_exhausted" ,
151- 499 => "cancelled" ,
152- 500 => "internal_error" ,
153- 501 => "unimplemented" ,
154- 503 => "unavailable" ,
155- 504 => "deadline_exceeded"
156- } do
159+ 400 => "invalid_argument" ,
160+ 401 => "unauthenticated" ,
161+ 403 => "permission_denied" ,
162+ 404 => "not_found" ,
163+ 409 => "already_exists" ,
164+ 429 => "resource_exhausted" ,
165+ 499 => "cancelled" ,
166+ 500 => "internal_error" ,
167+ 501 => "unimplemented" ,
168+ 503 => "unavailable" ,
169+ 504 => "deadline_exceeded"
170+ } do
157171 defp to_status ( unquote ( status ) ) , do: unquote ( string )
158172 end
159173
0 commit comments