Skip to content

Event Stats Trends

Rishabh edited this page Apr 7, 2015 · 1 revision

The statstrend operation provides trend of statistical values for a numeric data type over time ranges.

For list of available stats, refer stats

Request Parameters

  • opcode - statstrend (Required) - Operation code for this analytics
  • table - table_name (Required) - Table on which analytics will be run
  • filters - Array of filters (Optional) (default - no filters)
  • field - Numeric field on which stats will be calculated (Required)
  • timestamp - date field on which trends will be calculated (Optional) (default: timestamp)
  • period - Bucketing period of response (Optional) (default - days) (Allowed values - seconds, minutes, hours, days)

Sample Request

{
    "opcode": "statstrend",
    "table": "test",
    "filters": [],
    "field": "duration",
    "timestamp" : "timestamp",
    "period": "days"
}

Sample Response

{
    "opcode": "statstrend",
    "result": [
        {
            "stats": {
                "min": 0,
                "max": 1428349827164,
                "count": 8314453,
                "std_deviation": 1566433372.770371,
                "sum": 14283524207133,
                "variance": 2453713511328760000,
                "sum_of_squares": 2.0401310203289603e+25,
                "avg": 1717915.0819823025
            },
            "percentiles": {
                "99.0": 204.3817867754625,
                "25.0": 1,
                "75.0": 27,
                "1.0": 0,
                "95.0": 101.00006897806242,
                "50.0": 6,
                "5.0": 0
            },
            "period": 1428278400000
        },
        {
            "stats": {
                "min": -916,
                "max": 1428394427813,
                "count": 3866941,
                "std_deviation": 1452748822.8107965,
                "sum": 5713631685811,
                "variance": 2110479142178155300,
                "sum_of_squares": 8.161106766758812e+24,
                "avg": 1477558.5367894156
            },
            "percentiles": {
                "99.0": 237.30199374767824,
                "25.0": 1,
                "75.0": 27,
                "1.0": 0,
                "95.0": 103,
                "50.0": 6,
                "5.0": 0
            },
            "period": 1428364800000
        }
    ]
}

Note: Periods where there are zero events do not appear in the results