Using the Dataset Class


#1

I am attempting to do some math on a detail dataset metric in a bridge trigger. The trigger runtime first told me that the Dataset class must be constructed with the ‘new’ keyword, which I have since added. However, I am now getting an error stating “Invalid arguments to constructor” when passing in the metric. Below is a raw JSON dump of the object I am working with. Can someone guide me as to what I should be passing into the Dataset() constructor:

{
	"key": {
		"type": "string",
		"value": "extrahop.com"
	},
	"value": {
		"entries": [
			{
				"freq": 10,
				"value": 226
			}
		]
	}
}

#2

The system constructs Dataset instances for your code to consume in the METRIC_RECORD_COMMIT trigger event; you can’t create your own. You can get to these through the MetricRecord.fields property, using the Topnset.lookup method to get to the specific dataset you need.