Skip to content

add gc_count metrics with correct collection unit . #3617

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

david-gang
Copy link
Contributor

@david-gang david-gang commented Jul 6, 2025

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes #3549

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

The change is trivial as

already tests autimatically the new metrics. The same callback is used.

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added - No need as the same metric with the same callback already exist
  • Documentation has been updated - By my understanding should be created automatically

I try to keep this pr as small as possible. After this is merged i want to add the cpython.gc.collected_objects and cpython.gc.uncollectable_objects metrics from https://github.com/open-telemetry/semantic-conventions/blob/2bc97890c1ad82232745b4dd74fd3144476b6a5c/docs/runtime/cpython-metrics.md#metric-cpythongccollected_objects

Copy link

linux-foundation-easycla bot commented Jul 6, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@david-gang david-gang requested a review from a team as a code owner July 6, 2025 13:59
@@ -469,6 +470,12 @@ def _instrument(self, **kwargs: Any):
description=f"Runtime {self._python_implementation} GC count",
unit="By",
)
self._meter.create_observable_counter(
name=f"process.runtime.{self._python_implementation}.gc_count",
Copy link
Member

Choose a reason for hiding this comment

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

I think the name should be cpython.gc.collections no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the catch. added this metrics name. this also aligns to your other comment. Now it gets its own if

@@ -469,6 +470,12 @@ def _instrument(self, **kwargs: Any):
description=f"Runtime {self._python_implementation} GC count",
unit="By",
)
self._meter.create_observable_counter(
Copy link
Member

Choose a reason for hiding this comment

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

Since it doesn't work with pypy, can we skip for pypy from here?

@david-gang
Copy link
Contributor Author

Short question: Should we comment that the old metric is deprecated ?

@david-gang david-gang force-pushed the gc_count_collection_unit branch from d4d91eb to 4003bb0 Compare July 15, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

process runtime gc count should not have bytes metrics
2 participants