12
12
# Quickstart
13
13
Fetch the following charm libs (and ensure the minimum version/revision numbers are satisfied):
14
14
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
17
17
18
18
Then edit your charm code to include:
19
19
20
20
```python
21
21
# 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
24
24
25
25
# decorate your charm class with charm_tracing:
26
26
@charm_tracing(
@@ -51,7 +51,7 @@ def __init__(self, ...):
51
51
52
52
2) add to your charm a "my_tracing_endpoint" (you can name this attribute whatever you like)
53
53
**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
55
55
``self.tracing = TracingEndpointRequirer(self)``, the implementation could be:
56
56
57
57
```
@@ -80,7 +80,7 @@ def my_tracing_endpoint(self) -> Optional[str]:
80
80
81
81
For example:
82
82
```
83
- from charms.tempo_k8s.v1 .charm_tracing import trace_charm
83
+ from charms.tempo_coordinator_k8s.v0 .charm_tracing import trace_charm
84
84
@trace_charm(
85
85
tracing_endpoint="my_tracing_endpoint",
86
86
server_cert="_server_cert"
@@ -129,7 +129,7 @@ def get_tracer(self) -> opentelemetry.trace.Tracer:
129
129
For example:
130
130
131
131
```
132
- from charms.tempo_k8s .v0.charm_tracing import trace_charm
132
+ from charms.tempo_coordinator_k8s .v0.charm_tracing import trace_charm
133
133
134
134
@trace_charm(
135
135
tracing_endpoint="my_tracing_endpoint",
@@ -150,7 +150,7 @@ def my_tracing_endpoint(self) -> Optional[str]:
150
150
needs to be replaced with:
151
151
152
152
```
153
- from charms.tempo_k8s.v1 .charm_tracing import trace_charm
153
+ from charms.tempo_coordinator_k8s.v0 .charm_tracing import trace_charm
154
154
155
155
@trace_charm(
156
156
tracing_endpoint="my_tracing_endpoint",
@@ -249,28 +249,27 @@ def _remove_stale_otel_sdk_packages():
249
249
from opentelemetry .sdk .resources import Resource
250
250
from opentelemetry .sdk .trace import Span , TracerProvider
251
251
from 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
252
254
from opentelemetry .trace import (
253
- INVALID_SPAN ,
254
- Tracer ,
255
255
get_tracer ,
256
256
get_tracer_provider ,
257
257
set_span_in_context ,
258
258
set_tracer_provider ,
259
259
)
260
- from opentelemetry .trace import get_current_span as otlp_get_current_span
261
260
from ops .charm import CharmBase
262
261
from ops .framework import Framework
263
262
264
263
# The unique Charmhub library identifier, never change it
265
- LIBID = "cb1705dcd1a14ca09b2e60187d1215c7 "
264
+ LIBID = "01780f1e588c42c3976d26780fdf9b89 "
266
265
267
266
# Increment this major API version when introducing breaking changes
268
- LIBAPI = 1
267
+ LIBAPI = 0
269
268
270
269
# Increment this PATCH version before using `charmcraft publish-lib` or reset
271
270
# to 0 if you are raising the major API version
272
271
273
- LIBPATCH = 15
272
+ LIBPATCH = 2
274
273
275
274
PYDEPS = ["opentelemetry-exporter-otlp-proto-http==1.21.0" ]
276
275
@@ -332,7 +331,7 @@ def _get_tracer() -> Optional[Tracer]:
332
331
return tracer .get ()
333
332
except LookupError :
334
333
# 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 ...)
336
335
try :
337
336
ctx : Context = copy_context ()
338
337
if context_tracer := _get_tracer_from_context (ctx ):
@@ -372,10 +371,6 @@ class UntraceableObjectError(TracingError):
372
371
"""Raised when an object you're attempting to instrument cannot be autoinstrumented."""
373
372
374
373
375
- class TLSError (TracingError ):
376
- """Raised when the tracing endpoint is https but we don't have a cert yet."""
377
-
378
-
379
374
def _get_tracing_endpoint (
380
375
tracing_endpoint_attr : str ,
381
376
charm_instance : object ,
@@ -485,10 +480,15 @@ def wrap_init(self: CharmBase, framework: Framework, *args, **kwargs):
485
480
)
486
481
487
482
if tracing_endpoint .startswith ("https://" ) and not server_cert :
488
- raise TLSError (
483
+ logger . error (
489
484
"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. "
491
490
)
491
+ return
492
492
493
493
exporter = OTLPSpanExporter (
494
494
endpoint = tracing_endpoint ,
@@ -562,8 +562,8 @@ def trace_charm(
562
562
method calls on instances of this class.
563
563
564
564
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
567
567
>>> from ops import CharmBase
568
568
>>>
569
569
>>> @trace_charm(
@@ -626,7 +626,7 @@ def _autoinstrument(
626
626
627
627
Usage:
628
628
629
- >>> from charms.tempo_k8s.v1 .charm_tracing import _autoinstrument
629
+ >>> from charms.tempo_coordinator_k8s.v0 .charm_tracing import _autoinstrument
630
630
>>> from ops.main import main
631
631
>>> _autoinstrument(
632
632
>>> MyCharm,
0 commit comments