Skip to content

Python: Trace GC collection pauses in Performance #2241

@craigds

Description

@craigds

Problem Statement

We are finding the occasional transaction in Performance (usually when looking at 'Outlier transactionss (p100)') that pauses for multiple seconds (sometimes >10s) in 'Missing instrumentation', or (more often) in a db query that (we're pretty sure) couldn't possibly be actually taking that long.

This is in a threaded web server, so all sorts of things could be going on:

  • thread is not being scheduled due to file I/O or busy CPUs
  • the GIL is locked
  • Python's garbage collector is running and has paused the interpreter

It would be nice if Sentry could display some of these events in the Performance traces, especially the GC one.

Solution Brainstorm

The GC has some callback hooks that the sentry integration could use to track when GC is occurring: https://docs.python.org/3/library/gc.html#gc.callbacks

Could this be added to the sentry client library and reported as a span in the Performance pages?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions