Add VStreamerCount stat to vttablet#11978
Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
If a new flag is being introduced:
If a workflow is added or modified:
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
a6c3dc8 to
ab21e4f
Compare
094cfd9 to
9e3997b
Compare
|
Just a note that we'll need to document this new metric here on the vreplication metrics page: vitessio/website#1267 @timvaillancourt we should try and have you push directly to that PR. I can help get you setup with any access you need and walk you through it as needed. |
mattlord
left a comment
There was a problem hiding this comment.
Thank you! I also noticed this missing metric info today: https://vitess.slack.com/archives/C0PQY0PTK/p1671132033807179?thread_ts=1670952842.374699&cid=C0PQY0PTK
I had to look at the tablets' /debug/status endpoints to see where the vstreamer was running.
I would note that this is not only about vtgate<->vttablet vstreams but also vttablet<->vttablet vstreams such as are used for VReplication workflows after the copy phase. Just something to keep in mind as we think about this.
VStreamersActive stat to vttabletVStreamerCount stat to vttablet
|
@mattlord thanks for the review! One question re: the mutex added and website PR on the way tomorrow 👍 |
|
Hrm, re-requesting review from Matt dropped the other reviewers. My apologies 🤷 |
@mattlord thanks! Website PR created here: vitessio/website#1291 |
There was a problem hiding this comment.
Can we instead use a stats.Gauge as a new field vstreamerCount in vstreamer.Engine? Then in vse.Stream(): vse.vstreamerCount.Add(1) while creating a stream and vse.vstreamerCount.Add(-1). stats.Gauge is an atomicInt64. We then avoid the mutex requirement.
There was a problem hiding this comment.
@rohit-nayak-ps good idea, I'll make that change 👍
There was a problem hiding this comment.
@rohit-nayak-ps / @mattlord changes made in 5d889e0 and 2af4045
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
2af4045 to
eb4e4ae
Compare
rohit-nayak-ps
left a comment
There was a problem hiding this comment.
lgtm
Thanks! this is a useful new metric.
* Add `VStreamersActive` stat to `vttablet` Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Improve desc Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Add PR suggestions Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Move to *stats.Gauge Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Single defer Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
* Add `VStreamersActive` stat to `vttablet` Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Improve desc Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Add PR suggestions Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Move to *stats.Gauge Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Single defer Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
* Add `VStreamersActive` stat to `vttablet` Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Improve desc Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Add PR suggestions Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Move to *stats.Gauge Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Single defer Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
* Add `VStreamersActive` stat to `vttablet` Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Improve desc Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Add PR suggestions Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Move to *stats.Gauge Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Single defer Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
* Add `VStreamerCount` stat to `vttablet` (vitessio#11978) * Add `VStreamersActive` stat to `vttablet` Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Improve desc Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Add PR suggestions Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Move to *stats.Gauge Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Single defer Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Add `Uptime` metric (vitessio#12712) * Add `Uptime` metric to `vtgate`+`vttablet` Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * move to go/vt/servenv/status.go Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Use nanoseconds for uptime Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Move Uptime metrics to servenv.go, remove dupe start time.Time Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Use serverStart time.Time Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> --------- Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Implement the RowsColumnTypeScanType interface in the go sql driver for Vitess in order to get the column types (vitessio#12007) Signed-off-by: Johan Oskarsson <joskarsson@slack-corp.com> Signed-off-by: Johan Oskarsson <joskarsson@slack-corp.com> Co-authored-by: Johan Oskarsson <joskarsson@slack-corp.com> * Add vstream metrics to vtgate (vitessio#13098) * Add vstream metrics to vtgate Signed-off-by: twthorn <thomaswilliamthornton@gmail.com> * Update unit test name and use cell variable Signed-off-by: twthorn <thomaswilliamthornton@gmail.com> * Reset metrics for TestVStreamsCreatedAndLagMetrics, fix data race issue Signed-off-by: twthorn <thomaswilliamthornton@gmail.com> --------- Signed-off-by: twthorn <thomaswilliamthornton@gmail.com> * add lock to flaky TestValidateVersionShard test Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * typo Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> --------- Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> Signed-off-by: Johan Oskarsson <joskarsson@slack-corp.com> Signed-off-by: twthorn <thomaswilliamthornton@gmail.com> Co-authored-by: Johan Oskarsson <johan@oskarsson.nu> Co-authored-by: Johan Oskarsson <joskarsson@slack-corp.com> Co-authored-by: Thomas Thornton <thomaswilliamthornton@gmail.com>

Description
This PR adds the
VStreamersActiveVStreamerCountstats metric tovttabletto make the # of active streams more observable. There may be a way to infer this using rates from a combination ofVStreamersCreatedand other metrics but I was unable to do so myself (in Prometheus/Grafana) after many attempts so this feels like a rough edgeThe length of the VStream engine
streamersmap is used as the number of active streams. This is done without a lock but I'm happy to add oneRelated Issue(s)
Checklist