Charm receiving 2 copies of endpoint object on configure_blackbox_exporter_relation()
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-
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.
# 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_
Related branches
- Alvaro Uria (community): Approve
-
Diff: 25 lines (+7/-2)1 file modifiedreactive/prometheus-blackbox-exporter.py (+7/-2)
Changed in charm-prometheus-blackbox-exporter: | |
importance: | Undecided → Medium |
Changed in charm-prometheus-blackbox-exporter: | |
status: | New → Fix Released |
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-prometheu s-blackbox- exporter/ +git/charm- prometheus- blackbox- exporter/ +merge/ 379756