Skip to content
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

status: export metrics about MemStats into timeseries #119819

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

lyang24
Copy link
Contributor

@lyang24 lyang24 commented Mar 1, 2024

This commit exposes 5 metrics into cockroachdb's RuntimeStatSampler timeseries. The added metrics are MemStackSysBytes, HeapFragmentBytes, HeapReservedBytes, HeapReleasedBytes, TotalAlloc. These metrics are derived from rumtime/metrics.

Fixes: #96717

Relase note: None

Copy link

blathers-crl bot commented Mar 1, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for contributing to CockroachDB. Please ensure you have followed the guidelines for creating a PR.

Before a member of our team reviews your PR, I have some potential action items for you:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

I have added a few people who may be able to assist in reviewing:

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@blathers-crl blathers-crl bot added O-community Originated from the community X-blathers-triaged blathers was able to find an owner labels Mar 1, 2024
@blathers-crl blathers-crl bot requested a review from 1lann March 1, 2024 18:49
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link

blathers-crl bot commented Mar 12, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for updating your pull request.

Before a member of our team reviews your PR, I have some potential action items for you:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Copy link

blathers-crl bot commented Mar 13, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for updating your pull request.

Before a member of our team reviews your PR, I have some potential action items for you:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Copy link

blathers-crl bot commented Mar 13, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for updating your pull request.

Before a member of our team reviews your PR, I have some potential action items for you:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@lyang24 lyang24 marked this pull request as ready for review March 13, 2024 07:53
@lyang24 lyang24 requested a review from a team March 13, 2024 07:53
@lyang24 lyang24 requested a review from a team as a code owner March 13, 2024 07:53
@lyang24 lyang24 requested review from xinhaoz and removed request for a team March 13, 2024 07:53
Copy link

blathers-crl bot commented Mar 14, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for updating your pull request.

Before a member of our team reviews your PR, I have some potential action items for you:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @1lann, @lyang24, and @xinhaoz)


pkg/server/status/runtime.go line 160 at r1 (raw file):

		Unit:        metric.Unit_BYTES,
	}
	metaMemStackSysBytes = metric.Metadata{

These metrics are all coming from the go runtime. Let's make the following changes:

  • move them up below metaGoTotalBytes
  • rename them to start with metaGo
  • rename the metrics to start with sys.go.
  • rename the gauges to start with Go
  • move the corresponding metric.Gauges up below GoTotalBytes.
  • move the corresponding metric.Gauge construction in up NewRuntimeStatSampler up below GoTotalBytes: ....
  • move the corresponding metric.Gauge.Update calls up

pkg/server/status/runtime.go line 184 at r1 (raw file):

		Unit:        metric.Unit_BYTES,
	}
	metaTotalAlloc = metric.Metadata{

metaGoTotalAllocBytes

Same thing with the gauge, TotalAllocBytes.


pkg/server/status/runtime.go line 371 at r1 (raw file):

// Stack memory allocated by the underlying operating system.
// In non-cgo programs this metric is currently zero. This may
// change in the future.In cgo programs this metric includes

nit: missing space after future.


pkg/server/status/runtime.go line 874 at r1 (raw file):

	rsr.TotalMemBytes.Update(totalMem)
	rsr.MemStackSysBytes.Update(int64(osStackBytes))
	rsr.HeapFragmentBytes.Update(int64(rsr.goRuntimeSampler.uint64(runtimeMetricHeapFragmentBytes)))

We're already fetching these first three from the goRuntimeSampler above. Should we pull them out into variables?

Copy link

blathers-crl bot commented Mar 15, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for updating your pull request.

Before a member of our team reviews your PR, I have some potential action items for you:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Copy link

blathers-crl bot commented Mar 15, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for updating your pull request.

Before a member of our team reviews your PR, I have some potential action items for you:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Copy link
Contributor Author

@lyang24 lyang24 left a comment

Choose a reason for hiding this comment

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

Thank you for review, I have addressed the comments please take another look.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @1lann and @xinhaoz)

Copy link

blathers-crl bot commented Mar 15, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for updating your pull request.

Before a member of our team reviews your PR, I have some potential action items for you:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@lyang24 lyang24 requested a review from nvanbenschoten March 15, 2024 17:04
Copy link
Member

@nvanbenschoten nvanbenschoten left a comment

Choose a reason for hiding this comment

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

:lgtm: once the remaining comments are resolved.

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @1lann, @lyang24, and @xinhaoz)


pkg/server/status/runtime.go line 184 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

metaGoTotalAllocBytes

Same thing with the gauge, TotalAllocBytes.

Looks like this comment was missed.


pkg/server/status/runtime.go line 69 at r2 (raw file):

	metaGoMemStackSysBytes = metric.Metadata{
		Name:        "sys.go.stack.systembytes",
		Help:        "Stack memories obtained from the OS.",

s/memories/memory/


pkg/server/status/runtime.go line 75 at r2 (raw file):

	metaGoHeapFragmentBytes = metric.Metadata{
		Name:        "sys.go.heap.heapfragmentbytes",
		Help:        "Total heap fragmentation bytes, derived from bytes in in-use spans subtracts bytes allocated",

s/subtracts/minus/g

Copy link

blathers-crl bot commented Mar 15, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for updating your pull request.

Before a member of our team reviews your PR, I have some potential action items for you:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

This commit exposes 5 metrics into cockroachdb's RuntimeStatSampler timeseries.
The added metrics are MemStackSysBytes, HeapFragmentBytes, HeapReservedBytes,
HeapReleasedBytes, TotalAlloc. These metrics are derived from rumtime/metrics.

Fixes: cockroachdb#96717

Relase note: None
Copy link

blathers-crl bot commented Mar 15, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

Thank you for updating your pull request.

Before a member of our team reviews your PR, I have some potential action items for you:

  • Please ensure your git commit message contains a release note.
  • When CI has completed, please ensure no errors have appeared.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

Copy link
Contributor Author

@lyang24 lyang24 left a comment

Choose a reason for hiding this comment

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

Appreciated the reviews!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @1lann, @nvanbenschoten, and @xinhaoz)


pkg/server/status/runtime.go line 184 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Looks like this comment was missed.

indeed thanks for catching

@lyang24
Copy link
Contributor Author

lyang24 commented Mar 15, 2024

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 15, 2024

@craig craig bot merged commit ae00dcb into cockroachdb:master Mar 15, 2024
17 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-community Originated from the community X-blathers-triaged blathers was able to find an owner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

obs: export metrics about MemStats into timeseries
3 participants