Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPE-1993] patroni cos dplibs v22 #267

Closed
wants to merge 11 commits into from
363 changes: 248 additions & 115 deletions lib/charms/data_platform_libs/v0/data_interfaces.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions lib/charms/data_platform_libs/v0/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def restart(self, event) -> None:
import json
import logging
from abc import ABC, abstractmethod
from typing import List, Literal, Optional, Set, Tuple
from typing import Dict, List, Literal, Optional, Set, Tuple

import poetry.core.constraints.version as poetry_version
from ops.charm import (
Expand All @@ -285,7 +285,7 @@ def restart(self, event) -> None:

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

PYDEPS = ["pydantic>=1.10,<2", "poetry-core"]

Expand Down Expand Up @@ -346,7 +346,7 @@ class KafkaDependenciesModel(BaseModel):
print(model.dict()) # exporting back validated deps
"""

dependencies: dict[str, str]
dependencies: Dict[str, str]
name: str
upgrade_supported: str
version: str
Expand Down
19 changes: 17 additions & 2 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,27 @@ def __init__(self, *args):
self._observer.start_observer()
self._grafana_agent = COSAgentProvider(
self,
metrics_endpoints=[
{"path": "/metrics", "port": METRICS_PORT},
metrics_endpoints=[{"path": "/metrics", "port": METRICS_PORT}],
scrape_configs=self.patroni_scrape_config,
refresh_events=[
self.on[PEER].relation_changed,
self.on.secret_changed,
self.on.secret_remove,
],
log_slots=[f"{POSTGRESQL_SNAP_NAME}:logs"],
)

def patroni_scrape_config(self) -> List[Dict]:
"""Generates scrape config for the Patroni metrics endpoint."""
return [
{
"metrics_path": "/metrics",
"static_configs": [{"targets": [f"{self._unit_ip}:8008"]}],
"tls_config": {"insecure_skip_verify": True},
"scheme": "https" if self.is_tls_enabled else "http",
}
]

@property
def app_units(self) -> set[Unit]:
"""The peer-related units in the application."""
Expand Down
Loading
Loading