Custom Segments

Monitor code blocks in your application
Once you have registered the middleware it decorates the request with the current inspector class instance.
The new inspector property allows you to use the service inside your application to report custom segments and errors.

Add custom segments

For a better understanding of what segments are you can take a look at the add segment section of the python module.
Thanks to Inspector you can put everything you want in the transactions timeline getting a real-time feedback about the execution of a code block inside your application.
Some ideas on how to use custom segments:
  • Http call to external services (webhooks, integrations, etc.);
  • Functions that deal with files (pdf, excel, images);
  • Data manipulation processes (import/export, data aggregation, etc).
Inside the application you can retrieve the inspector instance from the request object to add your custom segment:
request.inspector.start_segment('name', 'label')
// Your code block here
The new segment in the timeline