Adding the @view annotation to SPL operators

In order to be able to analyze streaming data in external programs, you must add the @view annotation to at least one operator in your SPL application.

Procedure

In any text-based editor, you add the annotation directly in your SPL application code. The @view annotation can be added to any composite or primitive operator other than an Import or Export operator. It must appear in the set of annotations immediately preceding an operator invocation.

Example

A simple application that creates a view when the SPL application is run:
The following example application specifies a Beacon operator that outputs a tuple with a single count attribute x every second. The Custom operator passes data through, and the FileSink operator stores the output. The @view annotation is applied to the Custom operator and creates a view called analyticsview, with a sample rate (sampleSize) of five tuples per second and containing (bufferSize) up to the last 10 tuples sampled. The output port is Analytics.
namespace application ;
composite Mycomp {
	graph
		stream<int32 x> Input = Beacon(){
			param
				period : 1.0 ; // generate 1 per second
			output
				Input : x =(int32) IterationCount() ;
		}
		@view(name = "analyticsview", port = Analytics, sampleSize = 5, bufferSize = 10)
		stream<Input> Analytics = Custom(Input){
			logic
				onTuple Input :
				{
				// pretend analytics
					submit(Input, Analytics) ;
				}
		}

		() as Output = FileSink(Analytics){
			param
				file : "output.dat" ;
				writePunctuations : true ;
				writeStateHandlerCallbacks : true;
				truncateOnReset : false;
				flush : 1u ;
		}

}

What to do next

When the application is submitted as a job the view will either start automatically, or start after an external program makes the first data request, depending on how you specified the view elements.