Adding tags in before_send hook (Python)

We use the before_send hook for injecting application specific information into the “extra” dict of the event. Is there a way to inject Sentry tags in order to display them directly and in order to filter by tags?

Hi, you can set the tags like this:

def before_send(event, hint):
    event.setdefault("tags", {})["foo"] = "bar"
    return event

If you unconditionally want to add the same tag value, you can also use configure_scope() at import time on the module level though! See here: https://docs.sentry.io/enriching-error-data/context/?platform=python#tagging-events