xk6-client-prometheus-remote
    Preparing search index...

    Function Timeseries

    • Creates a Timeseries object.

      This constructor function creates a time series from a map of labels and an array of samples. Note that this takes labels as a simple object/map, unlike TimeSeries interface which uses an array.

      Parameters

      • labels: Record<string, string>

        Map of label names to values (including name for metric name)

      • samples: Sample[]

        Array of samples

      Returns TimeSeries

      A Timeseries object

      import remote from 'k6/x/remotewrite';

      const ts = remote.Timeseries(
      { __name__: 'my_metric', service: 'api' },
      [remote.Sample(42, Date.now())]
      );
      client.store([ts]);