Many COS HA charms, such as Tempo, Loki, and Mimir, follow a “Coordinator/Workers”. This pattern is described in detail here. The following post extends this description, focusing on how telemetry is collected from Coordinator/Worker charms.
Metrics
- Metrics configuration is provided by the Coordinator to a metrics scraper via the
metrics-endpoint
relation endpoint on theprometheus_scrape
interface. The metrics configuration provided includes all workloads (the Coordinator’s nginx and all Worker workloads) - Coordinator:
- uses
MetricsEndpointProvider
to send alert rules to the scraper - uses
MetricsEndpointProvider
to send scrape targets for all workloads in the coordinated-worker solution (nginx and all worker workloads) - nginx workload’s metrics are scraped by the scraper
- uses
- Worker:
- no metrics configuration occurs in the Worker charm
- workload metrics are scraped by the scraper
GET
requests direct to every Worker unit
Relation topology:
Data flow:
Logs
- Logging configuration is provided to the Coordinator via the
logging
relation endpoint using theloki_push_api
interface - Coordinator:
- uses
LogForwarder
to configure pebble to send all coordinator workload (nginx) logs to the logging store - extracts logging configuration by interrogating the
logging
relation data directly (usingloki_endpoints_by_unit
, not by using a library from loki) and injects that into theCluster
relation
- uses
- Worker:
- uses
ManualLogForwarder
(a local version similar toLogForwarder
) to configure pebble to send all Worker workload logs to the logging store, using configuration from theCluster
relation
- uses
Relation topology:
Data flow:
Traces
- Tracing configuration is provided to the Coordinator via the
charm-tracing
andworkload-tracing
relation endpoints, both using thetracing
interfacecharm-tracing
in the Coordinator is used to configure tracing in all coordinated-worker charms (Coordinator and all related Workers)
- Coordinator:
- gets tracing configuration from
charm-tracing
andworkload-tracing
by instantiating aTracingEndpointRequirer
for each - sends the protocols required for
charm-tracing
andworkload-tracing
back to the related tracing provider using the instantiatedTracingEndpointRequirer
objects - uses the
charm-tracing
configuration to:- configure the Coordinator charm to emit traces using ops.tracing machinery
- forward
charm-tracing
configuration to the Workers via theCluster
databag
- uses the
workload-tracing
configuration to:- forward
workload-tracing
configuration to the Workers via theCluster
relation
- forward
- gets tracing configuration from
- Worker:
- gets tracing configuration from the
Cluster
relation - configures the workload to emit traces to the provided tracing store
- gets tracing configuration from the
Relation topology:
Data flow: