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

chore: update charm libraries #235

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading