operator icon indicating copy to clipboard operation
operator copied to clipboard

JUJU_VERSION not set during metrics hooks

Open jameinel opened this issue 4 years ago • 6 comments

As seen by @camille-rodriguez : During 'meter-status-changed' https://paste.ubuntu.com/p/WZfMRkvgyn/

Metrics hooks run in a Limited context which seems to define its own set of vars: https://github.com/juju/juju/blob/develop/worker/uniter/runner/context/context.go#L946 vs https://github.com/juju/juju/blob/develop/worker/meterstatus/context.go#L44

Ideally this also gets fixed in Juju, but in the short term, we don't want to break because of a meter-status-changed or a collect-metrics hook getting triggered.

jameinel avatar Aug 12 '20 14:08 jameinel

https://bugs.launchpad.net/juju/+bug/1891337 is about fixing this in Juju

jameinel avatar Aug 12 '20 14:08 jameinel

I think doing #365 will address this, won't it?

chipaca avatar Aug 12 '20 14:08 chipaca

My concern is that Install will see a JUJU_VERSION of 2.8 above a threshold but then collect-metrics runs and sees a version of 0.0 which ends up below a threshold and confuses the charm.

On Wed, Aug 12, 2020, 18:52 chipaca [email protected] wrote:

I think doing #365 https://github.com/canonical/operator/issues/365 will address this, won't it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/canonical/operator/issues/372#issuecomment-672920277, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRQ7LYVQWJQRORYJJV4OTSAKUDHANCNFSM4P4YVI5A .

jameinel avatar Aug 12 '20 15:08 jameinel

Should this still be open? #365 was merged already.

dstathis avatar Aug 26 '20 14:08 dstathis

I would certainly want us to test whether it works the way we want. The issue is that you might see Juju 2.8+ and go with server-side storage, but then a metrics hook fires without JUJU_VERSION and you think 'oh, I must need local storage because my version is 0.0.0' and then the next hook that fires sees that there is local storage, and ignores all of the state that it had previously recorded in server-side storage.

On Wed, Aug 26, 2020 at 9:32 AM Dylan Stephano-Shachter < [email protected]> wrote:

Should this still be open? #365 https://github.com/canonical/operator/issues/365 was merged already.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/canonical/operator/issues/372#issuecomment-680917184, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABRQ7O7G33HLNIRZCQ2U6LSCUMGFANCNFSM4P4YVI5A .

jameinel avatar Aug 26 '20 14:08 jameinel

You could fall back to querying the machine agent, like charmhelpers does.

johnsca avatar Sep 02 '20 12:09 johnsca

Can close this for now -- now always running "new Juju" (2.8 or whatever it is).

benhoyt avatar Apr 28 '23 12:04 benhoyt