Add activity explorer siddhi app instructions
@App:name("ActivityExplorer")
+
@App:description("This applicaton will store the tracing events in the database.")
+/*
+
+Purpose:
+ This application demonstrates how to configure persist the activities recieved to the WSO2 Stream Processor and to view the relavant information when needed..
+
+Prerequisites:
+
+ 1) Add a source to the SpanStream (https://wso2.github.io/siddhi/documentation/siddhi-4.0/#source)
+
+ 2) If the activity stream does not adheres to the SpanStream definition, a similar convertion as follows can be done to the original stream to convert the content to the SpanStream
+ from originalStream
+ select "abc" as componentName, correlation_activity_id as traceId, str:concat(correlation_activity_id,timestamp) as spanId, "" as baggageItems,
+ str:concat("parent_", correlation_activity_id) as parentId, service_name as serviceName, timestamp as startTime, (timestamp + 300) as endTime,
+ str:concat("[{'meta_tenant_id':'", meta_tenant_id, "'},{'meta_http_method':'", meta_http_method, "'},]") as tags, "" as references
+ insert into SpanStream;
+
+ 3) The Spans should have a parent span. If the spans doesnt contian a parent span, the following convertion can be done to create a parent span manually if the number of child spans are known beforehand.
+ from every( e1=SpanStream) -> e2=SpanStream[e1.traceId==traceId]<3>
+ within 1 min
+ select "abc" as componentName, e1.traceId as traceId, str:concat("parent_", e1.traceId) as spanId, "" as baggageItems, "0" as parentId,
+ "parent_service" as serviceName, e1.startTime as startTime, e2[last].endTime as endTime, "[{}]" as tags, "" as references
+ insert into ParentSpanStream;
+
+ from ParentSpanStream
+ select componentName, traceId, spanId, baggageItems, parentId, serviceName, startTime, endTime, endTime - startTime as duration, tags, references as spanReferences
+ insert into SpanTable;
+
+ 4) Save this sample
+
+Executing the Sample:
+
+ 1) Start the Siddhi application by clicking on 'Run'
+
+ 2) Send events to the Siddhi app.
+
+ 3) Start dashboard runtime and view "Activity Explorer" dashboard.
+ i) Enter the relavent information in the Search gadget. And click on search.
+ ii) Select a trace by clicking on a table row in the List gadget.
+ iii) Select a span to view the data.
+ iv) Information will be displayed in the Event gadget
+
+*/
+
@Store(type='rdbms', datasource='Activity_Explorer_DB', field.length="tags:8000")
@PrimaryKey('traceId', 'spanId')
define table SpanTable (componentName string, traceId string, spanId string, baggageItems string, parentId string, serviceName string, startTime long, endTime long, duration long, tags string, spanReferences string);
