You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const {
METRICS_HOST: host, // telegraf
METRICS_PORT: portStr, // 8125
METRICS_ENV: env // development
} = process.env;
if (host && portStr && env) {
const port = parseInt(portStr);
logger.info(`initializing telegraf metrics at ${host}:${port} with env: ${env}`);
return new TelegrafClient(host, port, env);
} else {
// i create mock client here in certain circumstances, not relevant here
}
// new TelegrafClient(host,port,env):
constructor(host, port, env) {
const prefix = `my-app_${env}_`;
this.client = new StatsD({
host,
port,
prefix,
telegraf: true,
errorHandler: function (error) {
console.log("Socket errors caught here: ", error);
},
});
}
Functions
Currently only trying the following:
incrementMetric(stat, tags) {
this.client.increment(stat, tags, function(error, bytes) {
//this only gets called once after all messages have been sent
if (error) {
console.error('Oh noes! There was an error:', error);
} else {
console.log('Successfully sent', bytes, 'bytes');
}
});
}
recordResponseTime(stat, endTime, startTime, tags) {
this.client.timing(stat, (endTime - startTime), 0, tags, function(error, bytes) {
//this only gets called once after all messages have been sent
if (error) {
console.error('Oh noes! There was an error:', error);
} else {
console.log('Successfully sent', bytes, 'bytes');
}
});
}
Problem
This neither fails, nor runs. I have updated my node-modules/hot-shots code with the following:
The console.log('worked!') IS reached, but at that point it's lost and unfortunately adding logs to the node.js core library under dgram doesn't actually make it's way into the code. (At least from my IDE, I wouldn't call myself a node expert, so I may be misunderstanding something).
You can also see that in the return statement of the socket, I've updated the send function so that it calls the callback. This is the only time I have been able to see the callback run.
Telegraf, grafana, influxdb, and my application are all running on the same docker network.
If I run a udp thing like: echo "foobar:1|c" | nc -u -w1 telegraf 8125 from my node application container, it functions as expected, and the information percolates to Grafana. So the e2e connection between the applications is established and working, this (seems to me at least) to be solely an issue with the client functions in hot-shots.
If you need anything else from me to help debug, please let me know, and any help is greatly appreciated! I've been banging my head against a wall for quite some time here.
The text was updated successfully, but these errors were encountered:
Apologies but I tend to be the only person responding to these, and life got in the way here for quite awhile in looking at these. Doing some catchup this weekend- is this still an issue you are interested in a response on? Thanks.
Initialization
Initialize by the following:
Functions
Currently only trying the following:
Problem
This neither fails, nor runs. I have updated my
node-modules/hot-shots
code with the following:The
console.log('worked!')
IS reached, but at that point it's lost and unfortunately adding logs to the node.js core library under dgram doesn't actually make it's way into the code. (At least from my IDE, I wouldn't call myself a node expert, so I may be misunderstanding something).You can also see that in the return statement of the socket, I've updated the send function so that it calls the callback. This is the only time I have been able to see the callback run.
Telegraf Configuration
Notes
Telegraf, grafana, influxdb, and my application are all running on the same docker network.
If I run a udp thing like:
echo "foobar:1|c" | nc -u -w1 telegraf 8125
from my node application container, it functions as expected, and the information percolates to Grafana. So the e2e connection between the applications is established and working, this (seems to me at least) to be solely an issue with the client functions in hot-shots.If you need anything else from me to help debug, please let me know, and any help is greatly appreciated! I've been banging my head against a wall for quite some time here.
The text was updated successfully, but these errors were encountered: