- url = self.config.get("prometheus-url")
- if not url:
- raise CharmError("need prometheus-url config")
- if not self._is_valid_url(url):
- raise CharmError(f"Invalid value for prometheus-url config: '{url}'")
-
- def _is_valid_url(self, url) -> bool:
- return urlparse(url).hostname is not None