From bd38e36ceb52df2bb5f36cacbb14be6fd44f34c4 Mon Sep 17 00:00:00 2001 From: ruflin Date: Tue, 23 Jan 2018 11:04:35 +1100 Subject: [PATCH] Removing beta label from jolokia/jmx metricset --- CHANGELOG.asciidoc | 1 + metricbeat/docs/modules/jolokia.asciidoc | 2 -- metricbeat/docs/modules/jolokia/jmx.asciidoc | 2 -- metricbeat/docs/modules_list.asciidoc | 4 +-- metricbeat/module/jolokia/_meta/fields.yml | 2 +- .../module/jolokia/jmx/_meta/fields.yml | 2 +- metricbeat/module/jolokia/jmx/jmx.go | 27 +++++++++---------- 7 files changed, 18 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 5ed49c2c092..1988cb6f951 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -240,6 +240,7 @@ https://github.com/elastic/beats/compare/v6.0.0-beta2...master[Check the HEAD di - Update prometheus dependencies to latest {pull}6333[6333] - Making the http/json metricset GA. {pull}6471[6471] - Add support for array in http/json metricset. {pull}6480[6480] +- Making the jolokia/jmx module GA. {pull}6143[6143] *Packetbeat* diff --git a/metricbeat/docs/modules/jolokia.asciidoc b/metricbeat/docs/modules/jolokia.asciidoc index b9f1cd57bd1..88a7af88092 100644 --- a/metricbeat/docs/modules/jolokia.asciidoc +++ b/metricbeat/docs/modules/jolokia.asciidoc @@ -5,8 +5,6 @@ This file is generated! See scripts/docs_collector.py [[metricbeat-module-jolokia]] == Jolokia module -beta[] - This is the Jolokia module. diff --git a/metricbeat/docs/modules/jolokia/jmx.asciidoc b/metricbeat/docs/modules/jolokia/jmx.asciidoc index 978e5d9c4d6..aa9bb948b4e 100644 --- a/metricbeat/docs/modules/jolokia/jmx.asciidoc +++ b/metricbeat/docs/modules/jolokia/jmx.asciidoc @@ -5,8 +5,6 @@ This file is generated! See scripts/docs_collector.py [[metricbeat-metricset-jolokia-jmx]] === Jolokia jmx metricset -beta[] - include::../../../module/jolokia/jmx/_meta/docs.asciidoc[] diff --git a/metricbeat/docs/modules_list.asciidoc b/metricbeat/docs/modules_list.asciidoc index 3d5ff098710..9f39f66eeb0 100644 --- a/metricbeat/docs/modules_list.asciidoc +++ b/metricbeat/docs/modules_list.asciidoc @@ -50,8 +50,8 @@ This file is generated! See scripts/docs_collector.py |<> | .2+| |<> |<> experimental[] -|<> beta[] | -.1+| |<> beta[] +|<> | +.1+| |<> |<> beta[] | .2+| |<> beta[] |<> beta[] diff --git a/metricbeat/module/jolokia/_meta/fields.yml b/metricbeat/module/jolokia/_meta/fields.yml index 84b8f267862..529544d15c3 100644 --- a/metricbeat/module/jolokia/_meta/fields.yml +++ b/metricbeat/module/jolokia/_meta/fields.yml @@ -3,7 +3,7 @@ description: > Jolokia module short_config: false - release: beta + release: ga settings: ["ssl"] fields: - name: jolokia diff --git a/metricbeat/module/jolokia/jmx/_meta/fields.yml b/metricbeat/module/jolokia/jmx/_meta/fields.yml index 8033a27f5ac..a927f3fc9f8 100644 --- a/metricbeat/module/jolokia/jmx/_meta/fields.yml +++ b/metricbeat/module/jolokia/jmx/_meta/fields.yml @@ -1 +1 @@ -- release: beta +- release: ga diff --git a/metricbeat/module/jolokia/jmx/jmx.go b/metricbeat/module/jolokia/jmx/jmx.go index 249c4dc3a70..81e13e166a3 100644 --- a/metricbeat/module/jolokia/jmx/jmx.go +++ b/metricbeat/module/jolokia/jmx/jmx.go @@ -2,7 +2,6 @@ package jmx import ( "github.com/elastic/beats/libbeat/common" - "github.com/elastic/beats/libbeat/common/cfgwarn" "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/metricbeat/helper" "github.com/elastic/beats/metricbeat/mb" @@ -11,7 +10,6 @@ import ( var ( metricsetName = "jolokia.jmx" - debugf = logp.MakeDebug(metricsetName) ) // init registers the MetricSet with the central registry. @@ -22,12 +20,8 @@ func init() { } const ( - // defaultScheme is the default scheme to use when it is not specified in - // the host config. defaultScheme = "http" - - // defaultPath is the default path to the ngx_http_stub_status_module endpoint on Nginx. - defaultPath = "/jolokia/?ignoreErrors=true&canonicalNaming=false" + defaultPath = "/jolokia/?ignoreErrors=true&canonicalNaming=false" ) var ( @@ -44,13 +38,12 @@ type MetricSet struct { mapping map[string]string namespace string http *helper.HTTP + log *logp.Logger } // New create a new instance of the MetricSet func New(base mb.BaseMetricSet) (mb.MetricSet, error) { - cfgwarn.Beta("The jolokia jmx metricset is beta") - // Additional configuration options config := struct { Namespace string `config:"namespace" validate:"required"` Mappings []JMXMapping `config:"jmx.mappings" validate:"required"` @@ -72,9 +65,11 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { http.SetMethod("POST") http.SetBody(body) + log := logp.NewLogger(metricsetName).With("host", base.HostData().Host) + if logp.IsDebug(metricsetName) { - debugf("The body for POST requests to jolokia host %v is: %v", - base.HostData().Host, string(body)) + log.Debugw("Jolokia request body", + "body", string(body), "type", "request") } return &MetricSet{ @@ -82,6 +77,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { mapping: mapping, namespace: config.Namespace, http: http, + log: log, }, nil } @@ -93,8 +89,8 @@ func (m *MetricSet) Fetch() (common.MapStr, error) { } if logp.IsDebug(metricsetName) { - debugf("The response body from jolokia host %v is: %v", - m.HostData().Host, string(body)) + m.log.Debugw("Jolokia response body", + "host", m.HostData().Host, "body", string(body), "type", "response") } event, err := eventMapping(body, m.mapping) @@ -103,7 +99,10 @@ func (m *MetricSet) Fetch() (common.MapStr, error) { } // Set dynamic namespace. - event[mb.NamespaceKey] = m.namespace + _, err = event.Put(mb.NamespaceKey, m.namespace) + if err != nil { + return nil, err + } return event, nil }