Jolokia2 handles unordered mbean object name properties (#3504)

This commit is contained in:
Dylan Meissner
2017-11-27 13:43:19 -08:00
committed by Daniel Nelson
parent fb1edd5da3
commit d9e2599de7
3 changed files with 179 additions and 15 deletions

View File

@@ -127,8 +127,7 @@ func mergeTags(metricTags, outerTags map[string]string) map[string]string {
// of a Metric match the corresponding elements in a ReadResponse object
// returned by a Jolokia agent.
func metricMatchesResponse(metric Metric, response ReadResponse) bool {
if metric.Mbean != response.RequestMbean {
if !metric.MatchObjectName(response.RequestMbean) {
return false
}
@@ -136,19 +135,9 @@ func metricMatchesResponse(metric Metric, response ReadResponse) bool {
return len(response.RequestAttributes) == 0
}
for _, fullPath := range metric.Paths {
segments := strings.SplitN(fullPath, "/", 2)
attribute := segments[0]
var path string
if len(segments) == 2 {
path = segments[1]
}
for _, rattr := range response.RequestAttributes {
if attribute == rattr && path == response.RequestPath {
return true
}
for _, attribute := range response.RequestAttributes {
if metric.MatchAttributeAndPath(attribute, response.RequestPath) {
return true
}
}