Skip to content

compute ¤

Bucket dataclass ¤

Bucket(
    timestamp: NanosecondsUTC,
    min: float,
    max: float,
    mean: float,
    variance: float,
    count: int,
)

Time-bucketed data for a numeric series within Nominal

count instance-attribute ¤

count: int

Number of samples decimated into this bucket

max instance-attribute ¤

max: float

Maximum value of data within the bucket

mean instance-attribute ¤

mean: float

Average value of data within the bucket

min instance-attribute ¤

min: float

Minimum value of data within the bucket

timestamp instance-attribute ¤

timestamp: NanosecondsUTC

Last timestamp of data within the bucket

variance instance-attribute ¤

variance: float

Variance of data within the bucket

batch_compute_buckets ¤

batch_compute_buckets(
    client: NominalClient,
    exprs: Iterable[NumericExpr],
    start: NanosecondsUTC,
    end: NanosecondsUTC,
    buckets: int = 1000,
) -> Sequence[Sequence[Bucket]]

Computed bucketed summaries for a batch of numeric expressions

Parameters:

  • client ¤

    (NominalClient) –

    Nominal client to make requests with

  • exprs ¤

    (Iterable[NumericExpr]) –

    Expressions to compute buckets for

  • start ¤

    (NanosecondsUTC) –

    Starting timestamp to summarize data from

  • end ¤

    (NanosecondsUTC) –

    Ending timestamp to summarize data until

  • buckets ¤

    (int, default: 1000 ) –

    Number of buckets to return per expression

Returns:

  • Sequence[Sequence[Bucket]]

    A Sequence of sequences of buckets. The top level sequence corresponds to the input expressions, whereas the

  • Sequence[Sequence[Bucket]]

    inner sequences correspond to the individual buckets for each input expression. The order of buckets returned

  • Sequence[Sequence[Bucket]]

    matches the order of expressions provided.

  • NOTE ( Sequence[Sequence[Bucket]] ) –

    it is not a safe guarantee that the number of buckets returned is the same as the number requested

compute_buckets ¤

compute_buckets(
    client: NominalClient,
    expr: NumericExpr,
    start: NanosecondsUTC,
    end: NanosecondsUTC,
    buckets: int = 1000,
) -> Sequence[Bucket]

Compute a bucketed summary of the requested expression.

Parameters:

  • client ¤

    (NominalClient) –

    Nominal client to make requests with

  • expr ¤

    (NumericExpr) –

    Expression to compute buckets for

  • start ¤

    (NanosecondsUTC) –

    Starting timestamp to summarize data from

  • end ¤

    (NanosecondsUTC) –

    Ending timestamp to summarize data until

  • buckets ¤

    (int, default: 1000 ) –

    Number of buckets to return

Returns:

  • Sequence[Bucket]

    Decimated data representing the provided numerical expression computed over the provided time range

  • NOTE ( Sequence[Bucket] ) –

    it is not a safe guarantee that the number of buckets returned is the same as the number requested