File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -166,11 +166,24 @@ where
166
166
let op = span. name ( ) ;
167
167
let description = description. as_deref ( ) . unwrap_or ( "" ) ;
168
168
169
+ // Spans don't always have a description, this ensures our data is not empty,
170
+ // therefore the Sentry UI will be a lot more valuable for navigating spans.
171
+ let transaction_name = if description. is_empty ( ) {
172
+ let target = span. metadata ( ) . target ( ) ;
173
+ if target. is_empty ( ) {
174
+ op. to_string ( )
175
+ } else {
176
+ format ! ( "{}::{}" , target, op)
177
+ }
178
+ } else {
179
+ description. to_string ( )
180
+ } ;
181
+
169
182
let parent_sentry_span = sentry_core:: configure_scope ( |s| s. get_span ( ) ) ;
170
183
let sentry_span: sentry_core:: TransactionOrSpan = match & parent_sentry_span {
171
- Some ( parent) => parent. start_child ( op, description ) . into ( ) ,
184
+ Some ( parent) => parent. start_child ( op, & transaction_name ) . into ( ) ,
172
185
None => {
173
- let ctx = sentry_core:: TransactionContext :: new ( description , op) ;
186
+ let ctx = sentry_core:: TransactionContext :: new ( & transaction_name , op) ;
174
187
sentry_core:: start_transaction ( ctx) . into ( )
175
188
}
176
189
} ;
You can’t perform that action at this time.
0 commit comments