[Hawkular-dev] gohawk - need Go code to write to H-Metrics
Michael Burman
miburman at redhat.com
Mon Oct 17 02:56:47 EDT 2016
Hi,
I'm not sure why I write documentation ;)
" Writing datapoints" section says:
err := c.Write([]MetricHeader{header})
So just use c.Write(yourMetricHeaderArray). If you initialized with
correct settings (from the "Initialization " part) with
NewHawkularClient(), you don't need to do anything else. SSL settings
are provided by giving &tls.Config to it (standard way in Golang to set
TLS settings).
Unit test with TLS:
https://github.com/hawkular/hawkular-client-go/blob/master/metrics/client_test.go#L267
And almost every unit test uses Write in client_test.go. Remember
there's internal pooling in the Golang client, so if you need
concurrency, don't be afraid to spawn goroutines and let the client take
care of the concurrency limits to the server (adjustable with Parameters
in initialization).
- Micke
On 10/17/2016 08:19 AM, John Mazzitelli wrote:
> I am close to having GoHawk [1] be able to take flight :) He's still a fledgling, not quite ready to leave the nest yet.. but close. I could even demo what I got if some folks are interested in learning how GoHawk is configured (YAML!!!), seeing it react to changes to an Open Shift node environment on the fly, collecting Prometheus data, and mock-storing the metrics to h-Metrics.
>
> BUT! Right now I'm at the point where I need code that writes data to Hawkular Metrics from a Go client. Anyone have code that shows how to do this? This isn't code that QUERIES the H-Metrics for existing metric data - it is code that WRITES metrics to Hawkular Metrics. I already have a array of MetricHeader objects ([]metrics.MetricHeader) - I just need code that builds up the HTTP request and sends it (including any encryption/credential parameters/settings required?).
>
> [1] https://github.com/jmazzitelli/gohawk
> _______________________________________________
> hawkular-dev mailing list
> hawkular-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hawkular-dev
More information about the hawkular-dev
mailing list