Steps to replicate:
Kong: 11.1
Konga: 0.9.0


Already mentioned to pantsel, this is just for tracking purposes.
This issue is affecting us a lot as we cannot update the StatsD plugin from Konga. Even worse, if someone tries to do it, they will mess up our existing configuration.
I can try making a fix but if you can give me some pointers on what to focus on, it would greatly help. I'm guessing you already know what the issue is but just in case, I've tracked it down to
https://github.com/pantsel/konga/blob/178db12a2faf28c413f67c18e629c0425d024d01/assets/js/app/plugins/edit-plugin-controller.js#L179
177 if (fields[key].value instanceof Array) {
178 // Transform to comma separated string
179 data['config.' + path] = fields[key].value.join(",")
180 }
As you can see, when dealing with an array, line 179 assumes that the array contains strings and joins them using a comma.
With StatsD, the content of the array are objects. Here is the content of the default list of metrics as described in this issue:
metrics:
type: "array"
value: Array(10)
0 :
name : "request_count"
sample_rate : 1
stat_type : "counter"
__proto__ : Object
1 : {stat_type: "timer", name: "latency"}
2 : {stat_type: "timer", name: "request_size"}
3 : {sample_rate: 1, name: "status_count", stat_type: "counter"}
4 : {stat_type: "timer", name: "response_size"}
5 : {consumer_identifier: "custom_id", name: "unique_users", stat_type: "set"}
6 : {sample_rate: 1, name: "request_per_user", consumer_identifier: "custom_id", stat_type: "counter"}
7 : {stat_type: "timer", name: "upstream_latency"}
8 : {stat_type: "timer", name: "kong_latency"}
9 : {sample_rate: 1, name: "status_count_per_user", consumer_identifier: "custom_id", stat_type: "counter"}
I'm not sure how to fix this because I don't yet understand what the konga server side is expecting to receive.
Thanks
Right, as I discussed with Pantsel on this on in a private chat these were his findings:
metrics are shown normally on my end
wait!
i checked it on my 0.10.3 node
oh man
they changed it
it is buggy as you said using Kong 0.11.1....
it's a lot more complex now
i will need time to implement a monkey patch for it
the form logic changes totally
So we will need to look at the dif in formatting between 10.3 StatsD and 11.1. @pantsel said he should be back in action in February for cracking into some konga @marckhouzam . I am not entirely sure which Konga files need investigating for the change.
To help out here I am dumping the format of the default Plugin configuration as seen in the cassandra DB(For Kong 11.2), hope this helps you with fixing the form formatting Pantsel! :)
114f003d-c15e-4ea7-be53-130de98c34ee | statsd | null |
{"host":"netdata","port":8125,"prefix":"kong",
"metrics":[
{"sample_rate":1,"name":"request_count","stat_type":"counter"},
{"name":"latency","stat_type":"timer"},
{"name":"request_size","stat_type":"timer"},
{"sample_rate":1,"name":"status_count","stat_type":"counter"},
{"name":"response_size","stat_type":"timer"},
{"consumer_identifier":"custom_id","name":"unique_users","stat_type":"set"},
{"sample_rate":1,"name":"request_per_user","consumer_identifier":"custom_id","stat_type":"counter"},
{"name":"upstream_latency","stat_type":"timer"},
{"name":"kong_latency","stat_type":"timer"},
{"sample_rate":1,"name":"status_count_per_user","consumer_identifier":"custom_id","stat_type":"counter"}
]}
| null | 2017-12-22 18:06:24.294000+0000 | True
@jeremyjpj0916 , @marckhouzam ,
this issue is fixed in v0.10.2.
Feel free to reopen if things are not working as expected.
Will test it out, currently running v 12.2 Kong so will see how it behaves if I tweak or edit the statsD objects in UI and report back.
Tested with Kong 12.2 and it works great. I like the new interface for the StatsD plugin.
Thanks for this fix!
I am running kong 13.1 and it still doesn't work.