Skip to content

process runtime gc count should not have bytes metrics #3549

Open
@david-gang

Description

@david-gang

Describe your environment

Not relevant

What happened?

In

        if "process.runtime.gc_count" in self._config:
            if self._python_implementation == "pypy":
                _logger.warning(
                    "The process.runtime.gc_count metric won't be collected because the interpreter is PyPy"
                )
            else:
                self._meter.create_observable_counter(
                    name=f"process.runtime.{self._python_implementation}.gc_count",
                    callbacks=[self._get_runtime_gc_count],
                    description=f"Runtime {self._python_implementation} GC count",
                    unit="By",
                )

the unit is bytes. This results in a metrics in prometheus called: process_runtime_cpython_gc_count_bytes_total

but this is incorrect. we are counting gc cycles per generation through

    def _get_runtime_gc_count(
        self, options: CallbackOptions
    ) -> Iterable[Observation]:
        """Observer callback for garbage collection"""
        for index, count in enumerate(gc.get_count()):
            self._runtime_gc_count_labels["count"] = str(index)
            yield Observation(count, self._runtime_gc_count_labels.copy())

Steps to Reproduce

just see the code

Expected Result

not having a bytes suffix.

it should be something like process_runtime_cpython_gc_count_total

Actual Result

process_runtime_cpython_gc_count_bytes_total

Additional context

the change would break lots of stuff and i am not sure people wil be happy.

Would you like to implement a fix?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions