Skip to content

Add Uptime metric#12712

Merged
mattlord merged 5 commits intovitessio:mainfrom
timvaillancourt:vttablet-uptime-stat
Apr 6, 2023
Merged

Add Uptime metric#12712
mattlord merged 5 commits intovitessio:mainfrom
timvaillancourt:vttablet-uptime-stat

Conversation

@timvaillancourt
Copy link
Copy Markdown
Contributor

@timvaillancourt timvaillancourt commented Mar 23, 2023

Description

This PR adds an Uptime metric to go/vt/servenv for measuring how long a daemon has been running

Related Issue(s)

Resolves: #12711

Checklist

  • "Backport to:" labels have been added if this change should be back-ported
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on the CI
  • Documentation was added or is not required

Deployment Notes

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
@timvaillancourt timvaillancourt requested review from ajm188 and removed request for deepthi March 23, 2023 18:06
@timvaillancourt
Copy link
Copy Markdown
Contributor Author

timvaillancourt requested review from ajm188 and removed request for deepthi now

Strange that pressing re-request review on @ajm188 removed @-deepthi as a reviewer, that was not my intention! Is that an opt-in feature? It only seems to happen to me on this repo 🤔

@mattlord mattlord added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Observability Pull requests that touch tracing/metrics/monitoring labels Mar 29, 2023
@mattlord mattlord self-requested a review March 29, 2023 20:52
Copy link
Copy Markdown
Member

@mattlord mattlord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor suggestion. Can you also please share a snippet demonstrating how you've tested this locally in the PR description? This will also serve to confirm that it's currently behaving as you expected/desired. For example:

$ curl -s localhost:1510{0,1,2}/metrics | grep -i uptime; echo "----"; curl -s localhost:1510{0,1,2}/debug/vars | grep -i uptime
# HELP vttablet_uptime Uptime in nanoseconds
# TYPE vttablet_uptime gauge
vttablet_uptime 1.17586954958e+11
# HELP vttablet_uptime Uptime in nanoseconds
# TYPE vttablet_uptime gauge
vttablet_uptime 1.14948495917e+11
# HELP vttablet_uptime Uptime in nanoseconds
# TYPE vttablet_uptime gauge
vttablet_uptime 1.12434306125e+11
----
"Uptime": 117603836542,
"Uptime": 114965008333,
"Uptime": 112449585834,

Thanks for yet another contribution @timvaillancourt ! ❤️

Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
@timvaillancourt
Copy link
Copy Markdown
Contributor Author

@ajm188 / @mattlord: PR updated based on suggestions 👍

Here is what the current metric looks like:

$ curl -s localhost:15000/metrics | grep -i uptime
# HELP vttablet_uptime Uptime in nanoseconds
# TYPE vttablet_uptime gauge
vttablet_uptime 3.53357840381e+11
$ curl -s localhost:15000/debug/vars | grep -i uptime
"Uptime": 369659702674,

@timvaillancourt timvaillancourt requested a review from ajm188 April 5, 2023 10:26
Copy link
Copy Markdown
Contributor

@ajm188 ajm188 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mattlord mattlord merged commit 137cf9d into vitessio:main Apr 6, 2023
@mattlord
Copy link
Copy Markdown
Member

mattlord commented Apr 6, 2023

Thanks, @timvaillancourt ! ❤️

@timvaillancourt timvaillancourt deleted the vttablet-uptime-stat branch April 6, 2023 20:59
timvaillancourt added a commit to slackhq/vitess that referenced this pull request Jun 28, 2023
* 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>
timvaillancourt added a commit to slackhq/vitess that referenced this pull request May 21, 2024
* 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>
timvaillancourt added a commit to slackhq/vitess that referenced this pull request May 22, 2024
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Observability Pull requests that touch tracing/metrics/monitoring Type: Enhancement Logical improvement (somewhere between a bug and feature)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: add metric to determine vtgate/vttablet/vtctld uptime

3 participants