@cryptotaxi247 / netdata-1 / commits / ab85abbdb

Use only stock configuration filenames as module names (#11400)

Vladimir Kobal committed Aug 5, 2021 at 09:39 UTC ab85abbdb3aadabf8f7abcf0249490cc96509ae5
1 file changed +11 -6
collectors/statsd.plugin/statsd.c
+11 -6
@@ -196,13 +196,13 @@ typedef struct statsd_app_chart_dimension {
196 } STATSD_APP_CHART_DIM;
197
198 typedef struct statsd_app_chart {
199 - const char *source;
199 const char *id;
200 const char *name;
201 const char *title;
202 const char *family;
203 const char *context;
204 const char *units;
205 + const char *module;
206 long priority;
207 RRDSET_TYPE chart_type;
208 STATSD_APP_CHART_DIM *dimensions;
@@ -1214,10 +1214,15 @@ static int statsd_readfile(const char *filename, STATSD_APP *app, STATSD_APP_CHA
1214 chart->next = app->charts;
1215 app->charts = chart;
1216
1217 - {
1218 - char lineandfile[FILENAME_MAX + 1];
1219 - snprintfz(lineandfile, FILENAME_MAX, "%zu@%s", line, filename);
1220 - chart->source = strdupz(lineandfile);
1217 + if (!strncmp(
1218 + filename,
1219 + netdata_configured_stock_config_dir,
1220 + strlen(netdata_configured_stock_config_dir))) {
1221 + char tmpfilename[FILENAME_MAX + 1];
1222 + strcpy(tmpfilename, filename);
1223 + chart->module = strdupz(basename(tmpfilename));
1224 + } else {
1225 + chart->module = strdupz("synthetic_chart");
1226 }
1227 }
1228 }
@@ -1996,7 +2001,7 @@ static inline void statsd_update_app_chart(STATSD_APP *app, STATSD_APP_CHART *ch
2001 , chart->title // title
2002 , chart->units // units
2003 , PLUGIN_STATSD_NAME // plugin
1999 - , chart->source // module
2004 + , chart->module // module
2005 , chart->priority // priority
2006 , statsd.update_every // update every
2007 , chart->chart_type // chart type