-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 vttablet
VStreamerCount
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 🤷 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! ❤️
@mattlord thanks! Website PR created here: vitessio/website#1291 |
@@ -138,6 +138,7 @@ func NewEngine(env tabletenv.Env, ts srvtopo.Server, se *schema.Engine, lagThrot | |||
errorCounts: env.Exporter().NewCountersWithSingleLabel("VStreamerErrors", "Tracks errors in vstreamer", "type", "Catchup", "Copy", "Send", "TablePlan"), | |||
vstreamerFlushedBinlogs: env.Exporter().NewCounter("VStreamerFlushedBinlogs", "Number of times we've successfully executed a FLUSH BINARY LOGS statement when starting a vstream"), | |||
} | |||
env.Exporter().NewGaugeFunc("VStreamerCount", "Current number of vstreamers", vse.getVStreamerCount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rohit-nayak-ps good idea, I'll make that change 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rohit-nayak-ps / @mattlord changes made in 5d889e0 and 2af4045
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
Signed-off-by: Tim Vaillancourt <[email protected]>
2af4045
to
eb4e4ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (again)! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thanks! this is a useful new metric.
* Add `VStreamersActive` stat to `vttablet` Signed-off-by: Tim Vaillancourt <[email protected]> * Improve desc Signed-off-by: Tim Vaillancourt <[email protected]> * Add PR suggestions Signed-off-by: Tim Vaillancourt <[email protected]> * Move to *stats.Gauge Signed-off-by: Tim Vaillancourt <[email protected]> * Single defer Signed-off-by: Tim Vaillancourt <[email protected]> Signed-off-by: Tim Vaillancourt <[email protected]>
* Add `VStreamersActive` stat to `vttablet` Signed-off-by: Tim Vaillancourt <[email protected]> * Improve desc Signed-off-by: Tim Vaillancourt <[email protected]> * Add PR suggestions Signed-off-by: Tim Vaillancourt <[email protected]> * Move to *stats.Gauge Signed-off-by: Tim Vaillancourt <[email protected]> * Single defer Signed-off-by: Tim Vaillancourt <[email protected]> Signed-off-by: Tim Vaillancourt <[email protected]>
* Add `VStreamersActive` stat to `vttablet` Signed-off-by: Tim Vaillancourt <[email protected]> * Improve desc Signed-off-by: Tim Vaillancourt <[email protected]> * Add PR suggestions Signed-off-by: Tim Vaillancourt <[email protected]> * Move to *stats.Gauge Signed-off-by: Tim Vaillancourt <[email protected]> * Single defer Signed-off-by: Tim Vaillancourt <[email protected]> Signed-off-by: Tim Vaillancourt <[email protected]>
* Add `VStreamersActive` stat to `vttablet` Signed-off-by: Tim Vaillancourt <[email protected]> * Improve desc Signed-off-by: Tim Vaillancourt <[email protected]> * Add PR suggestions Signed-off-by: Tim Vaillancourt <[email protected]> * Move to *stats.Gauge Signed-off-by: Tim Vaillancourt <[email protected]> * Single defer Signed-off-by: Tim Vaillancourt <[email protected]> Signed-off-by: Tim Vaillancourt <[email protected]>
* Add `VStreamerCount` stat to `vttablet` (vitessio#11978) * Add `VStreamersActive` stat to `vttablet` Signed-off-by: Tim Vaillancourt <[email protected]> * Improve desc Signed-off-by: Tim Vaillancourt <[email protected]> * Add PR suggestions Signed-off-by: Tim Vaillancourt <[email protected]> * Move to *stats.Gauge Signed-off-by: Tim Vaillancourt <[email protected]> * Single defer Signed-off-by: Tim Vaillancourt <[email protected]> Signed-off-by: Tim Vaillancourt <[email protected]> * Add `Uptime` metric (vitessio#12712) * Add `Uptime` metric to `vtgate`+`vttablet` Signed-off-by: Tim Vaillancourt <[email protected]> * move to go/vt/servenv/status.go Signed-off-by: Tim Vaillancourt <[email protected]> * Use nanoseconds for uptime Signed-off-by: Tim Vaillancourt <[email protected]> * Move Uptime metrics to servenv.go, remove dupe start time.Time Signed-off-by: Tim Vaillancourt <[email protected]> * Use serverStart time.Time Signed-off-by: Tim Vaillancourt <[email protected]> --------- Signed-off-by: Tim Vaillancourt <[email protected]> * 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 <[email protected]> Signed-off-by: Johan Oskarsson <[email protected]> Co-authored-by: Johan Oskarsson <[email protected]> * Add vstream metrics to vtgate (vitessio#13098) * Add vstream metrics to vtgate Signed-off-by: twthorn <[email protected]> * Update unit test name and use cell variable Signed-off-by: twthorn <[email protected]> * Reset metrics for TestVStreamsCreatedAndLagMetrics, fix data race issue Signed-off-by: twthorn <[email protected]> --------- Signed-off-by: twthorn <[email protected]> * add lock to flaky TestValidateVersionShard test Signed-off-by: Tim Vaillancourt <[email protected]> * typo Signed-off-by: Tim Vaillancourt <[email protected]> --------- Signed-off-by: Tim Vaillancourt <[email protected]> Signed-off-by: Johan Oskarsson <[email protected]> Signed-off-by: twthorn <[email protected]> Co-authored-by: Johan Oskarsson <[email protected]> Co-authored-by: Johan Oskarsson <[email protected]> Co-authored-by: Thomas Thornton <[email protected]>
Description
This PR adds the
VStreamersActive
VStreamerCount
stats metric tovttablet
to make the # of active streams more observable. There may be a way to infer this using rates from a combination ofVStreamersCreated
and 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
streamers
map is used as the number of active streams. This is done without a lock but I'm happy to add oneRelated Issue(s)
Checklist