Commit adf85eb
committed
ref(kafka): [Queue Instrumentation 20] Log Kafka instrumentation failures
Previously `SentryKafkaProducerInterceptor.onSend(...)` and
`SentryKafkaConsumerTracing` silently swallowed any `Throwable` thrown
while instrumenting a Kafka record. That protects customer Kafka I/O
from breakage, but makes instrumentation bugs invisible.
Log each caught `Throwable` to the SDK logger at `SentryLevel.ERROR`
(matching the existing pattern in `RequestPayloadExtractor`) before
continuing the fail-open path:
- `SentryKafkaProducerInterceptor`: producer span creation / header injection
- `SentryKafkaConsumerTracing`: scope fork + `makeCurrent`, transaction
start, transaction finish
No behavior change for customer callbacks or Kafka send/receive: the
catches still swallow the throwable, they now just surface it via the
SDK's own logger.
`SentryKafkaRecordInterceptor` (Spring) was reviewed and intentionally
left as-is — it does not wrap its instrumentation in `catch (Throwable)`
blocks, so there is nothing silent to log. The `NumberFormatException`
branches on malformed `sentry-task-enqueued-time` headers are expected
input, not instrumentation faults, and remain silent.1 parent 118d244 commit adf85eb
2 files changed
Lines changed: 22 additions & 5 deletions
File tree
- sentry-kafka/src/main/java/io/sentry/kafka
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
87 | 92 | | |
88 | 93 | | |
89 | 94 | | |
| |||
175 | 180 | | |
176 | 181 | | |
177 | 182 | | |
178 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
179 | 188 | | |
180 | 189 | | |
181 | 190 | | |
| |||
194 | 203 | | |
195 | 204 | | |
196 | 205 | | |
197 | | - | |
| 206 | + | |
198 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
199 | 212 | | |
200 | 213 | | |
201 | 214 | | |
| |||
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
75 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
| |||
0 commit comments