Ex4pm.Stream.Metrics (ex4pm v26.9.9)

Copy Markdown View Source

Prometheus telemetry metrics for the Ex4pm.Stream.Pipeline Broadway pipeline.

Wraps TelemetryMetricsPrometheus.Core over Broadway's real telemetry events (confirmed against the vendored deps/broadway/lib/broadway.ex telemetry docs):

  • [:broadway, :processor, :message, :stop] — emitted after each message is processed by handle_message/3; measurement :duration is the processing time in native time units.
  • [:broadway, :processor, :message, :exception] — emitted when handle_message/3 raises.
  • [:broadway, :batch_processor, :stop] — emitted after a batch is handled.

Start under a supervisor with {Ex4pm.Stream.Metrics, name: :my_metrics} (or no opts for the default name), then call scrape/0 (or scrape/1 with an explicit name) to get the real Prometheus-format text.

Summary

Functions

Real TelemetryMetricsPrometheus.Core child spec, ready for a supervision tree.

The default reporter name used when no explicit :name is given.

The list of real Telemetry.Metrics definitions built over Broadway's telemetry events.

Scrapes the default-named Prometheus reporter and returns real Prometheus-format text.

Scrapes the named Prometheus reporter and returns real Prometheus-format text.

Functions

child_spec(opts)

@spec child_spec(keyword()) :: Supervisor.child_spec()

Real TelemetryMetricsPrometheus.Core child spec, ready for a supervision tree.

default_name()

@spec default_name() :: atom()

The default reporter name used when no explicit :name is given.

metrics()

@spec metrics() :: [Telemetry.Metrics.t()]

The list of real Telemetry.Metrics definitions built over Broadway's telemetry events.

scrape()

@spec scrape() :: String.t()

Scrapes the default-named Prometheus reporter and returns real Prometheus-format text.

scrape(name)

@spec scrape(atom()) :: String.t()

Scrapes the named Prometheus reporter and returns real Prometheus-format text.