Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Bug: Konga StatsD Plugin Issue #131

Closed
jeremyjpj0916 opened this issue Nov 13, 2017 · 7 comments
Closed

Bug: Konga StatsD Plugin Issue #131

jeremyjpj0916 opened this issue Nov 13, 2017 · 7 comments
Labels

Comments

@jeremyjpj0916
Copy link
Contributor

Steps to replicate:

Kong: 11.1
Konga: 0.9.0

  1. Take any given API, enable statsD on it.
  2. Open it up leave all those defaults and set your host and save it enabled to the API.
  3. Now go to open it up, you will see the different statsD types in the metrics section

statsdstart

  1. Now don't change anything but hit submit changes and save.
  2. Now close it again, and open it back up you will see just these random [object Object] 10 times in the metrics section. Breaks the StatsD:

statsdend

Already mentioned to pantsel, this is just for tracking purposes.

@jeremyjpj0916 jeremyjpj0916 changed the title Konga StatsD Plugin Issue Bug: Konga StatsD Plugin Issue Nov 14, 2017
@marckhouzam
Copy link
Contributor

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

data['config.' + path] = fields[key].value.join(",")

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

@jeremyjpj0916
Copy link
Contributor Author

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.

@jeremyjpj0916
Copy link
Contributor Author

jeremyjpj0916 commented Jan 16, 2018

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

@pantsel pantsel added the bug label Mar 2, 2018
pantsel added a commit that referenced this issue Mar 3, 2018
@pantsel
Copy link
Owner

pantsel commented Mar 3, 2018

@jeremyjpj0916 , @marckhouzam ,

this issue is fixed in v0.10.2.

Feel free to reopen if things are not working as expected.

@pantsel pantsel closed this as completed Mar 3, 2018
@jeremyjpj0916
Copy link
Contributor Author

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.

@marckhouzam
Copy link
Contributor

Tested with Kong 12.2 and it works great. I like the new interface for the StatsD plugin.

Thanks for this fix!

@subzero112233
Copy link

I am running kong 13.1 and it still doesn't work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants