@@ -24,7 +24,7 @@ type beanAttrValuePair struct {
2424 value interface {}
2525}
2626
27- func runCollection (collection []* domainDefinition , i * integration.Integration ) error {
27+ func runCollection (collection []* domainDefinition , i * integration.Integration , host , port string ) error {
2828 for _ , domain := range collection {
2929 var errors []error
3030 for _ , request := range domain .beans {
@@ -34,7 +34,7 @@ func runCollection(collection []*domainDefinition, i *integration.Integration) e
3434 log .Error ("Failed to retrieve metrics for request %s: %s" , requestString , err )
3535 return err
3636 }
37- if err := handleResponse (domain .eventType , request , result , i ); err != nil {
37+ if err := handleResponse (domain .eventType , request , result , i , host , port ); err != nil {
3838 errors = append (errors , err )
3939 }
4040 }
@@ -50,7 +50,7 @@ func runCollection(collection []*domainDefinition, i *integration.Integration) e
5050// handleResponse takes a response, filters out the excluded beans,
5151// sorts the responses by domain, and passes each domain off to
5252// insertDomainMetrics to populate the metric list
53- func handleResponse (eventType string , request * beanRequest , response queryResponse , i * integration.Integration ) error {
53+ func handleResponse (eventType string , request * beanRequest , response queryResponse , i * integration.Integration , host , port string ) error {
5454
5555 // Delete excluded mbeans
5656 for key := range response {
@@ -75,7 +75,7 @@ func handleResponse(eventType string, request *beanRequest, response queryRespon
7575
7676 // For each domain, create an entity and a metric set
7777 for domain , beanAttrVals := range domainsMap {
78- err := insertDomainMetrics (eventType , domain , beanAttrVals , request , i )
78+ err := insertDomainMetrics (eventType , domain , beanAttrVals , request , i , host , port )
7979 if err != nil {
8080 return err
8181 }
@@ -87,10 +87,12 @@ func handleResponse(eventType string, request *beanRequest, response queryRespon
8787// insertDomainMetrics akes a domain and a list of attr:value pairs,
8888// creates an entity and metric set for the domain, and populates the
8989// metric set for each attribute to be collected
90- func insertDomainMetrics (eventType string , domain string , beanAttrVals []* beanAttrValuePair , request * beanRequest , i * integration.Integration ) error {
90+ func insertDomainMetrics (eventType string , domain string , beanAttrVals []* beanAttrValuePair , request * beanRequest , i * integration.Integration , host , port string ) error {
9191
9292 // Create an entity for the domain
93- e , err := i .Entity (domain , "domain" )
93+ hostIDAttr := integration .NewIDAttribute ("host" , host )
94+ portIDAttr := integration .NewIDAttribute ("port" , port )
95+ e , err := i .Entity (domain , "jmx-domain" , hostIDAttr , portIDAttr )
9496 if err != nil {
9597 return err
9698 }
0 commit comments