Skip to content

Commit

Permalink
chore: update charm libraries (#157)
Browse files Browse the repository at this point in the history
Co-authored-by: Github Actions <[email protected]>
  • Loading branch information
observability-noctua-bot and Github Actions authored Mar 25, 2023
1 parent 1867c04 commit 6c8cb30
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/charms/loki_k8s/v0/loki_push_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def _alert_rules_error(self, event):

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 17
LIBPATCH = 18

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -1450,6 +1450,7 @@ def __init__(
relation_name: str = DEFAULT_RELATION_NAME,
alert_rules_path: str = DEFAULT_ALERT_RULES_RELATIVE_PATH,
recursive: bool = False,
skip_alert_topology_labeling: bool = False,
):
super().__init__(charm, relation_name)
self._charm = charm
Expand All @@ -1465,14 +1466,17 @@ def __init__(
e.message,
)
self._alert_rules_path = alert_rules_path
self._skip_alert_topology_labeling = skip_alert_topology_labeling

self._recursive = recursive

def _handle_alert_rules(self, relation):
if not self._charm.unit.is_leader():
return

alert_rules = AlertRules(self.topology)
alert_rules = (
AlertRules(None) if self._skip_alert_topology_labeling else AlertRules(self.topology)
)
alert_rules.add_path(self._alert_rules_path, recursive=self._recursive)
alert_rules_as_dict = alert_rules.as_dict()

Expand Down Expand Up @@ -1520,6 +1524,7 @@ def __init__(
relation_name: str = DEFAULT_RELATION_NAME,
alert_rules_path: str = DEFAULT_ALERT_RULES_RELATIVE_PATH,
recursive: bool = True,
skip_alert_topology_labeling: bool = False,
):
"""Construct a Loki charm client.
Expand Down Expand Up @@ -1565,7 +1570,9 @@ def __init__(
_validate_relation_by_interface_and_direction(
charm, relation_name, RELATION_INTERFACE_NAME, RelationRole.requires
)
super().__init__(charm, relation_name, alert_rules_path, recursive)
super().__init__(
charm, relation_name, alert_rules_path, recursive, skip_alert_topology_labeling
)
events = self._charm.on[relation_name]
self.framework.observe(self._charm.on.upgrade_charm, self._on_lifecycle_event)
self.framework.observe(events.relation_joined, self._on_logging_relation_joined)
Expand Down

0 comments on commit 6c8cb30

Please sign in to comment.