Skip to content

Commit

Permalink
chore: update charm libraries (#156)
Browse files Browse the repository at this point in the history
Co-authored-by: Github Actions <github-actions@github.com>
  • Loading branch information
observability-noctua-bot and Github Actions authored Apr 29, 2023
1 parent 62a1806 commit 560261e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/charms/prometheus_k8s/v0/prometheus_scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,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 = 35
LIBPATCH = 36

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -715,13 +715,12 @@ def _type_convert_stored(obj):
"""Convert Stored* to their appropriate types, recursively."""
if isinstance(obj, StoredList):
return list(map(_type_convert_stored, obj))
elif isinstance(obj, StoredDict):
if isinstance(obj, StoredDict):
rdict = {} # type: Dict[Any, Any]
for k in obj.keys():
rdict[k] = _type_convert_stored(obj[k])
return rdict
else:
return obj
return obj


def _validate_relation_by_interface_and_direction(
Expand Down Expand Up @@ -1440,7 +1439,7 @@ def _dedupe_job_names(jobs: List[dict]):
job["job_name"] = "{}_{}".format(job["job_name"], hashed)
new_jobs = []
for key in jobs_dict:
new_jobs.extend([i for i in jobs_dict[key]])
new_jobs.extend(list(jobs_dict[key]))

# Deduplicate jobs which are equal
# Again this in O(n^2) but it should be okay
Expand Down Expand Up @@ -1796,8 +1795,7 @@ def _scrape_jobs(self) -> list:
jobs = self._jobs if self._jobs else [DEFAULT_JOB]
if callable(self._lookaside_jobs):
return jobs + PrometheusConfig.sanitize_scrape_configs(self._lookaside_jobs())
else:
return jobs
return jobs

@property
def _scrape_metadata(self) -> dict:
Expand Down Expand Up @@ -2078,6 +2076,7 @@ def set_target_job_data(self, targets: dict, app_name: str, **kwargs) -> None:
Args:
targets: a `dict` containing target information
app_name: a `str` identifying the application
kwargs: a `dict` of the extra arguments passed to the function
"""
if not self._charm.unit.is_leader():
return
Expand Down Expand Up @@ -2203,6 +2202,7 @@ def _static_scrape_job(self, targets, application_name, **kwargs) -> dict:
"port".
application_name: a string name of the application for
which this static scrape job is being constructed.
kwargs: a `dict` of the extra arguments passed to the function
Returns:
A dictionary corresponding to a Prometheus static scrape
Expand Down

0 comments on commit 560261e

Please sign in to comment.