Closed jantytgat closed 3 years ago
Yes, this is focused on configuration so far.
Any ETA for the implementation of stats?
I checked in some stat types in the stats_types
branch https://github.com/chiradeep/go-nitro/tree/stats_types. The way to use them would be to use github.com/mitchellh/mapstructure
import(
lbstats "github.com/chiradeep/go-nitro/stats/lb"
"github.com/mitchellh/mapstructure"
)
stats, err = client.FindStat(Lbvserver.Type(), "fooLb")
var lstats lbstats.Lbvserverstats
err = mapstructure.WeakDecode(stats, &lstats)
The reason to use WeakDecode
would be that the JSON returned by the stats API is inconsistent in its treatment of numbers: sometimes it is "0" and sometimes it is just 1. WeakDecode
seems to nicely take care of these inconsistencies and always changes it to a number in the struct.
Let me know if this works for you. @jantytgat
Hi @chiradeep,
that appears to be working well. I guess it is due to the way Go-packages work, but it is a bit of pain to have to declare the import with a prefix when you want to configure Lbvservers as well.
Concerning the WeakDecode, I've already been in contact with Pat Patterson about the inconsistencies in the Nitro API data types. I think for my use cases, I'll stick to the returned map of data instead of decoding the map into a struct. Time will tell.
What is your expectation to merge this into the main branch?
it has been checked in at tag v13.0.76.31
I can't seem to find any structs for getting statistics out of the appliances using go-nitro. Is this something which needs to be developed yet, as there is a stats.go file describing how to get stats out of the ADC?
Cheers, Jan