-
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
Add Jolokia agent in proxy mode #6475
Changes from 5 commits
7dd17a3
3bbaf6c
a0c68e6
e2a13b0
a022997
14fceae
fad49cc
45a1e54
0480dbd
4da8a0c
2a53cd2
4b31ec5
120817e
37c2be9
4ddc664
430b178
7912c30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,20 @@ import "encoding/json" | |
type JMXMapping struct { | ||
MBean string | ||
Attributes []Attribute | ||
Target Target | ||
} | ||
|
||
type Attribute struct { | ||
Attr string | ||
Field string | ||
} | ||
|
||
type Target struct { | ||
Url string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. struct field Url should be URL |
||
User string | ||
Password string | ||
} | ||
|
||
// RequestBlock is used to build the request blocks of the following format: | ||
// | ||
// [ | ||
|
@@ -32,9 +39,16 @@ type Attribute struct { | |
// } | ||
// ] | ||
type RequestBlock struct { | ||
Type string `json:"type"` | ||
MBean string `json:"mbean"` | ||
Attribute []string `json:"attribute"` | ||
Type string `json:"type"` | ||
MBean string `json:"mbean"` | ||
Attribute []string `json:"attribute"` | ||
Target *TargetBlock `json:"target,omitempty"` | ||
} | ||
|
||
type TargetBlock struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exported type TargetBlock should have comment or be unexported |
||
Url string `json:"url"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. struct field Url should be URL |
||
User string `json:"user,omitempty"` | ||
Password string `json:"password,omitempty"` | ||
} | ||
|
||
func buildRequestBodyAndMapping(mappings []JMXMapping) ([]byte, map[string]string, error) { | ||
|
@@ -47,6 +61,13 @@ func buildRequestBodyAndMapping(mappings []JMXMapping) ([]byte, map[string]strin | |
MBean: mapping.MBean, | ||
} | ||
|
||
if len(mapping.Target.Url) != 0 { | ||
rb.Target = new(TargetBlock) | ||
rb.Target.Url = mapping.Target.Url | ||
rb.Target.User = mapping.Target.User | ||
rb.Target.Password = mapping.Target.Password | ||
} | ||
|
||
for _, attribute := range mapping.Attributes { | ||
rb.Attribute = append(rb.Attribute, attribute.Attr) | ||
responseMapping[mapping.MBean+"_"+attribute.Attr] = attribute.Field | ||
|
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.
exported type Target should have comment or be unexported