diff --git a/lib/sentry/context.ex b/lib/sentry/context.ex index 3cb0c901..39d61c63 100644 --- a/lib/sentry/context.ex +++ b/lib/sentry/context.ex @@ -250,7 +250,10 @@ defmodule Sentry.Context do sentry_metadata = get_sentry_context() - |> Map.update(@breadcrumbs_key, [map], &[map | &1]) + |> Map.update(@breadcrumbs_key, [map], fn breadcrumbs -> + breadcrumbs = [map | breadcrumbs] + Enum.take(breadcrumbs, -1 * Sentry.Config.max_breadcrumbs()) + end) :logger.update_process_metadata(%{sentry: sentry_metadata}) end