Shin.Metrics (Shin v0.2.0) View Source

This module contains convenient functions for retrieving and processing the metrics data provided by a Shibboleth IdP.

Link to this section Summary

Functions

Return the value for a gauge.

List the keys for all gauges in the metrics.

Returns a map of all gauges and their extracted values from the metrics data.

Returns a map of containing the specified gauge data, with new keys

Returns a map of containing the specified timer data, with new keys

Returns default (all) raw metrics from the IdP as a map.

Returns the specified raw metrics group from the IdP as a map.

Return the value for a timer.

List the keys for all timers in the metrics.

Returns a map of all timers and their details from the metrics data.

Link to this section Functions

Specs

gauge(data :: map(), gauge :: binary()) :: binary() | integer()

Return the value for a gauge.

Specify the metrics map and key for the value to be extracted (assuming it's in a value: field)

Examples

  Shin.Metrics.gauge(metrics, "cores.available")
  # => 8

Specs

gauge_ids(data :: map()) :: list()

List the keys for all gauges in the metrics.

Requires a metrics map as the only parameter.

Examples

  Shin.Metrics.gauge_ids(metrics)
  # => ["cores.available", "host.name", "java.class.path" ...]

Specs

gauges(data :: map()) :: map()

Returns a map of all gauges and their extracted values from the metrics data.

Examples

 Metrics.gauges(metrics)
  # => %{"memory.free.megs" => 2400, "memory.max.megs" => 8234 ...}

Specs

map_gauges(data :: map(), keymap :: map()) :: map()

Returns a map of containing the specified gauge data, with new keys

Pass the metrics data followed by map of new_key => gauge_id

Examples

 Metrics.map_gauges(metrics,  %{hn: "host.name", mm: "memory.max.megs"})
 # => %{hn: "production1", mm: 2048}

Specs

map_timers(data :: map(), keymap :: map()) :: map()

Returns a map of containing the specified timer data, with new keys

Pass the metrics data followed by map of new_key => timer_id

Examples

 Metrics.map_timers(metrics,  %{timer1: "org.opensaml.saml.metadata.resolver.impl.LocalDynamicMetadataResolver.exOverride.timer.resolve"})
 # => %{timer1: %{"count" => 1, "duration_units" => "seconds" ...}}

Specs

query(idp :: Shin.IdP.t()) :: {:ok, map()} | {:error, binary()}

Returns default (all) raw metrics from the IdP as a map.

Pass an IdP as the only parameter.

Examples

  {:ok, metrics} = Shin.Metrics.query(idp)

Specs

query(idp :: Shin.IdP.t(), group :: atom() | binary()) ::
  {:ok, map()} | {:error, binary()}

Returns the specified raw metrics group from the IdP as a map.

Pass an IdP struct as the first parameter and the name of the group as the second (as atom or binary)

Examples

  {:ok, metrics} = Shin.Metrics.query(idp, :core)

Specs

timer(data :: map(), timer :: binary()) :: map()

Return the value for a timer.

Specify the metrics map and key for the timer map to be extracted.

Examples

  Shin.Metrics.timer(metrics, "org.opensaml.saml.metadata.resolver.impl.LocalDynamicMetadataResolver.exOverride.timer.resolve")
  # => %{"count" => 1, "duration_units" => "seconds" ...}

Specs

timer_ids(data :: map()) :: list()

List the keys for all timers in the metrics.

Requires a metrics map as the only parameter.

Examples

  Shin.Metrics.timer_ids(metrics)
  # => ["org.opensaml.saml.metadata.resolver.impl.LocalDynamicMetadataResolver.exOverride.timer.resolve" ...]

Specs

timers(data :: map()) :: map()

Returns a map of all timers and their details from the metrics data.

Examples

 Metrics.timers(metrics)
  # => %{"org.opensaml.saml.metadata.resolver.impl.LocalDynamicMetadataResolver.exOverride.timer.resolve" => %{} ...}