GafaelfawrMetrics

class gafaelfawr.metrics.GafaelfawrMetrics(url, meter_name, metric_reader=None)

Bases: object

Base class for OpenTelemetry instruments for Gafaelfawr.

Gafaelfawr has several different containers of metrics instruments used by its different components. This base class contains the shared code common to all of them, such as initializing the metrics exporter. Only one subclass of this class should be instantiated in a given process. (This is not enforced.)

Parameters:
  • url (Union[Url, str]) – URL to the OpenTelemetry collector to which to send metrics.

  • meter_name (str) – Name of the meter, which should correspond to the component of Gafaelfawr that logs these metrics.

  • metric_reader (MetricReader | None, default: None) – If provided, do not collect and send metrics to the OpenTelemetry collector, and instead use the provided metric reader. This is used by the test suite to disable the OpenTelemetry exporter in favor of an in-memory metrics reader that can be queried by the test suite.

meter

Meter that should be used to create instruments.