Replacing culprits with transaction names

Today we merged a fairly hefty change into the Python SDK. This change replaces the legacy “culprit” concept with a transaction-based contextual name.

For example, in Django, if you’re processing a web request when an error is hit, the transaction name becomes a normalized version of the route pattern. In Celery, this becomes the registered name for the given task. In Flask, similar to Django, its the pattern expression:

This isn’t in a released version of any SDK yet, and is only implemented in Python, but if you’re eager to give it a whirl we’d love to hear your freedback.

1 Like

This is awesome. Do we have the ability to set the culprit name?

I have a scenario, where there is a generic dispatch task and everything seems to have the same culprit in my celery app.

@jtillman you do (especially where transactions are implemented)

For example, in Python:

txid = raven_client.transactions.push('my transaction name')
do_something()
raven_client.transactions.pop(txid)

In other SDKs where this doesnt exist yet, you can simply bind ‘culprit’ in the data packet. For example, in JavaScript:

dataCallback: (data) => {
    data.culprit = getCurrentTransactionName();
    return data;
}
1 Like

Thanks @zeeg ! This works nicely for us.

For those trying this out, note that its transaction (without the ‘s’):
raven_client.transaction.push('my transaction name')

The Ruby client will support this in it’s next release (2.7.0): https://github.com/getsentry/raven-ruby/pull/743