Skip to content

[WIP] Fix violations in opentelemetry-instrumentation-system-metrics#3

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-metric-violations
Draft

[WIP] Fix violations in opentelemetry-instrumentation-system-metrics#3
Copilot wants to merge 3 commits intomainfrom
copilot/fix-metric-violations

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 7, 2026

  • Understand the current implementation of gc_count metrics
  • Research the semantic conventions for cpython.gc metrics in the opentelemetry-python repository
  • Add opentelemetry-semantic-conventions as a dependency in pyproject.toml
  • Update the init.py to import semantic conventions
  • Replace the single process.runtime.gc_count metric with three separate cpython.gc metrics: collections, collected_objects, uncollectable_objects
  • Update _get_runtime_gc_count method to use gc.get_stats() instead of gc.get_count()
  • Change the attribute name from "count" to use CPYTHON_GC_GENERATION constant
  • Update DEFAULT_CONFIG to include the new metric names
  • Update tests to reflect the new metric names and attributes
  • Run tests to verify the changes work correctly
  • Run code review to ensure quality
  • Run security scan
Original prompt

Please look at the following report and open a pr to fix the violations listed there in opentelemetry-instrumentation-system-metrics package that is inside the instrumentation dir. On that instrumentation the name of the attributes are taken from the opentelemetry-semantic-conventions package, so you should grep https://github.com/open-telemetry/opentelemetry-python/tree/main/opentelemetry-semantic-conventions/ to get the variable name referenced in the opentelemetry-instrumentation-system-metrics package.

Here's the report:

Metric cpython.gc.collections counter, {collection}
- [improvement] Metric 'cpython.gc.collections' is not stable; stability = development.
Data point 125
- [violation] Required attribute 'cpython.gc.generation' is not present.
generation = 0
- [violation] Attribute 'generation' does not exist in the registry.
- [improvement] Attribute name 'generation' must include a namespace (e.g. '{namespace}.{attribute_key}')
Data point 11
- [violation] Required attribute 'cpython.gc.generation' is not present.
generation = 1
- [violation] Attribute 'generation' does not exist in the registry.
- [improvement] Attribute name 'generation' must include a namespace (e.g. '{namespace}.{attribute_key}')
Data point 1
- [violation] Required attribute 'cpython.gc.generation' is not present.
generation = 2
- [violation] Attribute 'generation' does not exist in the registry.
- [improvement] Attribute name 'generation' must include a namespace (e.g. '{namespace}.{attribute_key}')

Metric cpython.gc.collected_objects counter, {object}
- [improvement] Metric 'cpython.gc.collected_objects' is not stable; stability = development.
Data point 601
- [violation] Required attribute 'cpython.gc.generation' is not present.
generation = 0
- [violation] Attribute 'generation' does not exist in the registry.
- [improvement] Attribute name 'generation' must include a namespace (e.g. '{namespace}.{attribute_key}')
Data point 78
- [violation] Required attribute 'cpython.gc.generation' is not present.
generation = 1
- [violation] Attribute 'generation' does not exist in the registry.
- [improvement] Attribute name 'generation' must include a namespace (e.g. '{namespace}.{attribute_key}')
Data point 20
- [violation] Required attribute 'cpython.gc.generation' is not present.
generation = 2
- [violation] Attribute 'generation' does not exist in the registry.
- [improvement] Attribute name 'generation' must include a namespace (e.g. '{namespace}.{attribute_key}')

Metric cpython.gc.uncollectable_objects counter, {object}
- [improvement] Metric 'cpython.gc.uncollectable_objects' is not stable; stability = development.
Data point 0
- [violation] Required attribute 'cpython.gc.generation' is not present.
generation = 0
- [violation] Attribute 'generation' does not exist in the registry.
- [improvement] Attribute name 'generation' must include a namespace (e.g. '{namespace}.{attribute_key}')
Data point 0
- [violation] Required attribute 'cpython.gc.generation' is not present.
generation = 1
- [violation] Attribute 'generation' does not exist in the registry.
- [improvement] Attribute name 'generation' must include a namespace (e.g. '{namespace}.{attribute_key}')
Data point 0
- [violation] Required attribute 'cpython.gc.generation' is not present.
generation = 2
- [violation] Attribute 'generation' does not exist in the registry.
- [improvement] Attribute name 'generation' must include a namespace (e.g. '{namespace}.{attribute_key}')


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…conventions

Co-authored-by: xrmx <12932+xrmx@users.noreply.github.com>
Copilot AI requested a review from xrmx January 7, 2026 11:00
Copilot stopped work on behalf of xrmx due to an error January 7, 2026 11: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.

2 participants