Browse Source

tracing: mark failed spans by catching and re-throwing StandardErrors

cn 4 months ago
parent
commit
280bfbeb82
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      lib/dyndnsd/helper.rb

+ 10
- 0
lib/dyndnsd/helper.rb View File

@@ -34,6 +34,16 @@ module Dyndnsd
34 34
       span.set_tag('span.kind', 'server')
35 35
       begin
36 36
         block.call(span)
37
+      rescue StandardError => e
38
+        span.set_tag('error', true)
39
+        span.log_kv(
40
+          event: 'error',
41
+          'error.kind': e.class.to_s,
42
+          'error.object': e,
43
+          message: e.message,
44
+          stack: e.backtrace.join("\n")
45
+        )
46
+        raise
37 47
       ensure
38 48
         scope.close
39 49
       end