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

Enahnce metric tring #7

Open
singhharpinder opened this issue Jul 28, 2022 · 0 comments
Open

Enahnce metric tring #7

singhharpinder opened this issue Jul 28, 2022 · 0 comments

Comments

@singhharpinder
Copy link

Hello,

I want to use this repo for one of my project where i wanted to send data to statsd, which further send to grafana.
The problem here is that i want to send my own (customized) stream (or we call it ticks) to statsd.
So, for eg:- in place of

api.${metricname}.responseCode:${responseCode}|c

I want to send

applicationname.channelname.${metricname}.responsecode:${responseCode}|c

I think, for this to change, i need to update https://github.com/gsorry/newman-reporter-statsd/blob/master/lib/StatsdReporter.js file so that I can include specific metricname in collection.json and which will be picked by this.stream.write() and will not utilize following variable:

const metricname = snake(this.currItem.name);

So, the item() will look like:


 item(err, args) {
        const metricname = this.currItem.metricname; **// REMOVED name var and snake()**
        const responseCode = (this.currItem.response && this.currItem.response.code) || "0";
        const duration = (this.currItem.response && this.currItem.response.responseTime) || 0;
        const passed = 1
        if (!this.currItem.passed) {
            passed = 0
        }
        this.stream.write(`${metricname}.responseCode:${responseCode}|c`); **// REMOVED api.**
        this.stream.write(`${metricname}.duration:${duration}|c`);	   **// REMOVED api.**
        this.stream.write(`${metricname}.passed:${passed}|c`);		   **// REMOVED api.**
        console.log(`##statsd[testFinished name='${this.options.collection.name}' flowId='${this.flowId}' metricname='${metricname}' responseCode='${responseCode}' duration='${duration}' passed='${[passed]}']`);
    }

Please let me know how can i achive this ?

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

1 participant