dekaf: Track and report additional metrics, and improve connection stability/freshness #1655
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I observed some concerning behavior when switching
dekaf.estuary.dev
to advertisedekaf.estuary-data.com
, namely all API requests to the upstream MSK broker were returning with error codes. A restart of Dekaf "fixed" the problem, and I ended up realizing that those connections were probably sitting open and idle for days.The theory is that even though we set TCP keepalive, the connections had gotten into a bad state. So I introduced a couple different mitigations:
New metrics:
pool_size
(by broker): The number of connections open to this brokerpool_available
(by broker): The number of open, free connections available for usepool_waiting
(by broker): The number of requests blocked waiting for a connection to become availablepool_connection_avg_age
(by broker): the average age of a pool connection to this brokerpool_connection_avg_idle
(by broker): the average time a connection to this broker has been idleapi_call_time
(by api method): A histogram of the time it takes to serve a kafka protocol requestThis change is