Add realtime health stats to vtctld /api/keyspace/ks/tablets API #6569
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.
(A continuation of #6524, abandoned due to
git rebase
issues 🤞)This PR adds realtime health stats to the vtctld
/api/keyspace/<ks>/tablets/<shard>
HTTP API endpoint. This extends the PR @shlomi-noach made in #4232The tablet health metrics are needed for
github.com/github/freno
to understand if avttablet
is ready for probes for replication lag. In today's implementation that looks for any tablet-type ==REPLICA
it is possible for an unhealthyvttablet
(replication isSTOP SLAVE
'd, mysqld crashed, etc) to continue to be probed by Freno because it is unable to detect tablet health from the current API endpointThis PR also adds a
cell
andcells
(CSV list) query parameter for filtering the output by Vitess Cell. Let me know if you'd prefer this to be part of the URL path vs a query param. This is useful when you're only interested in grabbing specific cellsExample
GET
calls:GET /api/keyspace/<ks>/tablets/?cell=cell1
GET /api/keyspace/<ks>/tablets/?cells=cell1,cell2
GET /api/keyspace/<ks>/tablets/<shard>?cell=cell1
GET /api/keyspace/<ks>/tablets/<shard>?cells=cell1,cell2
Lastly, this PR adds unit tests for
GET /api/keyspace/<ks>/tablets/
I've made this a work in progress PR for @sougou / @shlomi-noach / @deepthi to review. After we agree on the approach I can complete the unit testing, add suggestions, etccc @sougou / @shlomi-noach / @deepthi / @tomkrouper / @drogart