Great work Ashan. On Thu, Jul 9, 2015 at 2:39 PM, Ashan Dhananjaya <dhananjay...@gmail.com> wrote:
> Hi All, > > I was able to take the timestamp from the cartridge agent > (WSO2CEPHealthStatisticsPublisher and WSO2CEPInFlightRequestPublisher) to > CEP PayLoad definition.Git Hub commits can be found here[1], [2]. Currently > working on sending the timestamp to the RDBMS without conflicting execution > plans. > > I have included the read-me [2] file to the cep extensions how to > configure should happen for the Health Stat publishing to the RDBMS. > > [1]= > https://github.com/apache/stratos/commit/4c65e705be822fd420b4e48ebafef789c8686b76 > [2]= > https://github.com/apache/stratos/commit/e09334cd98f245a4633c992f02db2878ac24d3d0 > [3]= > https://github.com/apache/stratos/commit/5ca895ef030f6aaeba56183d982aa5ae95db9337 > > Thank You! > Best Regards, > Ashan > > On Tue, Jul 7, 2015 at 1:13 PM, Lasantha Fernando <lasantha....@gmail.com> > wrote: > >> Hi Ashan, >> >> Currently, you would not be able to get the timestamp out of the event >> unless you use a databridge agent callback. In that case, you can use >> Java code to simply get by calling event.getTimestamp(). >> >> However, if you want to use the timestamp as an attribute while doing >> processing within CEP, you would have to pass the timestamp as an >> attribute of the stream. i.e. add it as an attribute of either meta, >> correlation or payload data. Then you can use that timestamp and >> format the output event as necessary. >> >> Thanks, >> Lasantha >> >> On Tue, Jul 7, 2015 at 1:04 PM, Ashan Dhananjaya <dhananjay...@gmail.com> >> wrote: >> > Hi All, >> > >> > I applied the above patch and get the timestamp in the Input Adapter. >> The >> > formatter i used was "member_average_memory_consumption_stats:1.0.0". I >> > tried several time to get the timeStamp attribute but failed. Is there >> any >> > way to get a data which is outside in the payload? The Input stream is >> as >> > below, >> > >> > 10:40:27,757 [-] [DataBridge-Core-pool-2-thread-1] INFO TenantId=-1234 >> : >> > Input Event Adaptor : DefaultWSO2EventInputAdaptor, received >> > >> > Event{ >> > streamId='cartridge_agent_health_stats:1.0.0', >> > timeStamp=1436245827731, >> > metaData=null, >> > correlationData=null, >> > payloadData=[single-cartridge-app.my-php.php.domain, >> > single-cartridge-app-1, network-partition-1, >> > >> single-cartridge-app.my-php.php.domaina5598e2b-995f-4620-b652-e66341e24c99, >> > partition-1, memory_consumption, 20.0], >> > arbitraryDataMap={}, >> > } >> > >> > Any help will be really appreciated. >> > >> > Thank You! >> > Best Regards, >> > Ashan >> > >> > On Tue, Jul 7, 2015 at 9:32 AM, Chamila De Alwis <chami...@wso2.com> >> wrote: >> >> >> >> Hi Ashan, >> >> >> >> As I've seen from the PCA testing recently, the timestamp is added to >> >> every ThriftEvent before publishing. Are you working on PCA or the Mock >> >> IaaS? I took a look at the Mock IaaS and the >> WSO2CEPStatisticsPublisher as >> >> well, and found out that the latter indeed doesn't add the timestamp >> to the >> >> ThriftEvents. This means that the JCA also publishes Thrift Events with >> >> empty timestamp fields. >> >> >> >> Following is the simple fix for that. I've attached the patch herewith. >> >> Could you quickly verify with the patch applied build also? >> >> >> >> chamilad@chamilad-ThinkPad-T530:~/dev/stratos[master *]$ git diff >> >> diff --git >> >> >> a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/WSO2CEPStatisticsPublisher.java >> >> b/c >> >> index 653288d..f1fe426 100644 >> >> --- >> >> >> a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/WSO2CEPStatisticsPublisher.java >> >> +++ >> >> >> b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/statistics/publisher/wso2/cep/WSO2CEPStatisticsPublisher.java >> >> @@ -29,6 +29,7 @@ import >> >> org.wso2.carbon.databridge.agent.thrift.exception.AgentException; >> >> import org.wso2.carbon.databridge.commons.Event; >> >> import org.wso2.carbon.databridge.commons.StreamDefinition; >> >> >> >> +import java.util.Date; >> >> import java.util.HashMap; >> >> >> >> /** >> >> @@ -98,6 +99,7 @@ public class WSO2CEPStatisticsPublisher implements >> >> StatisticsPublisher { >> >> >> >> Event event = new Event(); >> >> event.setPayloadData(payload); >> >> + event.setTimeStamp(new Date().getTime()); >> >> event.setArbitraryDataMap(new HashMap<String, String>()); >> >> >> >> try { >> >> >> >> >> >> >> >> >> >> >> >> Regards, >> >> Chamila de Alwis >> >> Committer and PMC Member - Apache Stratos >> >> Software Engineer | WSO2 | +94772207163 >> >> Blog: code.chamiladealwis.com >> >> >> >> >> > >> > > -- -- Lahiru Sandaruwan Committer and PMC member, Apache Stratos, Senior Software Engineer, WSO2 Inc., http://wso2.com lean.enterprise.middleware phone: +94773325954 email: lahi...@wso2.com blog: http://lahiruwrites.blogspot.com/ linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146