Skip to content

Usage

The Pymetrix API consists of the following endpoints, accessible from the Metrics class:

pymetrix.metrics.Metrics.aggregate()

Returns the number of hits to each endpoint/target.

pymetrix.metrics.Metrics.time_series()

Returns the time series data for the hits corresponding to every endpoint.

pymetrix.metrics.Metrics.pipeline(data: str = "time_series", mode: str = "live", **kwargs)

Polymorphic method that can act as either a generator or a regular method.

Arguments

1) data
This decides the type of data the method will emit.

Options:

  • aggregate : Emits the aggregated hits ONLY for every endpoint.
  • time_series (default) : Emits the time series data for every endpoint.


2) mode
This decides the mode according to which the data will be emitted.

Options:

  • live (default): Makes the method act as a generator, returning real time data
  • snapshot: Returns the data collected upto the time when it's been called


3) Other arguments in **kwargs:

  • duration (default: None): Duration (in seconds) for the data to be emitted. Works when mode is set to live. Defaults to infinite time.
Back to top