grafana / synthetic-monitoring-agent

Synthetic Monitoring Agent
https://grafana.com/docs/grafana-cloud/how-do-i/synthetic-monitoring/
Apache License 2.0
158 stars 23 forks source link

Scripted check using 'k6/net/grpc' causes panic when writing output #832

Open peterschretlen opened 4 weeks ago

peterschretlen commented 4 weeks ago

The following script will run as a k6 scripted check

import { Client, StatusOK } from 'k6/net/grpc';
import { check, sleep } from 'k6';

const client = new Client({});

export default () => {
  client.connect('grpcbin.test.k6.io:9001', {
    reflect: true
  });

  const data = { greeting: 'Bert' };
  const response = client.invoke('hello.HelloService/SayHello', data);

  console.log(response.status)

  check(response, {
    'status is OK': (r) => r && r.status === StatusOK,
  });

  console.log(JSON.stringify(response.message));

  client.close();
};

However it generates no output. There is a panic at targetMetricsCollection.Write

screenshot of the output:

image
roobre commented 3 weeks ago

The unexpected k6 panic log seems to come from k6 itself: https://github.com/grafana/k6/blob/6116f7b97cc55d7c1ee9a73c28e721c64e1d8b32/cmd/root.go#L100

However the script above does not seem to fail on latest k6.