Commit 24c3c1b
authored
[kafka_consumer] Purge stale broker_timestamps when offsets go backwards (DataDog#23409)
* kafka_consumer: purge stale broker_timestamps when offsets go backwards
When a topic's highwater offset decreases (retention wipe, topic
recreation, or offset reset), the cached (offset, timestamp) pairs with
offsets above the new highwater no longer correspond to real messages.
_get_interpolated_timestamp then extrapolates between those stale pairs
and fresh ones, pinning estimated_consumer_lag to a wall-clock value
equal to how long ago the reset happened (e.g. a steady ~18h lag
reading while kafka.consumer_lag shows only ~170 offsets).
Fix _add_broker_timestamps to:
- drop cached entries with offsets above the new highwater
- evict by oldest timestamp rather than smallest offset, so fresh
post-reset entries are kept over poisonous stale ones.
* Add changelog fragment1 parent c97f135 commit 24c3c1b
3 files changed
Lines changed: 43 additions & 2 deletions
File tree
- kafka_consumer
- changelog.d
- datadog_checks/kafka_consumer
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
262 | 269 | | |
263 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
264 | 273 | | |
265 | | - | |
| 274 | + | |
266 | 275 | | |
267 | 276 | | |
268 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
515 | 546 | | |
516 | 547 | | |
517 | 548 | | |
| |||
0 commit comments