jolokia: run fmt
This commit is contained in:
parent
83aa86c404
commit
5e9980f263
|
@ -1,6 +1,7 @@
|
|||
package jolokia
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
@ -8,7 +9,6 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
"bytes"
|
||||
|
||||
"github.com/influxdata/telegraf"
|
||||
"github.com/influxdata/telegraf/plugins/inputs"
|
||||
|
@ -142,7 +142,6 @@ func (j *Jolokia) doRequest(req *http.Request) (map[string]interface{}, error) {
|
|||
return jsonOut, nil
|
||||
}
|
||||
|
||||
|
||||
func (j *Jolokia) prepareRequest(server Server, metric Metric) (*http.Request, error) {
|
||||
var jolokiaUrl *url.URL
|
||||
context := j.Context // Usually "/jolokia"
|
||||
|
@ -161,7 +160,7 @@ func (j *Jolokia) prepareRequest(server Server, metric Metric) (*http.Request, e
|
|||
}
|
||||
|
||||
// Add target, only in proxy mode
|
||||
if ( j.Mode == "proxy") {
|
||||
if j.Mode == "proxy" {
|
||||
|
||||
serviceUrl := fmt.Sprintf("service:jmx:rmi:///jndi/rmi://%s:%s/jmxrmi", server.Host, server.Port)
|
||||
|
||||
|
@ -217,7 +216,6 @@ func (j *Jolokia) prepareRequest(server Server, metric Metric) (*http.Request, e
|
|||
return req, nil
|
||||
}
|
||||
|
||||
|
||||
func (j *Jolokia) Gather(acc telegraf.Accumulator) error {
|
||||
servers := j.Servers
|
||||
metrics := j.Metrics
|
||||
|
@ -233,7 +231,7 @@ func (j *Jolokia) Gather(acc telegraf.Accumulator) error {
|
|||
measurement := metric.Name
|
||||
|
||||
req, err := j.prepareRequest(server, metric)
|
||||
if err != nil{
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -241,7 +239,7 @@ func (j *Jolokia) Gather(acc telegraf.Accumulator) error {
|
|||
|
||||
if err != nil {
|
||||
fmt.Printf("Error handling response: %s\n", err)
|
||||
}else {
|
||||
} else {
|
||||
|
||||
if values, ok := out["value"]; ok {
|
||||
switch t := values.(type) {
|
||||
|
|
|
@ -48,7 +48,7 @@ const empty = ""
|
|||
|
||||
var Servers = []Server{Server{Name: "as1", Host: "127.0.0.1", Port: "8080"}}
|
||||
var HeapMetric = Metric{Name: "heap_memory_usage",
|
||||
Mbean: "java.lang:type=Memory", Attribute: "HeapMemoryUsage" }
|
||||
Mbean: "java.lang:type=Memory", Attribute: "HeapMemoryUsage"}
|
||||
var UsedHeapMetric = Metric{Name: "heap_memory_usage",
|
||||
Mbean: "java.lang:type=Memory", Attribute: "HeapMemoryUsage"}
|
||||
|
||||
|
@ -117,7 +117,6 @@ func TestHttpJsonOn404(t *testing.T) {
|
|||
assert.Equal(t, 0, len(acc.Metrics))
|
||||
}
|
||||
|
||||
|
||||
// Test that the proper values are ignored or collected
|
||||
func TestHttpInvalidJson(t *testing.T) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue