Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Ruby

Seamless Rails Exception Reporting ด้วย AppSignal 3.4.1

หากคุณอยาก insights เข้า exceptions ของแอปพลิเคชัน แตไม่มีเวลา invest ในการเพิ่ม verbose logic ไปโค้ด เรามีข่าว exceptional: AppSignal for Ruby gem 3.4.1 ตอนนี้รองรับ Rails error reporter!

ด้วยการเปลี่ยนแปลงนี้ คุณสามารถ simplify AppSignal integration, streamline โค้ด และเริ่ม report errors on the fly โดยไม่ต้อง raise error page และ interrupt user's flow

ในบล็อกโพสต์นี้ เราจะแสดงว่าคุณสามารถเริ่ม report errors ไป AppSignal ด้วย Rails Error Reporter อย่างไร

Bye, Bye Begin Blocks

Rails Error Reporter กำจัดความต้องการ verbose begin blocks ในโค้ดของคุณ และให้ explicit และ standardized way มากขึ้นในการ report exceptions ของแอปพลิเคชัน

ก่อนหน้านี้ เมื่อคุณอยาก report exception ไป AppSignal โดยไม่ raise error ( cònรู้จักว่า swallowing an error) คุณจะใช้ begin block:


ด้วย Rails Error Reporter เราสามารถ simplify นี้ลงเหลือแค่สามบรรทัด และ AppSignal จะ automatically detect action และ namespace จาก parent web request หรือ background job:


Errors ที่ raised โดยใช้ handle method ของ Rails Error Reporter จะถูก reported ไป AppSignal เป็น separate samples ทำให้ multiple errors สามารถ reported ภายใน same request หรือ job หากคุณใช้ record method error จะไม่ swallowed และจะถูก re-raised แทน ใน instances เหล่านี้ Rails middleware ของเราจะ report error

Contextual Error Reporting (การรายงานข้อผิดพลาดเชิงบริบท)

หากคุณอยากใช้ custom namespace หรือ action name สำหรับ request หรือ job's transaction คุณสามารถใช้ set_namespace และ set_action helper methods ของเรา:


ทางเลือก ถ้าคุณอยากใช้ custom namespace และ action name เฉพาะเมื่อ report specific error คุณสามารถเพิ่มพวกมันไปที่ Rails Error Reporters context:


คุณยังสามารถ supply custom tags ไป error's context ซึ่งคุณจะสามารถใช้ filter through incidents ของแอปพลิเคชัน:


Seamless Rails Exception Reporting ด้วย AppSignal 3.4.1

Exceptional Monitoring สำหรับ Exceptional Applications

คุณสามารถอ่านเพิ่มเติมเกี่ยวกับ AppSignal's error reporting ใน Rails documentation ของเรา และหากคุณประสบปัญหาเมื่อใช้ Rails Error Reporter ติดต่อ exceptional support team ของเรา

AppSignal's Error Reporting เพียงหนึ่งใน many developer-driven features ที่ช่วยให้คุณได้ประโยชน์สูงสุดจาก monitoring แอปพลิเคชัน Developers ยัง enjoy ใช้ monitoring ของเราเพราะเรามี:

  • อินเทอร์เฟซที่เข้าใจง่ายและนำทางสะดวก
  • ราคาที่เรียบง่ายและคาดการณ์ได้
  • Developer-to-developer support

อย่าลืม หากคุณใหม่กับ AppSignal เราจะ welcome คุณ onboard พร้อม exceptionally delicious shipment ของ stroopwafels 🍪 😋

Seamless Rails Exception Reporting ด้วย AppSignal 3.4.1

Connor James

Developer Marketing Manager ที่ AppSignal ผู้ติดพอดแคสต์ รัก cannoli จนคิดจะเปลี่ยนชื่อเป็น Connoli เขาคิดว่ามีตัว 'u' ในคำว่า color คุณอาจพบเขาบนไมค์ บนเวที หรือนอนบนโซฟาเมื่อเขาออฟดิวตี้

บทความทั้งหมดโดย Connor James

Seamless Rails Exception Reporting ด้วย AppSignal 3.4.1

Tom de Bruijn