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

    Interface MetricTemplate

    Template for generating metrics automatically with variable substitution.

    Templates allow efficient generation of many time series without JavaScript overhead. Use template variables to create dynamic label values based on series ID.

    • ${series_id} - The current series ID
    • ${series_id/N} - Series ID divided by N (integer division) - useful for creating shared label values
    • ${series_id%N} - Series ID modulo N - useful for creating cyclic patterns
    • High cardinality testing: Generate thousands of unique time series
    • Label distribution patterns: Control how labels are distributed across series
    • Performance optimization: Generate metrics in Go rather than JavaScript
    const template = {
    __name__: 'my_metric',
    series_id: '${series_id}',
    instance: 'host-${series_id}'
    };
    const template = {
    __name__: 'k6_generated_metric_${series_id/4}', // Every 4 series share same metric name
    series_id: '${series_id}', // Unique per series
    cardinality_1e1: '${series_id/10}', // Every 10 series share this label value
    cardinality_2: '${series_id%2}', // Alternates between 0 and 1
    };
    interface MetricTemplate {
        __name__: string;
        [labelName: string]: string;
    }

    Indexable

    • [labelName: string]: string

      Additional label templates. Each label can use template variables like ${series_id}, ${series_id/N}, ${series_id%N}

    Index

    Properties

    Properties

    __name__: string

    The metric name template. Use "name" as the key.