-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Conversation
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", |
There was a problem hiding this comment.
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 ;-) ).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
metricbeat/module/jolokia/jmx/jmx.go
Outdated
@@ -69,16 +62,19 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { | |||
http.SetMethod("POST") | |||
http.SetBody(body) | |||
|
|||
log := logp.NewLogger(metricsetName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that there can be multiple instances of this metricset I recommend instantiating this Logger
with context about the host. For example:
log := logp.NewLogger(metricsetName).With("host", base.HostData().Host)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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", |
There was a problem hiding this comment.
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.
metricbeat/module/jolokia/jmx/jmx.go
Outdated
@@ -69,16 +62,19 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) { | |||
http.SetMethod("POST") | |||
http.SetBody(body) | |||
|
|||
log := logp.NewLogger(metricsetName) | |||
|
|||
if logp.IsDebug(metricsetName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewkroh Do we have any direct replacment method for IsDebug
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. Calling IsDebug
is mostly unnecessary when using the structured logger because the fields are lazily marshaled to a log message. And for the print and printf style methods the string formatting is not performed until after checking if the logging level is enabled. So the only performance hit is in the allocation of the slice that holds the fields.
b5cf57b
to
8c627ec
Compare
8c627ec
to
bbf63b3
Compare
@andrewkroh Ready for an other review. Changed the logging, added a Changelog entry and rebase on master. |
bbf63b3
to
64f7ce1
Compare
Rebased again. |
No description provided.