Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing beta label from jolokia/jmx metricset #6143

Merged
merged 1 commit into from
Mar 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
@@ -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*

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

beta[]

This is the Jolokia module.


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


4 changes: 2 additions & 2 deletions metricbeat/docs/modules_list.asciidoc
Original file line number Diff line number Diff line change
@@ -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[]
2 changes: 1 addition & 1 deletion metricbeat/module/jolokia/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
description: >
Jolokia module
short_config: false
release: beta
release: ga
settings: ["ssl"]
fields:
- name: jolokia
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
@@ -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,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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewkroh Is this the expected use of the new logging (first time user ;-) ).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can omit host if you add it to the logger's context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

"body", string(body), "type", "request")
}

return &MetricSet{
BaseMetricSet: base,
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
}