Charm receiving 2 copies of endpoint object on configure_blackbox_exporter_relation()

Bug #1864513 reported by Paul Goins
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Prometheus Blackbox Exporter Charm
Fix Released
Medium
Unassigned

Bug Description

While I haven't been able to root-cause exactly what caused the change, with the current versions of dependencies, triggering events on the blackbox-exporter relation causes 2 copies of the blackbox-exporter endpoing object to be injected.

This is because the @when decorator injects arguments based on flags provided to it that have a prefix matching relation names. There are 2 @when decorators on this handler, each with a "blackbox-exporter." prefix which would trigger injection, but only one argument in the function signature.

I'm actually not clear why this used to work; I'm guessing there may have been some detection of already-added args in the past, but haven't readily been able to find this in older versions of charms.reactive, perhaps due to my unfamiliarity with that code.

This feels like a regression in one of the dependencies as the source code is the same as the current charm store version, yet the charm store version works fine when exercising the blackbox-exporter relation, getting only one injected argument.

...This being said, charms.reactive.decorators._when_decorator specifies in a comment that handlers ought to no longer rely on parameter injection:

# Handlers should all move to not taking any params and getting
# the Endpoint instances from the context, but during the
# transition, we need to provide for handlers expecting args.

Thus, tracking down and resolving the underlying dependency issue is one path, and the other may be simply to pull the endpoint explicitly via endpoint_from_name() rather than relying on injection.

Revision history for this message
Paul Goins (vultaire) wrote :

While this issue may have occurred in other reactive charms, here is a solution which resolves this by removing the dependency on injected args, which charms.reactive comments indicate we should do anyway: https://code.launchpad.net/~vultaire/charm-prometheus-blackbox-exporter/+git/charm-prometheus-blackbox-exporter/+merge/379756

Edin S (exsdev)
Changed in charm-prometheus-blackbox-exporter:
importance: Undecided → Medium
Changed in charm-prometheus-blackbox-exporter:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.