Skip to content

Commit c1c5e97

Browse files
Add integration_meta key to Sentry.Event (#771)
Co-authored-by: Andrea Leopardi <[email protected]>
1 parent 9ec8e89 commit c1c5e97

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

lib/sentry/event.ex

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ defmodule Sentry.Event do
5959
modules: %{optional(String.t()) => String.t()},
6060
extra: map(),
6161
fingerprint: [String.t()],
62+
integration_meta: map(),
6263

6364
# Interfaces.
6465
breadcrumbs: [Interfaces.Breadcrumb.t()],
@@ -117,6 +118,7 @@ defmodule Sentry.Event do
117118
transaction: nil,
118119
threads: nil,
119120
user: %{},
121+
integration_meta: %{},
120122

121123
# "Culprit" is not documented anymore and we should move to transactions at some point.
122124
# https://forum.sentry.io/t/culprit-deprecated-in-favor-of-what/4871/9
@@ -255,6 +257,11 @@ defmodule Sentry.Event do
255257
`Sentry.capture_message/2`. *Available since v10.1.0*.
256258
"""
257259
],
260+
integration_meta: [
261+
type: :map,
262+
default: %{},
263+
doc: false
264+
],
258265

259266
## Internal options
260267
handled: [
@@ -360,7 +367,8 @@ defmodule Sentry.Event do
360367
source: source,
361368
tags: tags,
362369
timestamp: timestamp,
363-
user: user
370+
user: user,
371+
integration_meta: Keyword.fetch!(opts, :integration_meta)
364372
}
365373

366374
# If we have a message *and* a stacktrace, but no exception, we need to store the stacktrace

lib/sentry/integrations/oban/error_reporter.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ defmodule Sentry.Integrations.Oban.ErrorReporter do
4141
inspect(job.worker),
4242
Exception.message(exception)
4343
],
44-
extra: Map.take(job, [:args, :attempt, :id, :max_attempts, :meta, :queue, :tags, :worker])
44+
extra:
45+
Map.take(job, [:args, :attempt, :id, :max_attempts, :meta, :queue, :tags, :worker]),
46+
integration_meta: %{oban: %{job_meta: job}}
4547
)
4648

4749
:ok

test/sentry/integrations/oban/error_reporter_test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ defmodule Sentry.Integrations.Oban.ErrorReporterTest do
4848
assert event.tags.oban_queue == "default"
4949
assert event.tags.oban_state == "available"
5050
assert event.tags.oban_worker == "Sentry.Integrations.Oban.ErrorReporterTest.MyWorker"
51+
assert %{job_meta: %Oban.Job{}} = event.integration_meta.oban
5152
end
5253
end
5354
end

0 commit comments

Comments
 (0)