Skip to content

Commit

Permalink
Removing beta label from jolokia/jmx metricset
Browse files Browse the repository at this point in the history
  • Loading branch information
ruflin committed Mar 13, 2018
1 parent 3bb5cb6 commit bd38e36
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down
2 changes: 0 additions & 2 deletions metricbeat/docs/modules/jolokia.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ This file is generated! See scripts/docs_collector.py
[[metricbeat-module-jolokia]]
== Jolokia module

beta[]

This is the Jolokia module.


Expand Down
2 changes: 0 additions & 2 deletions metricbeat/docs/modules/jolokia/jmx.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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[]


Expand Down
4 changes: 2 additions & 2 deletions metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ This file is generated! See scripts/docs_collector.py
|<<metricbeat-module-http,HTTP>> |
.2+| |<<metricbeat-metricset-http-json,json>>
|<<metricbeat-metricset-http-server,server>> experimental[]
|<<metricbeat-module-jolokia,Jolokia>> beta[] |
.1+| |<<metricbeat-metricset-jolokia-jmx,jmx>> beta[]
|<<metricbeat-module-jolokia,Jolokia>> |
.1+| |<<metricbeat-metricset-jolokia-jmx,jmx>>
|<<metricbeat-module-kafka,Kafka>> beta[] |
.2+| |<<metricbeat-metricset-kafka-consumergroup,consumergroup>> beta[]
|<<metricbeat-metricset-kafka-partition,partition>> beta[]
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/jolokia/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
description: >
Jolokia module
short_config: false
release: beta
release: ga
settings: ["ssl"]
fields:
- name: jolokia
Expand Down
2 changes: 1 addition & 1 deletion metricbeat/module/jolokia/jmx/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- release: beta
- release: ga
27 changes: 13 additions & 14 deletions metricbeat/module/jolokia/jmx/jmx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -11,7 +10,6 @@ import (

var (
metricsetName = "jolokia.jmx"
debugf = logp.MakeDebug(metricsetName)
)

// init registers the MetricSet with the central registry.
Expand All @@ -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 (
Expand All @@ -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"`
Expand All @@ -72,16 +65,19 @@ 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{
BaseMetricSet: base,
mapping: mapping,
namespace: config.Namespace,
http: http,
log: log,
}, nil
}

Expand All @@ -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)
Expand All @@ -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
}

0 comments on commit bd38e36

Please sign in to comment.