@@ -143,7 +143,12 @@ func TestJolokia2_ObjectValues(t *testing.T) {
143143 [[jolokia2_agent.metric]]
144144 name = "object_with_key_pattern"
145145 mbean = "object_with_key_pattern:test=*"
146- tag_keys = ["test"]`
146+ tag_keys = ["test"]
147+
148+ [[jolokia2_agent.metric]]
149+ name = "ColumnFamily"
150+ mbean = "org.apache.cassandra.metrics:keyspace=*,name=EstimatedRowSizeHistogram,scope=schema_columns,type=ColumnFamily"
151+ tag_keys = ["keyspace", "name", "scope"]`
147152
148153 response := `[{
149154 "request": {
@@ -214,7 +219,20 @@ func TestJolokia2_ObjectValues(t *testing.T) {
214219 }
215220 },
216221 "status": 200
217- }]`
222+ }, {
223+ "request": {
224+ "mbean": "org.apache.cassandra.metrics:keyspace=*,name=EstimatedRowSizeHistogram,scope=schema_columns,type=ColumnFamily",
225+ "type": "read"
226+ },
227+ "value": {
228+ "org.apache.cassandra.metrics:keyspace=system,name=EstimatedRowSizeHistogram,scope=schema_columns,type=ColumnFamily": {
229+ "Value": [
230+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
231+ ]
232+ }
233+ },
234+ "status": 200
235+ }]`
218236
219237 server := setupServer (http .StatusOK , response )
220238 defer server .Close ()
@@ -730,6 +748,20 @@ func TestJolokia2_ProxyTargets(t *testing.T) {
730748 })
731749}
732750
751+ func TestFillFields (t * testing.T ) {
752+ complex := map [string ]interface {}{"Value" : []interface {}{0 , 0 , 0 , 0 , 0 , 0 , 0 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0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
755+
756+ results := map [string ]interface {}{}
757+ newPointBuilder (Metric {Name : "test" , Mbean : "complex" }, []string {"this" , "that" }, "/" ).fillFields ("" , complex , results )
758+ assert .Equal (t , map [string ]interface {}{}, results )
759+
760+ results = map [string ]interface {}{}
761+ newPointBuilder (Metric {Name : "test" , Mbean : "scalar" }, []string {"this" , "that" }, "/" ).fillFields ("" , scalar , results )
762+ assert .Equal (t , map [string ]interface {}{}, results )
763+ }
764+
733765func setupServer (status int , resp string ) * httptest.Server {
734766 return httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
735767 w .WriteHeader (http .StatusOK )
0 commit comments