Analytics Object

class activelogic.AnalyticsObject

Object representing a dataset for export to Insights Data Storage or Kafka.

Parameters:
  • name (str) – Name of the object.

  • flags (AnalyticsObjectFlags) – Object flags.

  • id (int) – Id of the object.

  • export_format (AnalyticsObjectExportFormat) – Export format.

  • table_name (str) – Name of Insights Data Storage table to write data to.

  • dimensions (str) – Dimensions.

  • partition_key (str) – Which of the dimensions that should serve as partition key.

  • metrics (str) – Metrics.

  • min_bytes_in (int) – Min bytes in (default 0).

  • min_bytes_out (int) – Min bytes out (default 0).

  • aggregation_interval (int) – Aggregation interval in seconds (default 300).

  • dump_interval (int) – Dump interval in seconds (default 300).

dimensions, partition_keys and metrics are all given as comma-separated strings. Some dimensions may expect data that is given within angular brackets. Use Ruleset.list() to list available dimensions and metrics. See also AnalyticsObjectDimension and AnalyticsObjectMetric.

>>> [d for d in rs.list(AnalyticsObjectDimension) if d.name.startswith('ip')]
[AnalyticsObjectDimension(id=1, flags=0, name='ip_address', display_name='IP Address'), ... ]
>>> rs.add(AnalyticsObject('myobj', AnalyticsObjectFlags.DUMP_TO_DISK,
...     dimensions='subscriber<subscriber>,ip_address',
...     partition_key='subscriber<subscriber>',
...     metrics='bytes_in,bytes_out'))
class activelogic.AnalyticsObjectExportFormat

Defines file format for exportation.

Variables:
  • CSV – Data will be exported in CSV format.

  • JSON – Data will be exported in JSON format.

class activelogic.AnalyticsObjectFlags

Defines a set of flags telling how to collect and where to export the data.

Variables:
  • NONE – Data will not be exported.

  • INSIGHTS – Data will be written to Insights Data Storage table.

  • KAFKA – Data will be exported via Kafka.

  • DUMP_TO_DISK – Data will be dumped to disk.

  • HIGH_FREQ_METRICS – Data will be exported will full timestamp resolution.

class activelogic.AnalyticsObjectDimension

Object representing definition of a dimension.

Parameters:
  • id (int) – The ID of the dimension.

  • flags (int) – Flags. Nonzero flag typically means that dimension takes data.

  • name (str) – The name of the dimension.

  • display_name (str) – The display name of the dimension.

  • doc (str) – Additional documentation of the dimension.

class activelogic.AnalyticsObjectMetric

Object representing definition of a metric.

Parameters:
  • id (int) – The ID of the metric.

  • flags (int) – Flags.

  • name (str) – The name of the metric.

  • display_name (str) – The display name of the metric.

  • doc (str) – Additional documentation of the metric.