From ccf70c230d4890713e8832d530c15daf605fcb03 Mon Sep 17 00:00:00 2001 From: Orfeas Kourkakis Date: Sat, 27 Apr 2024 12:53:19 +0300 Subject: [PATCH 1/2] chore: Bump prometheus_scrape lib --- .../prometheus_k8s/v0/prometheus_scrape.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/charms/prometheus_k8s/v0/prometheus_scrape.py b/lib/charms/prometheus_k8s/v0/prometheus_scrape.py index 665af88..be96768 100644 --- a/lib/charms/prometheus_k8s/v0/prometheus_scrape.py +++ b/lib/charms/prometheus_k8s/v0/prometheus_scrape.py @@ -362,7 +362,7 @@ def _on_scrape_targets_changed(self, event): # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 44 +LIBPATCH = 46 PYDEPS = ["cosl"] @@ -521,8 +521,8 @@ def expand_wildcard_targets_into_individual_jobs( # for such a target. Therefore labeling with Juju topology, excluding the # unit name. non_wildcard_static_config["labels"] = { - **non_wildcard_static_config.get("labels", {}), **topology.label_matcher_dict, + **non_wildcard_static_config.get("labels", {}), } non_wildcard_static_configs.append(non_wildcard_static_config) @@ -547,9 +547,9 @@ def expand_wildcard_targets_into_individual_jobs( if topology: # Add topology labels modified_static_config["labels"] = { - **modified_static_config.get("labels", {}), **topology.label_matcher_dict, **{"juju_unit": unit_name}, + **modified_static_config.get("labels", {}), } # Instance relabeling for topology should be last in order. @@ -1537,12 +1537,11 @@ def set_scrape_job_spec(self, _=None): relation.data[self._charm.app]["scrape_metadata"] = json.dumps(self._scrape_metadata) relation.data[self._charm.app]["scrape_jobs"] = json.dumps(self._scrape_jobs) - if alert_rules_as_dict: - # Update relation data with the string representation of the rule file. - # Juju topology is already included in the "scrape_metadata" field above. - # The consumer side of the relation uses this information to name the rules file - # that is written to the filesystem. - relation.data[self._charm.app]["alert_rules"] = json.dumps(alert_rules_as_dict) + # Update relation data with the string representation of the rule file. + # Juju topology is already included in the "scrape_metadata" field above. + # The consumer side of the relation uses this information to name the rules file + # that is written to the filesystem. + relation.data[self._charm.app]["alert_rules"] = json.dumps(alert_rules_as_dict) def _set_unit_ip(self, _=None): """Set unit host address. From cfb91c5238079c2f8bb6089bd2ced82e6bf29810 Mon Sep 17 00:00:00 2001 From: Orfeas Kourkakis Date: Sat, 27 Apr 2024 12:56:44 +0300 Subject: [PATCH 2/2] Update requirements.in --- requirements.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/requirements.in b/requirements.in index da39745..4ddaf59 100644 --- a/requirements.in +++ b/requirements.in @@ -1,11 +1,9 @@ # Copyright 2021 Canonical Ltd. # See LICENSE file for licensing details. charmed-kubeflow-chisme >= 0.3.0 -# from observability_libs.v0.juju_topology.py +# from prometheus_k8s.v0.prometheus_scrape.py cosl envoy_data_plane==0.2.5 -# from observability_libs.v0.juju_topology.py -cosl # if unpinned causes problems with installation resulting in module 'platform' has no attribute 'dist' oci-image ops