operator icon indicating copy to clipboard operation
operator copied to clipboard

Tracing: note the container name in Pebble spans

Open dimaqq opened this issue 8 months ago • 0 comments

Today, a charm would call:

self._amf_container = self.unit.get_container(self._amf_container_name)
...
if not self._amf_container.can_connect(): ...

Which is:

    def can_connect(self) -> bool:
        try:
            self._pebble.get_system_info()
        ...

Which is:

    def get_system_info(self) -> SystemInfo:
        """Get system info."""
        with tracer.start_as_current_span('pebble get_system_info'):
            resp = self._request('GET', '/v1/system-info')
            return SystemInfo.from_dict(resp['result'])

Where neither ._request nor ._request_raw are instrumented.

This generates a tracing span.

Except we lost the container name in the process.

Which is fine for ~90% charms that have only one container, but must be clunky for those charms that have at least two.

dimaqq avatar Jul 03 '25 06:07 dimaqq