self.tracing.get_endpoint raises an exception if the endpoint hasn't been requested (yet).
Since the requested endpoints are app-level, TracingRequirer only requests them if the owner is the leader and silently does nothing if otherwise.
When you're leader, there is no problem because on __init__, the requirer lib will request the endpoint and so by the time otlp_http_endpoint is accessed, endpoints have certainly been requested (even if there is no response yet).
When you're not leader, there are two issues, one verified and reproducible, and one potential:
if you write a unit test for the non-leader path, the charm_tracing lib will attempt to obtain otlp_http_endpoint and blow up.
in a scenario when you deploy multiple units at once, it may well be that the follower units execute their first hooks before the leader unit has had a chance to request the protocols (or even be related to tempo!)
Bug Description
When you use charm-tracing, you typically do:
self.tracing.get_endpoint
raises an exception if the endpoint hasn't been requested (yet).Since the requested endpoints are app-level,
TracingRequirer
only requests them if the owner is the leader and silently does nothing if otherwise. When you're leader, there is no problem because on__init__
, the requirer lib will request the endpoint and so by the timeotlp_http_endpoint
is accessed, endpoints have certainly been requested (even if there is no response yet).When you're not leader, there are two issues, one verified and reproducible, and one potential:
otlp_http_endpoint
and blow up.To Reproduce
n/a
Environment
n/a
Relevant log output
Additional context
No response