Glad you asked! A Sample Generator generates Samples… Ok, that isn’t helpful. A Sample Generator is an object in Refocus that defines how you collect Samples for a defined set of Subjects and Aspects. Creating a Sample Generator is easy and allows you to immediately stream your real-time Sample data into Refocus.
This tells the Sample Generator what Subjects you will be monitoring. You can define Subjects by EITHER passing in a list of Subject Absolute Paths into the “subjects” array OR by defining a query in the “subjectQuery” string. The “subjectQuery” is inserted in the subjects API endpoint like so
"subjectQuery": "subjects?absolutePath=NorthAmerica.UnitedStates.California.*&tags=Indigo"
Pass in a list of Aspect names you want this Sample Generator to generate.
The generator template is the logic behind the sample generators. It tells the generator how to get data and then how to transform that data into Refocus samples. You pass in the Generator Template name into the “generatorTemplate” field.
Generator Templates are written to be generic and reusable. In order to tailor the template to your specific needs, the Generator Template will define some context variables that need to be filled out. Usually, this will include fields such as URL and Credentials. Note: If the Sample Generator Template defines a context variable as “encrypted” then any values you specify for that context variable will be encrypted.
This tells us which collectors you want to use to collect your data and generate your samples. We suggest specifying at least 2 collectors so that we can automatically reassign your Sample Generator to a different collector if a collector stops unexpectedly.
POST {refocus_url}/v1/generators
{
"description": "string", // A description of the Generator.
"helpEmail": "string", // The email address where a user can go to get more help about the Generator.
"helpUrl": "string", // The url where a user can go to get more help about the generator.
"name": "string", // A unique and descriptive name for your Generator.
"subjectQuery": "string", // The query to append to GET subjects. Either specify this or "subjects" (see above for details).
"collectors": [ // List of collectors this Sample Generator should try to use.
"string1",
"string2"
],
"subjects": [ // AbsolutePaths of the subjects. Either fill in this or "subjectQuery" (see above for details).
"string"
],
"aspects": [ // List of one or more Aspects you want to collect Samples for.
"aspect1",
"aspect2"
],
"generatorTemplate": { // The name and version of the Sample Generator Template to use
"name": "string",
"version": "string" // version may include wildcard characters, ref. https://semver.org/
},
"tags": [ // An optional list of tags describing your Sample Generator
"string1",
"string2"
],
"context": {} // Specify the values for any context variables as defined by the Sample Generator Template you are using.
}