I have an Azure Function in Python. There’s no Sentry integration for this framework so I’m just use sentry_sdk and it’s working great.
The problem is that I get breadcrumbs from past executions of the function in each event. I see the JSON has 100 items in the breadcrumbs array so I’m guessing it’s limiting all of them.
My guess’s, because of the way Azure Functions are executed, that sentry_sdk thinks that all the executions belongs to the same “session”. I tried creating a new logger on every execution of my function but it didn’t work.
def main(msg: func.QueueMessage) -> None:
logger = logging.getLogger(__name__)
sentry_sdk.init()
with sentry_sdk.configure_scope() as scope:
scope.set_tag("queue_message_id", msg.id)
logger.info("This is being captured properly on each error, but it's also including previous runs logs")
How can I force a reset on this when doing sentry_sdk.init() or maybe clearing the breadcrumbs stored so far?