1212# Quickstart
1313Fetch the following charm libs (and ensure the minimum version/revision numbers are satisfied):
1414
15- charmcraft fetch-lib charms.tempo_k8s.v2 .tracing # >= 1.10
16- charmcraft fetch-lib charms.tempo_k8s.v1 .charm_tracing # >= 2.7
15+ charmcraft fetch-lib charms.tempo_coordinator_k8s.v0 .tracing # >= 1.10
16+ charmcraft fetch-lib charms.tempo_coordinator_k8s.v0 .charm_tracing # >= 2.7
1717
1818Then edit your charm code to include:
1919
2020```python
2121# import the necessary charm libs
22- from charms.tempo_k8s.v2 .tracing import TracingEndpointRequirer, charm_tracing_config
23- from charms.tempo_k8s.v1 .charm_tracing import charm_tracing
22+ from charms.tempo_coordinator_k8s.v0 .tracing import TracingEndpointRequirer, charm_tracing_config
23+ from charms.tempo_coordinator_k8s.v0 .charm_tracing import charm_tracing
2424
2525# decorate your charm class with charm_tracing:
2626@charm_tracing(
@@ -51,7 +51,7 @@ def __init__(self, ...):
5151
52522) add to your charm a "my_tracing_endpoint" (you can name this attribute whatever you like)
5353**property**, **method** or **instance attribute** that returns an otlp http/https endpoint url.
54- If you are using the ``charms.tempo_k8s.v2 .tracing.TracingEndpointRequirer`` as
54+ If you are using the ``charms.tempo_coordinator_k8s.v0 .tracing.TracingEndpointRequirer`` as
5555``self.tracing = TracingEndpointRequirer(self)``, the implementation could be:
5656
5757```
@@ -80,7 +80,7 @@ def my_tracing_endpoint(self) -> Optional[str]:
8080
8181For example:
8282```
83- from charms.tempo_k8s.v1 .charm_tracing import trace_charm
83+ from charms.tempo_coordinator_k8s.v0 .charm_tracing import trace_charm
8484@trace_charm(
8585 tracing_endpoint="my_tracing_endpoint",
8686 server_cert="_server_cert"
@@ -129,7 +129,7 @@ def get_tracer(self) -> opentelemetry.trace.Tracer:
129129For example:
130130
131131```
132- from charms.tempo_k8s .v0.charm_tracing import trace_charm
132+ from charms.tempo_coordinator_k8s .v0.charm_tracing import trace_charm
133133
134134 @trace_charm(
135135 tracing_endpoint="my_tracing_endpoint",
@@ -150,7 +150,7 @@ def my_tracing_endpoint(self) -> Optional[str]:
150150needs to be replaced with:
151151
152152```
153- from charms.tempo_k8s.v1 .charm_tracing import trace_charm
153+ from charms.tempo_coordinator_k8s.v0 .charm_tracing import trace_charm
154154
155155 @trace_charm(
156156 tracing_endpoint="my_tracing_endpoint",
@@ -249,28 +249,27 @@ def _remove_stale_otel_sdk_packages():
249249from opentelemetry .sdk .resources import Resource
250250from opentelemetry .sdk .trace import Span , TracerProvider
251251from opentelemetry .sdk .trace .export import BatchSpanProcessor
252+ from opentelemetry .trace import INVALID_SPAN , Tracer
253+ from opentelemetry .trace import get_current_span as otlp_get_current_span
252254from opentelemetry .trace import (
253- INVALID_SPAN ,
254- Tracer ,
255255 get_tracer ,
256256 get_tracer_provider ,
257257 set_span_in_context ,
258258 set_tracer_provider ,
259259)
260- from opentelemetry .trace import get_current_span as otlp_get_current_span
261260from ops .charm import CharmBase
262261from ops .framework import Framework
263262
264263# The unique Charmhub library identifier, never change it
265- LIBID = "cb1705dcd1a14ca09b2e60187d1215c7 "
264+ LIBID = "01780f1e588c42c3976d26780fdf9b89 "
266265
267266# Increment this major API version when introducing breaking changes
268- LIBAPI = 1
267+ LIBAPI = 0
269268
270269# Increment this PATCH version before using `charmcraft publish-lib` or reset
271270# to 0 if you are raising the major API version
272271
273- LIBPATCH = 15
272+ LIBPATCH = 2
274273
275274PYDEPS = ["opentelemetry-exporter-otlp-proto-http==1.21.0" ]
276275
@@ -332,7 +331,7 @@ def _get_tracer() -> Optional[Tracer]:
332331 return tracer .get ()
333332 except LookupError :
334333 # fallback: this course-corrects for a user error where charm_tracing symbols are imported
335- # from different paths (typically charms.tempo_k8s ... and lib.charms.tempo_k8s ...)
334+ # from different paths (typically charms.tempo_coordinator_k8s ... and lib.charms.tempo_coordinator_k8s ...)
336335 try :
337336 ctx : Context = copy_context ()
338337 if context_tracer := _get_tracer_from_context (ctx ):
@@ -372,10 +371,6 @@ class UntraceableObjectError(TracingError):
372371 """Raised when an object you're attempting to instrument cannot be autoinstrumented."""
373372
374373
375- class TLSError (TracingError ):
376- """Raised when the tracing endpoint is https but we don't have a cert yet."""
377-
378-
379374def _get_tracing_endpoint (
380375 tracing_endpoint_attr : str ,
381376 charm_instance : object ,
@@ -485,10 +480,15 @@ def wrap_init(self: CharmBase, framework: Framework, *args, **kwargs):
485480 )
486481
487482 if tracing_endpoint .startswith ("https://" ) and not server_cert :
488- raise TLSError (
483+ logger . error (
489484 "Tracing endpoint is https, but no server_cert has been passed."
490- "Please point @trace_charm to a `server_cert` attr."
485+ "Please point @trace_charm to a `server_cert` attr. "
486+ "This might also mean that the tracing provider is related to a "
487+ "certificates provider, but this application is not (yet). "
488+ "In that case, you might just have to wait a bit for the certificates "
489+ "integration to settle. "
491490 )
491+ return
492492
493493 exporter = OTLPSpanExporter (
494494 endpoint = tracing_endpoint ,
@@ -562,8 +562,8 @@ def trace_charm(
562562 method calls on instances of this class.
563563
564564 Usage:
565- >>> from charms.tempo_k8s.v1 .charm_tracing import trace_charm
566- >>> from charms.tempo_k8s.v1 .tracing import TracingEndpointRequirer
565+ >>> from charms.tempo_coordinator_k8s.v0 .charm_tracing import trace_charm
566+ >>> from charms.tempo_coordinator_k8s.v0 .tracing import TracingEndpointRequirer
567567 >>> from ops import CharmBase
568568 >>>
569569 >>> @trace_charm(
@@ -626,7 +626,7 @@ def _autoinstrument(
626626
627627 Usage:
628628
629- >>> from charms.tempo_k8s.v1 .charm_tracing import _autoinstrument
629+ >>> from charms.tempo_coordinator_k8s.v0 .charm_tracing import _autoinstrument
630630 >>> from ops.main import main
631631 >>> _autoinstrument(
632632 >>> MyCharm,
0 commit comments