Git Product home page Git Product logo

xk6-loki's Introduction

xk6-loki

A k6 extension for pushing logs to Loki.

Getting started

  1. Install xk6

    go install go.k6.io/xk6/cmd/xk6@latest
  2. Checkout grafana/xk6-loki

    git clone https://github.com/grafana/xk6-loki
    cd xk6-loki
  3. Build the extension

    make k6

Javascript API

Module k6/x/loki

The k6/x/loki module contains the Loki extension to interact with the Loki API. To import the module add

import loki from 'k6/x/loki';

on top of your test file.

Class Config(url, [timeout, ratio, cardinality, labels])

The class Config holds configuration for the Loki client. The constructor takes the following arguments:

argument type description default
url string The full URL to Loki in format [${scheme}://][${tenant}[:${token}]]@${host}[:${port}] -
timeout integer Request timeout in milliseconds, e.g. 10000 for 10s 10000
ratio float The ratio between JSON and Protobuf encoded batch requests for pushing logs
Must be a number between (including) 0 (100% JSON) and 1 (100% Protobuf)
This is only relevant for write scenarios.
0.9
cardinality object The cardinality (unique values) for labels, where the object key is the name of the label and the value is the maximum amount of different values it may have. null
labels Labels A Labels object that contains custom label definitions. null

Example:

import loki from 'k6/x/loki';
let conf = loki.Config("localhost:3100");

Class Labels(labels)

The class Labels allows the definition of custom labels that can be used instead of the built-in labels. An instance of this class can be passed as fifth argument to the loki.Config constructor.

argument type description default
labels object An object of type string (label name) to list of strings (possibel label values). -

Example:

import loki from 'k6/x/loki';
let labels = loki.Labels({
  "format": ["json", "logfmt"], // must contain at least one of the supported log formats
  "cluster": ["prod-us-east-0", "prod-eu-west-1"],
  "namespace": ["dev", "staging", "prod"],
  "container": ["nginx", "app-1", "app-2", "app-3"]
});

Class Client(config)

The class Client is a Loki client that can read from and write to a Loki instance. The constructor takes the following arguments:

argument type description default
config object An instance of Config which holds the configuration for the client. -

Example:

import loki from 'k6/x/loki';
let conf = loki.Config("localhost:3100");
let client = loki.Client(conf);

Method client.push()

This function is a shortcut for client.pushParameterized(5, 800*1024, 1024*1024).

Method client.pushParameterized(streams, minSize, maxSize)

Execute a push request (POST /loki/api/v1/push).

The function pushParameterized generates batch of logs and pushes it to the Loki instance. A batch consists of one or more streams which hold multiple log lines. A stream is a set of log lines with a unique set of labels.

argument type description default
streams integer The amount of streams the pushed batch should contain. -
minSize integer Minimum size in bytes of the raw log lines of the batch. -
maxSize integer Maximum size in bytes of the raw log lines of the batch. -

minSize and maxSize define the boundaries for a random value of the actual batch size.

Method client.instantQuery(query, limit)

This function is a shortcut for client.instantQueryAt(query, limit, time.Now()) where time.Now() is the current nanosecond.

Method client.instantQueryAt(query, limit, instant)

Execute an instant query (GET /loki/api/v1/query).

argument type description default
query string The LogQL query to perform. -
limit integer Maxiumum number of entries to return. -
instant integer Nanosecond at which to execute query. -

Method client.rangeQuery(query, duration, limit)

This function is a shortcut for client.rangeQueryAt(query, duration, limit, time.Now()) where time.Now() is the current nanosecond.

Method client.rangeQueryAt(query, duration, limit, instant)

Execute a range query (GET /loki/api/v1/query_range).

argument type description default
query string The LogQL query to perform. -
duration string The time span of the range, e.g. 15m, 1h, or 7d. -
limit integer Maxiumum number of entries to return. -
instant integer Nanosecond at which to execute query. -

duration defines the range for the query and uses the current timestamp as end and current timestamp - duration as start.

Method client.labelsQuery(duration)

This function is a shortcut for client.labelsQueryAt(duration, time.Now()) where time.Now() is the current nanosecond.

Method client.labelsQueryAt(duration, instant)

Execute a labels query (GET /loki/api/v1/labels).

argument type description default
duration string The time span for which labels should be returned, e.g. 15m, 1h, or 7d. -
instant integer Nanosecond at which to execute query. -

duration defines the range for the query and uses the current timestamp as end and current timestamp - duration as start.

Method client.labelValuesQuery(label, duration)

This function is a shortcut for client.labelValuesQueryAt(label, duration, time.Now()) where time.Now() is the current nanosecond.

Method client.labelValuesQueryAt(label, duration, instant)

Execute a label values query (GET /loki/api/v1/label//values).

argument type description default
label string The label name for which to query the values. -
duration string The time span for which label values should be returned, e.g. 15m, 1h, or 7d. -
instant integer Nanosecond at which to execute query. -

duration defines the range for the query and uses the current timestamp as end and current timestamp - duration as start.

Method client.seriesQuery(matchers, duration)

This function is a shortcut for client.seriesQueryAt(matchers, duration, time.Now()) where time.Now() is the current nanosecond.

Method client.seriesQueryAt(matchers, duration, instant)

Execute a series query (GET /loki/api/v1/series).

argument type description default
matchers list A list of label matchers used for the query. -
duration string The time span for which the matching series should be returned, e.g. 15m, 1h, or 7d. -
instant integer Nanosecond at which to execute query. -

duration defines the range for the query and uses the current timestamp as end and current timestamp - duration as start.

Labels

xk6-loki uses the following built-in label names for generating streams:

name values notes
instance fixed: 1 per k6 worker
format fixed: apache_common, apache_combined, apache_error, rfc3164, rfc5424, json, logfmt This label defines how the log lines of a stream are formatted.
os fixed: darwin, linux, windows -
namespace variable 1
app variable 1
pod variable 1
language variable 1
word variable 1

The total amount of different streams is defined by the carthesian product of all label values. Keep in mind that high cardinality impacts the performance of the Loki instance.

Custom labels

Additionally, xk6-loki also supports custom labels that can be used instead of the built-in labels.

See examples/custom-labels.js for a full example with custom labels.

Metrics

The extension collects metrics that are printed in the end-of-test summary in addition to the built-in metrics.

Query metrics

These metrics are collected only for instant and range queries.

name description
loki_bytes_processed_per_second amount of bytes processed by Loki per second
loki_bytes_processed_total total amount of bytes processed by Loki
loki_lines_processed_per_second amount of lines processed by Loki per second
loki_lines_processed_total total amount of lines processed by Loki

Write metrics

name description
loki_client_uncompressed_bytes the quantity of uncompressed log data pushed to Loki, in bytes
loki_client_lines the number of log lines pushed to Loki

Example

import sleep from 'k6';
import loki from 'k6/x/loki';

/**
 * URL used for push and query requests
 * Path is automatically appended by the client
 * @constant {string}
 */
const BASE_URL = `http://localhost:3100`;

/**
 * Client timeout for read and write in milliseconds
 * @constant {number}
 */
const timeout = 5000;

/**
 * Ratio between Protobuf and JSON encoded payloads when pushing logs to Loki
 * @constant {number}
 */
const ratio = 0.5;

/**
 * Cardinality for labels
 * @constant {object}
 */
const cardinality = {
  "app": 5,
  "namespace": 5
};

/**
 * Execution options
 */
export const options = {
  vus: 10,
  iterations: 10,
};

/**
 * Create configuration object
 */
const conf = new loki.Config(BASE_URL, timeout, ratio, cardinality);

/**
 * Create Loki client
 */
const client = new loki.Client(conf);

export default () => {
  // Push a batch of 2 streams with a payload size between 500KB and 1MB
  let res = client.pushParameterized(2, 512 * 1024, 1024 * 1024);
  // A successful push request returns HTTP status 204
  check(res, { 'successful write': (res) => res.status == 204 });
  sleep(1);
}
./k6 run examples/simple.js

You can find more examples in the examples/ folder.

Footnotes

  1. The amount of values can be defined in cardinality argument of the client configuration. 2 3 4 5

xk6-loki's People

Contributors

chaudum avatar dannykopping avatar kavirajk avatar lucasmellos avatar marc-sensenich avatar mstoykov avatar na-- avatar olegbespalov avatar oysteinhagenpettersen avatar vlad-diachenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xk6-loki's Issues

Protobuf encoding breaks in Go 1.18

When running the write scenario using Go 1.18 it fails when it is creating a Protobuf message.

# ratio set to 1, no problem
const conf = new loki.Config(BASE_URL, 10000, 1, labelCardinality);
# any ratio below 1 wil crash sooner or later
const conf = new loki.Config(BASE_URL, 10000, 0.1, labelCardinality);

error.txt

Add documentation

The documentation should cover the different configuration options as well as example workload test files.

Fixed labels' number is always 1

Hi Team,
I am running K6 with script below:
script

This limits the number of variable label app, namespace and pod to 1 (default is 5, 10 and 50 per the code), but should not affect format and os. However, from grafana label browser, all labels are set to 1:
labels

May I know what I missed in the cardinality map?

Configure CI/CD

it's necessary to configure Github Actions to release xk6-loki binary.

AC:

  • release process must be triggered automatically once the branch is tagged with the release tag.
  • binary must be available to download
  • version 1.0.0 must be released

k6 panic if pushParameterized minSize>maxSize

Running

import loki from "k6/x/loki"

const conf = new loki.Config("https://somewhere.com", 20000, 1.0, { one: 1 });
const client = new loki.Client(conf);

export default function() {
  client.pushParameterized(1, 1000, 1000);
};

panics. But it should likely just be a js exception.

loki_distributor_lines_received_total are not equal to loki_client_lines

I am using Grafana xk6 to do the writing loading test.
The metrics loki_distributor_lines_received_total exposed by Loki Distributors are not equal to loki_client_lines exposed by xk6.

P.S there is not any error in Loki components
My Javascript

import { check, fail } from 'k6';
import loki from 'k6/x/loki';

const HOST = "localhost:3100";

const TENANT_ID = "my_org_id"

const BASE_URL = `${TENANT_ID}@${HOST}`;

const KB = 1024;
const MB = KB * KB;

const labelCardinality = {
  "app": 1,
  "namespace": 1,
};
const timeout = 10000; // 10s
const ratio = 0.9; // 90% Protobuf
const conf = new loki.Config(BASE_URL, timeout, ratio, labelCardinality);
const client = new loki.Client(conf);

/**
 * Entrypoint for write scenario
 */
export function write() {
  let streams = randomInt(10, 10);
  let res = client.pushParameterized(streams, 1 * MB, 2 * MB);
  check(res,
    {
      'successful write': (res) => {
        let success = res.status === 204;
        if (!success) console.log(res.status, res.body);
        return success;
      },
    }
  );
}

/**
 * Return a random integer between min and max including min and max
 */
function randomInt(min, max) {
  return Math.floor(Math.random() * (max - min + 1) + min);
}
./k6 run -vus 10 --duration 60s script.js

Migrate to a k6/js.modules.Module (ModulesV2)

What?

In the k6 we deprecated, the usage of the old modules API and in the middle of the process of the migration to a new ModulesV2 API.

To do that, we need to clean up the usages of the deprecated methods:

grep --exclude-dir=vendor -Ri "common.Bind" .                   
./loki.go:	return common.Bind(
./loki.go:	return common.Bind(rt, &Client{
./loki.go:	return common.Bind(rt, &config.Labels, ctxPtr)

grep --exclude-dir=vendor -ER "With(State|InitEnv|Runtime)\(" ./
./batch_test.go:	ctx = lib.WithState(ctx, state)
./batch_test.go:	ctx = lib.WithState(ctx, state)

A good starting point can be our guide Create an extension.

Why?

The traditional approach of initializing JS modules involves calling common.Bind() on any objects that need to be exposed to JS. This method has a few technical issues we want to improve and isn't flexible enough to implement new features like giving extensions access to internal k6 objects.

json iterator version issue

while running the xk6 load test with test.js on Loki server, it is throwing "go segmentation" error. Which is due to the JSON iterator version.
Right now the JSON iterator version, in go.mod file, is 1.1.10 which is not working as expected.
We have to use 1.1.12 as JSON iterator version.

I have tried to raise a PR for that but for me, it is giving "fatal: unable to access 'https://github.com/grafana/xk6-loki/': The requested URL returned error: 403".

Write test yields HTTP error 400 `at least one label pair is required per stream`

The following write test scenario

const labelCardinality = {
  "app": 5,
  "namespace": 10,
  "pod": 50,
};
const conf = new loki.Config(BASE_URL, 10000, 0.9, labelCardinality);
const client = new loki.Client(conf);

/**
 * Entrypoint for write scenario
 */
export function write() {
  let streams = randomInt(4, 8);
  let res = client.pushParametrized(streams, 800 * KB, 1 * MB);
  check(res,
    {
      'successful write': (res) => {
        let success = res.status == 204;
        if (!success) console.log("write", res.status, res.body);
        return success;
      },
    }
  );
};

regularly yields:

write 400 error at least one label pair is required per stream

Suggestion: Override `instance` label value

When running the extension as a Deployment in Kubernetes, the hostname is always a new value. This can lead to unwanted/unexpected behaviour since the instance label value of streams contains the hostname.

k6 run ends up in fatal error

Hi all,

Based on the blog post load test Grafana loki with Grafana k6 I want to load test my loki installation.
I try to use k6 with loki extension. I followed the installation guide but any test with a push method ends up with the fatal error.

$ ./k6 run ./basic_test.js

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

WARN[0001] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
  execution: local
     script: ./basic_test.js
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

WARN[0001] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
WARN[0001] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
unexpected fault address 0x0
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x465e3f]

You can find the hole go stack-trace as an attachment

I've tested it on MacOS 12.4 and Ubuntu 20.04.3 LTS (Focal Fossa) the same error on both systems.
Go-Version: go1.18.3 (both in MacOs and Ubuntu)

Am I doing something wrong? How can I solve the problem?

It is possible to query logs with the method instantQuery() but it's not possible to push any logs, neither with the push() method nor with the pushParameterized() Method.

Sample test:

import loki from 'k6/x/loki';

let conf = loki.Config("http://localhost:3100");
let client = loki.Client(conf);

export default () => {
   client.push();
};

Can't build with xk6

If you try to build this with xk6 build --with github.com/grafana/xk6-loki, like most tutorials online suggest it will fail, which blocks from installing more than one plugin with xk6-loki

For example, if I wanted to test Loki, and then remote write the results to prometheus.

invalid memory address or nil pointer dereference with default test file

Hi, this is my test file taken from https://grafana.com/docs/loki/next/clients/k6/

import loki from 'k6/x/loki';

const timeout = 5000; // ms
const conf = new loki.Config("http://127.0.0.1:3100", timeout);
const client = new loki.Client(conf);

export default () => {
   client.pushParameterized(2, 512*1024, 1024*1024);
};

however I'm getting:

❯ ./k6 run -v test.js
DEBU[0000] Logger format: TEXT
DEBU[0000] k6 version: v0.41.0 ((devel), go1.19.2, linux/amd64)

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

DEBU[0000] Resolving and reading test 'test.js'...
DEBU[0000] Loading...                                    moduleSpecifier="file:///tmp/xk6-loki/test.js" originalModuleSpecifier=test.js
DEBU[0000] 'test.js' resolved to 'file:///tmp/xk6-loki/test.js' and successfully loaded 233 bytes!
DEBU[0000] Gathering k6 runtime options...
DEBU[0000] Initializing k6 runner for 'test.js' (file:///tmp/xk6-loki/test.js)...
DEBU[0000] Detecting test type for...                    test_path="file:///tmp/xk6-loki/test.js"
DEBU[0000] Trying to load as a JS test...                test_path="file:///tmp/xk6-loki/test.js"
DEBU[0000] Babel: Transformed                            t=24.380721ms
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
WARN[0000] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
DEBU[0000] Runner successfully initialized!
DEBU[0000] Parsing CLI flags...
DEBU[0000] Consolidating config layers...
DEBU[0000] Parsing thresholds and validating config...
DEBU[0000] Initializing the execution scheduler...
DEBU[0000] Starting 1 outputs...                         component=output-manager
DEBU[0000] Starting...                                   component=metrics-engine-ingester
DEBU[0000] Started!                                      component=metrics-engine-ingester
  execution: local
     script: test.js
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

DEBU[0000] Starting the REST API server on localhost:6565
DEBU[0000] Initialization starting...                    component=engine
DEBU[0000] Starting emission of VUs and VUsMax metrics...
DEBU[0000] Start of initialization                       executorsCount=1 neededVUs=1 phase=local-execution-scheduler-init
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
DEBU[0000] Start of initialization                       executorsCount=1 neededVUs=1 phase=local-execution-scheduler-init                                                                                                                                      [61/1638]
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
WARN[0000] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
DEBU[0000] Initialized VU #1                             phase=local-execution-scheduler-init
DEBU[0000] Finished initializing needed VUs, start initializing executors...  phase=local-execution-scheduler-init
DEBU[0000] Initialized executor default                  phase=local-execution-scheduler-init
DEBU[0000] Initialization completed                      phase=local-execution-scheduler-init
DEBU[0000] Execution scheduler starting...               component=engine
DEBU[0000] Start of test run                             executorsCount=1 phase=local-execution-scheduler-run
DEBU[0000] Running setup()                               phase=local-execution-scheduler-run
DEBU[0000] Metrics processing started...                 component=engine
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
WARN[0000] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
DEBU[0000] Start all executors...                        phase=local-execution-scheduler-run
DEBU[0000] Starting executor                             executor=default startTime=0s type=per-vu-iterations
DEBU[0000] Starting executor run...                      executor=per-vu-iterations iterations=1 maxDuration=10m0s scenario=default type=per-vu-iterations vus=1
ERRO[0000] panic: runtime error: invalid memory address or nil pointer dereference
goroutine 106 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
go.k6.io/k6/js/common.RunWithPanicCatching.func1()
        go.k6.io/[email protected]/js/common/util.go:82 +0x191
panic({0x156c900, 0x2829f50})
        runtime/panic.go:884 +0x212
github.com/dop251/goja.(*Runtime).runWrapped.func1()
        github.com/dop251/[email protected]/runtime.go:2437 +0xdc
panic({0x156c900, 0x2829f50})
        runtime/panic.go:884 +0x212
github.com/dop251/goja.(*vm).try.func1()
        github.com/dop251/[email protected]/vm.go:626 +0x70f
panic({0x156c900, 0x2829f50})
        runtime/panic.go:884 +0x212
github.com/mstoykov/atlas.(*Node).ValueByKey(0x1558700?, {0x17f33cf?, 0x20?})
        github.com/mstoykov/[email protected]/atlas.go:45 +0x20
go.k6.io/k6/metrics.(*TagSet).Get(...)
        go.k6.io/[email protected]/metrics/tags.go:58
go.k6.io/k6/lib/netext/httpext.MakeRequest({0x1aa10a0, 0xc001f14c40}, 0xc002bb0c00, 0xc001deb320)
        go.k6.io/[email protected]/lib/netext/httpext/request.go:172 +0x9af
github.com/grafana/xk6-loki.(*Client).send(_, _, {_, _, _}, _)
        github.com/grafana/[email protected]/client.go:296 +0x9f4
github.com/grafana/xk6-loki.(*Client).pushBatch(_, _)
        github.com/grafana/[email protected]/client.go:264 +0x12b
github.com/grafana/xk6-loki.(*Client).PushParameterized(_, _, _, _)
        github.com/grafana/[email protected]/client.go:240 +0x1e5
reflect.Value.call({0x16e6480?, 0xc002dd1740?, 0x7f784c7ea108?}, {0x17667d4, 0x4}, {0xc00131bf40, 0x3, 0xc000c09090?})
        reflect/value.go:584 +0x8c5
reflect.Value.Call({0x16e6480?, 0xc002dd1740?, 0xc002bd5630?}, {0xc00131bf40?, 0xc002bd5678?, 0x16e6480?})
        reflect/value.go:368 +0xbc
github.com/dop251/goja.(*Runtime).wrapReflectFunc.func1({{0x1ab7878, 0xc002c6f740}, {0xc0010cedd0, 0x3, 0xd}})
        github.com/dop251/[email protected]/runtime.go:1980 +0x1da
github.com/dop251/goja.(*vm)._nativeCall(0xc002eeaa00, 0xc000d983c0, 0x3)
        github.com/dop251/[email protected]/vm.go:3233 +0x1e3
github.com/dop251/goja.call.exec(0xf0facd?, 0xc002eeaa00)
        github.com/dop251/[email protected]/vm.go:3205 +0x14d
github.com/dop251/goja.(*vm).run(0xc002eeaa00)
        github.com/dop251/[email protected]/vm.go:495 +0x8b
github.com/dop251/goja.(*baseJsFuncObject)._call(0xc0027937a0, {0xc000d8a840?, 0x1, 0x433590?}, {0x0?, 0x0}, {0x0?, 0x0?})
        github.com/dop251/[email protected]/func.go:318 +0x3f8
github.com/dop251/goja.(*arrowFuncObject).Call(0x0?, {{0x1ab81f8, 0x2882c60}, {0xc000d8a840, 0x1, 0x1}})
        github.com/dop251/[email protected]/func.go:284 +0x57
github.com/dop251/goja.AssertFunction.func1.1()
        github.com/dop251/[email protected]/runtime.go:2397 +0x74
github.com/dop251/goja.(*vm).try(0xc002eeaa00, 0x203000?)
        github.com/dop251/[email protected]/vm.go:634 +0x18a
github.com/dop251/goja.(*Runtime).runWrapped(0xc00299ee00, 0x8?)
        github.com/dop251/[email protected]/runtime.go:2441 +0x7c
github.com/dop251/goja.AssertFunction.func1({0x1ab81f8?, 0x2882c60?}, {0xc000d8a840?, 0x1?, 0x1?})
        github.com/dop251/[email protected]/runtime.go:2396 +0x92
go.k6.io/k6/js.(*VU).runFn.func2.1()
        go.k6.io/[email protected]/js/runner.go:774 +0x43
go.k6.io/k6/js/eventloop.(*EventLoop).Start(0xc00131b630, 0xc001060f30)
        go.k6.io/[email protected]/js/eventloop/eventloop.go:171 +0x1b7
go.k6.io/k6/js.(*VU).runFn.func2()
        go.k6.io/[email protected]/js/runner.go:773 +0xeb
go.k6.io/k6/js/common.RunWithPanicCatching({0x1abd620?, 0xc00051fc00?}, 0x40f6e6?, 0x1588080?)
        go.k6.io/[email protected]/js/common/util.go:86 +0x87
go.k6.io/k6/js.(*VU).runFn(0xc000d8ea80, {0x1aa10a0, 0xc001f14c40}, 0x20?, 0xc002e0ba70, 0xc000d8a820, {0xc000d8a840, 0x1, 0x1})
        go.k6.io/[email protected]/js/runner.go:772 +0x28a
go.k6.io/k6/js.(*ActiveVU).RunOnce(0xc001f14c00)
        go.k6.io/[email protected]/js/runner.go:717 +0x412
go.k6.io/k6/lib/executor.getIterationRunner.func1({0x1aa1148, 0xc001057b30}, {0x1a92360?, 0xc001f14c00?})
        go.k6.io/[email protected]/lib/executor/helpers.go:124 +0x64
go.k6.io/k6/lib/executor.PerVUIterations.Run.func5({0x1a98bc8, 0xc000d8ea80})
        go.k6.io/[email protected]/lib/executor/per_vu_iterations.go:227 +0x40a
created by go.k6.io/k6/lib/executor.PerVUIterations.Run
        go.k6.io/[email protected]/lib/executor/per_vu_iterations.go:240 +0xc29

Goja stack:
native
DEBU[0000] Executor finished successfully                executor=default startTime=0s type=per-vu-iterations
DEBU[0000] Running teardown()                            phase=local-execution-scheduler-run
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
WARN[0000] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
DEBU[0000] Metrics emission of VUs and VUsMax metrics stopped
DEBU[0000] Execution scheduler terminated                component=engine error="a panic occurred during JS execution: runtime error: invalid memory address or nil pointer dereference"
DEBU[0000] Processing metrics and thresholds after the test run has ended...  component=engine
DEBU[0000] Stopping...                                   component=metrics-engine-ingester
DEBU[0000] run: execution scheduler returned an error    component=engine error="a panic occurred during JS execution: runtime error: invalid memory address or nil pointer dereference"
DEBU[0000] Stopped!                                      component=metrics-engine-ingester
DEBU[0000] Engine run terminated cleanly

running (00m00.0s), 0/1 VUs, 0 complete and 1 interrupted iterations
default ✗ [======================================] 1 VUs  00m00.0s/10m0s  1/1 iters, 1 per VU
WARN[0000] No script iterations finished, consider making the test duration longer
DEBU[0000] Engine: Thresholds terminated                 component=engine
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
WARN[0000] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID

     data_received....................: 0 B    0 B/s
     data_sent........................: 0 B    0 B/s
     iteration_duration...............: avg=12.8ms min=12.8ms med=12.8ms max=12.8ms p(90)=12.8ms p(95)=12.8ms
     iterations.......................: 1      72.706814/s
     loki_client_lines................: 2050   149048.969421/s
     loki_client_uncompressed_bytes...: 302 kB 22 MB/s

DEBU[0000] Waiting for engine processes to finish...
DEBU[0000] Metrics processing winding down...            component=engine
DEBU[0000] Everything has finished, exiting k6!
DEBU[0000] Stopping 1 outputs...                         component=output-manager
DEBU[0000] Stopping...                                   component=metrics-engine-ingester
DEBU[0000] Stopped!                                      component=metrics-engine-ingester
ERRO[0000] a panic occurred during JS execution: runtime error: invalid memory address or nil pointer dereference

any idea why? I'm using kubectl port forward and it doesn't even seem it's trying to connect to it

Feature: Add support to k6 tags besides the group

For query and queryAt it will ideal to have some tags that could allow to analyze our response time better:

  • To allow to correlate http_req_duration with the loki_* metrics
  • To allow to group response times in different groups (pandas group-by)\

This is already possible with the http req in k6:

  const res = http.get('http://httpbin.test.k6.io/', {
    tags: {
      my_tag: "I'm a tag",
    },
  });

loki submit over otlp

We are in the process of setting up loki tempo and mimir and feeding data in via otel-collector. The data ingests via the otlp interfaces ( http or grpc ).

It would be nice to see the loki generator support submission via otlp in addition to the native loki connection. Not sure if this is in scope for the project or not

Missing released versions

This is a polite warning that the extension does not meet the k6 extension registry requirements

Currently, the extension does not have a versioned release that meets the requirements.

As stated in the About the Extensions Registry document, extensions that do not meet the registry's requirements will be de-listed.

An automatic system will be implemented soon, which checks whether the registered extensions meet the requirements and automatically de-lists the extensions that do not.

Of course, you can re-register the de-listed extension later, but in order to avoid inconvenience, it is advisable to meet the requirements.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.