Skip to content

Commit

Permalink
chore: update charm libraries (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
observability-noctua-bot authored Jan 16, 2025
1 parent 5a4cec2 commit 5ca6dbb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 33 deletions.
9 changes: 3 additions & 6 deletions lib/charms/prometheus_k8s/v0/prometheus_scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 47
LIBPATCH = 48

PYDEPS = ["cosl"]

Expand Down Expand Up @@ -2364,12 +2364,9 @@ def _get_tool_path(self) -> Optional[Path]:
arch = "amd64" if arch == "x86_64" else arch
res = "cos-tool-{}".format(arch)
try:
path = Path(res).resolve()
path.chmod(0o777)
path = Path(res).resolve(strict=True)
return path
except NotImplementedError:
logger.debug("System lacks support for chmod")
except FileNotFoundError:
except (FileNotFoundError, OSError):
logger.debug('Could not locate cos-tool at: "{}"'.format(res))
return None

Expand Down
15 changes: 8 additions & 7 deletions lib/charms/tempo_coordinator_k8s/v0/charm_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
in real time from the Grafana dashboard the execution flow of your charm.
# Quickstart
Fetch the following charm libs (and ensure the minimum version/revision numbers are satisfied):
Fetch the following charm libs:
charmcraft fetch-lib charms.tempo_coordinator_k8s.v0.tracing # >= 1.10
charmcraft fetch-lib charms.tempo_coordinator_k8s.v0.charm_tracing # >= 2.7
charmcraft fetch-lib charms.tempo_coordinator_k8s.v0.tracing
charmcraft fetch-lib charms.tempo_coordinator_k8s.v0.charm_tracing
Then edit your charm code to include:
Expand Down Expand Up @@ -168,9 +168,10 @@ class MyCharm(CharmBase):
...
```
## Upgrading from `v0`
## Upgrading from `tempo_k8s.v0`
If you are upgrading from `charm_tracing` v0, you need to take the following steps (assuming you already
If you are upgrading from `tempo_k8s.v0.charm_tracing` (note that since then, the charm library moved to
`tempo_coordinator_k8s.v0.charm_tracing`), you need to take the following steps (assuming you already
have the newest version of the library in your charm):
1) If you need the dependency for your tests, add the following dependency to your charm project
(or, if your project had a dependency on `opentelemetry-exporter-otlp-proto-grpc` only because
Expand All @@ -183,7 +184,7 @@ class MyCharm(CharmBase):
For example:
```
from charms.tempo_coordinator_k8s.v0.charm_tracing import trace_charm
from charms.tempo_k8s.v0.charm_tracing import trace_charm
@trace_charm(
tracing_endpoint="my_tracing_endpoint",
Expand Down Expand Up @@ -337,7 +338,7 @@ def _remove_stale_otel_sdk_packages():
# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version

LIBPATCH = 4
LIBPATCH = 5

PYDEPS = ["opentelemetry-exporter-otlp-proto-http==1.21.0"]

Expand Down
21 changes: 1 addition & 20 deletions lib/charms/tempo_coordinator_k8s/v0/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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 = 4
LIBPATCH = 5

PYDEPS = ["pydantic"]

Expand Down Expand Up @@ -951,7 +951,6 @@ def charm_tracing_config(
proceed with charm tracing (with or without tls, as appropriate)
Usage:
If you are using charm_tracing >= v1.9:
>>> from lib.charms.tempo_coordinator_k8s.v0.charm_tracing import trace_charm
>>> from lib.charms.tempo_coordinator_k8s.v0.tracing import charm_tracing_config
>>> @trace_charm(tracing_endpoint="my_endpoint", cert_path="cert_path")
Expand All @@ -961,24 +960,6 @@ def charm_tracing_config(
>>> self.tracing = TracingEndpointRequirer(...)
>>> self.my_endpoint, self.cert_path = charm_tracing_config(
... self.tracing, self._cert_path)
If you are using charm_tracing < v1.9:
>>> from lib.charms.tempo_coordinator_k8s.v0.charm_tracing import trace_charm
>>> from lib.charms.tempo_coordinator_k8s.v0.tracing import charm_tracing_config
>>> @trace_charm(tracing_endpoint="my_endpoint", cert_path="cert_path")
>>> class MyCharm(...):
>>> _cert_path = "/path/to/cert/on/charm/container.crt"
>>> def __init__(self, ...):
>>> self.tracing = TracingEndpointRequirer(...)
>>> self._my_endpoint, self._cert_path = charm_tracing_config(
... self.tracing, self._cert_path)
>>> @property
>>> def my_endpoint(self):
>>> return self._my_endpoint
>>> @property
>>> def cert_path(self):
>>> return self._cert_path
"""
if not endpoint_requirer.is_ready():
return None, None
Expand Down

0 comments on commit 5ca6dbb

Please sign in to comment.