tempo-k8s docs - How to integrate with other charms over `tracing`
Setting up tracing integration
if you are charming an application that is already instrumented for tracing or you plan to configure the workload or the charm itself to push traces, you can integrate with tempo-coordinator-k8s
, the single integration entrypoint for Charmed Tempo HA, to send traces to a Tempo endpoint.
Instrumenting your workload
is not covered under tempo-k8s
. Some workloads, like Grafana
are already instrumented for tracing by design. Otherwise, you can use auto-instrumentation libraries to instrument your workload and integrate with tempo-k8s
as a tracing backend.
For an example of charms that already integrate with tempo-k8s
to collect traces, see loki
and prometheus
.
Add an integration endpoint to charmcraft.yaml
host and injesters data is communicated over relation data, where the charmed application is the requirer and Tempo charm is the provider.
For consistency across the ecosystem, it is encouraged to name the relation tracing
.
Edit your charm’s charmcraft.yaml
to add, under requires
, the following:
requires:
# any other requirers your charm supports
tracing:
interface: tracing
limit: 1
Fetch the tracing charm library
charmcraft fetch-lib charms.tempo_k8s.v2.tracing
The TracingEndpointRequirer
object enables your charm to easily access Tempo endpoint information exchanged over a tracing
relation interface.
Use TracingEndpointRequirer
If you are intending to send traces with otlp_http
and otlp_grpc
tracing protocols:
from charms.tempo_k8s.v2.tracing import TracingEndpointRequirer
class FooCharm:
def __init__(self, *args):
super().__init__(*args, **kwargs)
...
self.tracing = TracingEndpointRequirer(self, protocols=["otlp_http", "otlp_grpc"])
...
This will ensure that each unit of Foo
will have access to a Tempo endpoint to push charm traces to once a
relation is established.
For the list of supported protocols
, see Tracing Protocols.
Access Tempo endpoints
After instantiating TracingEndpointRequirer
with a list of protocols, tempo-k8s
charm will provide, as part of its databag, a set of Tempo endpoints for the requested protocols that your workload
& charm
can use to push traces to.
from charms.tempo_k8s.v2.tracing import TracingEndpointRequirer
class FooCharm:
def __init__(self, *args):
super().__init__(*args, **kwargs)
...
self.tracing = TracingEndpointRequirer(self, protocols=["otlp_http", "otlp_grpc"])
...
# get tempo endpoints
if self.tracing.is_ready():
grpc_endpoint = self.tracing.get_endpoint("otlp_grpc")
http_endpoint = self.tracing.get_endpoint("otlp_http")
We recommend that you scale up your tracing provider and relate it to an ingress so that your tracing requests go through the ingress and get load balanced across all units. Otherwise, if the provider’s leader goes down, your tracing goes down.
Last updated 14 days ago.