Skip to content

Commit

Permalink
use loki_push_api v1 (#459)
Browse files Browse the repository at this point in the history
* use loki_push_api v1

* update libs
  • Loading branch information
Abuelodelanada authored Sep 19, 2024
1 parent 946be57 commit bf4d760
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions lib/charms/tempo_k8s/v2/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(self, *args):

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

PYDEPS = ["pydantic"]

Expand Down Expand Up @@ -902,7 +902,16 @@ def _get_endpoint(
def get_endpoint(
self, protocol: ReceiverProtocol, relation: Optional[Relation] = None
) -> Optional[str]:
"""Receiver endpoint for the given protocol."""
"""Receiver endpoint for the given protocol.
It could happen that this function gets called before the provider publishes the endpoints.
In such a scenario, if a non-leader unit calls this function, a permission denied exception will be raised due to
restricted access. To prevent this, this function needs to be guarded by the `is_ready` check.
Raises:
ProtocolNotRequestedError:
If the charm unit is the leader unit and attempts to obtain an endpoint for a protocol it did not request.
"""
endpoint = self._get_endpoint(relation or self._relation, protocol=protocol)
if not endpoint:
requested_protocols = set()
Expand Down
2 changes: 1 addition & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from charms.grafana_k8s.v0.grafana_dashboard import GrafanaDashboardProvider
from charms.grafana_k8s.v0.grafana_source import GrafanaSourceProvider
from charms.loki_k8s.v0.charm_logging import log_charm
from charms.loki_k8s.v0.loki_push_api import (
from charms.loki_k8s.v1.loki_push_api import (
LokiPushApiAlertRulesChanged,
LokiPushApiProvider,
)
Expand Down

0 comments on commit bf4d760

Please sign in to comment.