Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loki_distributor_lines_received_total are not equal to loki_client_lines #44

Closed
Shin-Taiwan opened this issue Aug 20, 2022 · 1 comment

Comments

@Shin-Taiwan
Copy link

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
@chaudum
Copy link
Collaborator

chaudum commented Jan 17, 2023

Fixed with #54

@chaudum chaudum closed this as completed Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants