This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove stale opentelemetry_sdk packages (#151)
* remove stale opentelemetry_sdk packages This hack mitigate an issue where the otel library's mechanism to discover resource detectors raised an Exception after a charm refresh, as described in canonical/grafana-agent-operator#146. That was caused by a juju/charmcraft issue (https://bugs.launchpad.net/juju/+bug/2058335) where, when upgrading packages, Juju leaves behind package metadata from the old versions. This caused otel's discovery mechanism to incorrectly use the old resource detector, leading to an exception. The fix here is to, before the otel discovery mechanism fires, detect if we have multiple "opentelemetry_sdk" distributions (packages) and if we do, delete any that appear to be stale (where "stale" is determined by whether they present `entry_points` - this assumption worked in testing, but not sure if it is universally valid) * feat: add guard so otel package removal only happens on upgrade-charm hooks * debug: ignore type errors * fix: env variable used to guard removing stale otel package * docs: add comment describing when patch can be removed * pr comments --------- Co-authored-by: Pietro Pasotti <starfire.daemon@gmail.com>
- Loading branch information