Repository: stratos Updated Branches: refs/heads/data-publisher-integration 00ed5fa8e -> 18e3fe472
http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/cep/artifacts/streamdefinitions/stream-manager-config.xml ---------------------------------------------------------------------- diff --git a/extensions/cep/artifacts/streamdefinitions/stream-manager-config.xml b/extensions/cep/artifacts/streamdefinitions/stream-manager-config.xml index 4c4c7e0..a256770 100644 --- a/extensions/cep/artifacts/streamdefinitions/stream-manager-config.xml +++ b/extensions/cep/artifacts/streamdefinitions/stream-manager-config.xml @@ -23,287 +23,289 @@ <streamManagerConfiguration xmlns="http://wso2.org/carbon/streammanager"> <!-- in-flight requests stream definitions start --> <streamDefinition name="in_flight_requests" version="1.0.0"> - <description>in-flight request count</description> - <nickName>in-flight requests</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String"/> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="in_flight_request_count" type="double"/> - </payloadData> - </streamDefinition> + <description>in-flight request count</description> + <nickName>in-flight requests</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="time_stamp" type="long"/> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="in_flight_request_count" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="gradient_in_flight_requests" version="1.0.0"> - <description>gradient of in flight request count</description> - <nickName>gradient in flight requests</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String"/> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="count" type="double"/> - </payloadData> - </streamDefinition> + <description>gradient of in flight request count</description> + <nickName>gradient in flight requests</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="count" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="average_in_flight_requests" version="1.0.0"> - <description>average of in-flight request count</description> - <nickName>average in-flight requests</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String"/> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="count" type="double"/> - </payloadData> - </streamDefinition> + <description>average of in-flight request count</description> + <nickName>average in-flight requests</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="count" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="second_derivative_in_flight_requests" version="1.0.0"> - <description>second derivative of in-flight request count</description> - <nickName>second derivative in-flight requests</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String"/> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="count" type="double"/> - </payloadData> + <description>second derivative of in-flight request count</description> + <nickName>second derivative in-flight requests</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="count" type="double"/> + </payloadData> </streamDefinition> <!-- in-flight requests stream definitions end --> <!-- cartridge agent health stats stream definitions start --> <streamDefinition name="cartridge_agent_health_stats" version="1.0.0"> - <description>agent health stats</description> - <nickName>agent health stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="member_id" type="String" /> - <property name="partition_id" type="String" /> - <property name="health_description" type="String"/> - <property name="value" type="double"/> - </payloadData> - </streamDefinition> + <description>agent health stats</description> + <nickName>agent health stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="time_stamp" type="long"/> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="member_id" type="String"/> + <property name="partition_id" type="String"/> + <property name="health_description" type="String"/> + <property name="value" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="average_load_average_stats" version="1.0.0"> - <description>average load average stats</description> - <nickName>average load average stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="average_load_average" type="double"/> - </payloadData> - </streamDefinition> + <description>average load average stats</description> + <nickName>average load average stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="average_load_average" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="average_memory_consumption_stats" version="1.0.0"> - <description>average memory consumption stats</description> - <nickName>average memory consumption stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String"/> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="average_memory_consumption" type="double"/> - </payloadData> - </streamDefinition> + <description>average memory consumption stats</description> + <nickName>average memory consumption stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="average_memory_consumption" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="gradient_load_average_stats" version="1.0.0"> - <description>gradient load average stats</description> - <nickName>gradient load average stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="gradient_load_average" type="double"/> - </payloadData> - </streamDefinition> + <description>gradient load average stats</description> + <nickName>gradient load average stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="gradient_load_average" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="gradient_memory_consumption_stats" version="1.0.0"> - <description>gradient memoryconsumption stats</description> - <nickName>gradient memoryconsumption stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="gradient_memory_consumption" type="double"/> - </payloadData> - </streamDefinition> + <description>gradient memoryconsumption stats</description> + <nickName>gradient memoryconsumption stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="gradient_memory_consumption" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="second_derivative_memory_consumption_stats" version="1.0.0"> - <description>second derivative memory consumption stats</description> - <nickName>second derivative memory consumption stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="second_derivative_memory_consumption" type="double"/> - </payloadData> - </streamDefinition> + <description>second derivative memory consumption stats</description> + <nickName>second derivative memory consumption stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="second_derivative_memory_consumption" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="second_derivative_load_average_stats" version="1.0.0"> - <description>second derivative load average stats</description> - <nickName>second derivative load average stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="second_derivative_load_average" type="double"/> - </payloadData> - </streamDefinition> + <description>second derivative load average stats</description> + <nickName>second derivative load average stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="second_derivative_load_average" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="fault_message" version="1.0.0"> - <description>fault message</description> - <nickName>fault message</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="cluster_id" type="String"/> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="member_id" type="String"/> - <property name="partition_id" type="String"/> - </payloadData> + <description>fault message</description> + <nickName>fault message</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="member_id" type="String"/> + <property name="partition_id" type="String"/> + </payloadData> </streamDefinition> <!-- cartridge agent health stats stream definitions end --> <!-- This is for member_id wise grouping--> <streamDefinition name="member_average_load_average_stats" version="1.0.0"> - <description>average load average stats</description> - <nickName>average load average stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="member_id" type="String" /> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="member_average_load_average" type="double"/> - </payloadData> - </streamDefinition> + <description>average load average stats</description> + <nickName>average load average stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="member_id" type="String"/> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="member_average_load_average" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="member_average_memory_consumption_stats" version="1.0.0"> - <description>average memory consumption stats</description> - <nickName>average memory consumption stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="member_id" type="String"/> - <property name="cluster_id" type="String"/> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="member_average_memory_consumption" type="double"/> - </payloadData> - </streamDefinition> + <description>average memory consumption stats</description> + <nickName>average memory consumption stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="member_id" type="String"/> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="member_average_memory_consumption" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="member_gradient_load_average_stats" version="1.0.0"> - <description>gradient load average stats</description> - <nickName>gradient load average stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="member_id" type="String" /> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="member_gradient_load_average" type="double"/> - </payloadData> - </streamDefinition> + <description>gradient load average stats</description> + <nickName>gradient load average stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="member_id" type="String"/> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="member_gradient_load_average" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="member_gradient_memory_consumption_stats" version="1.0.0"> - <description>gradient memoryconsumption stats</description> - <nickName>gradient memoryconsumption stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="member_id" type="String" /> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="member_gradient_memory_consumption" type="double"/> - </payloadData> - </streamDefinition> + <description>gradient memoryconsumption stats</description> + <nickName>gradient memoryconsumption stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="member_id" type="String"/> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="member_gradient_memory_consumption" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="member_second_derivative_memory_consumption_stats" version="1.0.0"> - <description>second derivative memory consumption stats</description> - <nickName>second derivative memory consumption stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="member_id" type="String" /> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="member_second_derivative_memory_consumption" type="double"/> - </payloadData> - </streamDefinition> + <description>second derivative memory consumption stats</description> + <nickName>second derivative memory consumption stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="member_id" type="String"/> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="member_second_derivative_memory_consumption" type="double"/> + </payloadData> + </streamDefinition> <streamDefinition name="member_second_derivative_load_average_stats" version="1.0.0"> - <description>second derivative load average stats</description> - <nickName>second derivative load average stats</nickName> - <metaData> - </metaData> - <correlationData> - </correlationData> - <payloadData> - <property name="member_id" type="String" /> - <property name="cluster_id" type="String" /> - <property name="cluster_instance_id" type="String"/> - <property name="network_partition_id" type="String"/> - <property name="member_second_derivative_load_average" type="double"/> - </payloadData> - </streamDefinition> + <description>second derivative load average stats</description> + <nickName>second derivative load average stats</nickName> + <metaData> + </metaData> + <correlationData> + </correlationData> + <payloadData> + <property name="member_id" type="String"/> + <property name="cluster_id" type="String"/> + <property name="cluster_instance_id" type="String"/> + <property name="network_partition_id" type="String"/> + <property name="member_second_derivative_load_average" type="double"/> + </payloadData> + </streamDefinition> </streamManagerConfiguration> http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/README.md ---------------------------------------------------------------------- diff --git a/extensions/das/README.md b/extensions/das/README.md new file mode 100644 index 0000000..00be297 --- /dev/null +++ b/extensions/das/README.md @@ -0,0 +1,10 @@ +# Apache Stratos DAS Extensions + +Apache Stratos Data Analytics Server (DAS) extensions include DAS artifacts and spark udf to run spark script. +These extensions need to be deployed manually when running DAS externally. + +Please refer below link for more information on WSO2 DAS. +https://docs.wso2.com/display/DAS300/WSO2+Data+Analytics+Server+Documentation + +Thank you for using Apache Stratos! +The Stratos Team \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/artifacts/eventreceivers/CloudControllerEventReceiver.xml ---------------------------------------------------------------------- diff --git a/extensions/das/artifacts/eventreceivers/CloudControllerEventReceiver.xml b/extensions/das/artifacts/eventreceivers/CloudControllerEventReceiver.xml new file mode 100644 index 0000000..05789db --- /dev/null +++ b/extensions/das/artifacts/eventreceivers/CloudControllerEventReceiver.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<eventReceiver name="CloudControllerEventReceiver" statistics="disable" + trace="enable" xmlns="http://wso2.org/carbon/eventreceiver"> + <from eventAdapterType="wso2event"> + <property name="events.duplicated.in.cluster">false</property> + </from> + <mapping customMapping="disable" type="wso2event"/> + <to streamName="org.apache.stratos.cloud.controller" version="1.0.0"/> +</eventReceiver> http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/artifacts/eventreceivers/HealthStatsEventReceiver.xml ---------------------------------------------------------------------- diff --git a/extensions/das/artifacts/eventreceivers/HealthStatsEventReceiver.xml b/extensions/das/artifacts/eventreceivers/HealthStatsEventReceiver.xml new file mode 100644 index 0000000..7e0a5ce --- /dev/null +++ b/extensions/das/artifacts/eventreceivers/HealthStatsEventReceiver.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<eventReceiver name="HealthStatsEventReceiver" statistics="disable" + trace="enable" xmlns="http://wso2.org/carbon/eventreceiver"> + <from eventAdapterType="wso2event"> + <property name="events.duplicated.in.cluster">false</property> + </from> + <mapping customMapping="disable" type="wso2event"/> + <to streamName="cartridge_agent_health_stats" version="1.0.0"/> +</eventReceiver> http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/artifacts/eventreceivers/RIFEventReceiver.xml ---------------------------------------------------------------------- diff --git a/extensions/das/artifacts/eventreceivers/RIFEventReceiver.xml b/extensions/das/artifacts/eventreceivers/RIFEventReceiver.xml new file mode 100644 index 0000000..b11c016 --- /dev/null +++ b/extensions/das/artifacts/eventreceivers/RIFEventReceiver.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<eventReceiver name="RIFEventReceiver" statistics="disable" + trace="enable" xmlns="http://wso2.org/carbon/eventreceiver"> + <from eventAdapterType="wso2event"> + <property name="events.duplicated.in.cluster">false</property> + </from> + <mapping customMapping="disable" type="wso2event"/> + <to streamName="in_flight_requests" version="1.0.0"/> +</eventReceiver> http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/artifacts/eventsink/cartridge_agent_health_stats.xml ---------------------------------------------------------------------- diff --git a/extensions/das/artifacts/eventsink/cartridge_agent_health_stats.xml b/extensions/das/artifacts/eventsink/cartridge_agent_health_stats.xml new file mode 100644 index 0000000..b870bc2 --- /dev/null +++ b/extensions/das/artifacts/eventsink/cartridge_agent_health_stats.xml @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<EventStoreConfiguration> + <TableSchema> + <ColumnDefinition> + <Name>time_stamp</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>LONG</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>cluster_id</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>cluster_instance_id</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>network_partition_id</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>member_id</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>partition_id</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>health_description</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>value</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>DOUBLE</Type> + </ColumnDefinition> + </TableSchema> + <Source> + <StreamId>cartridge_agent_health_stats:1.0.0</StreamId> + </Source> + <RecordStoreName>EVENT_STORE</RecordStoreName> +</EventStoreConfiguration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/artifacts/eventsink/in_flight_requests.xml ---------------------------------------------------------------------- diff --git a/extensions/das/artifacts/eventsink/in_flight_requests.xml b/extensions/das/artifacts/eventsink/in_flight_requests.xml new file mode 100644 index 0000000..d4ca48b --- /dev/null +++ b/extensions/das/artifacts/eventsink/in_flight_requests.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<EventStoreConfiguration> + <TableSchema> + <ColumnDefinition> + <Name>time_stamp</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>LONG</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>cluster_id</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>cluster_instance_id</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>network_partition_id</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>in_flight_request_count</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>DOUBLE</Type> + </ColumnDefinition> + </TableSchema> + <Source> + <StreamId>in_flight_requests:1.0.0</StreamId> + </Source> + <RecordStoreName>EVENT_STORE</RecordStoreName> +</EventStoreConfiguration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/artifacts/eventsink/org_apache_stratos_cloud_controller.xml ---------------------------------------------------------------------- diff --git a/extensions/das/artifacts/eventsink/org_apache_stratos_cloud_controller.xml b/extensions/das/artifacts/eventsink/org_apache_stratos_cloud_controller.xml new file mode 100644 index 0000000..f0dae09 --- /dev/null +++ b/extensions/das/artifacts/eventsink/org_apache_stratos_cloud_controller.xml @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<!-- + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +--> +<EventStoreConfiguration> + <TableSchema> + <ColumnDefinition> + <Name>timeStamp</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>LONG</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>memberId</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>cartridgeType</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>clusterId</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>clusterInstanceId</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>lbclusterId</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>partitionId</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>networkId</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>instanceType</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>scalingReason</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>scalingTime</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>LONG</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>isMultiTenant</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>iaas</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>status</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>hostName</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>hypervisor</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>ram</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>imageId</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>loginPort</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>INTEGER</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>osName</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>osVersion</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>osArch</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>is64bitOS</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>privateIPAddresses</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>publicIPAddresses</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + <ColumnDefinition> + <Name>allocateIPAddresses</Name> + <EnableIndexing>false</EnableIndexing> + <IsPrimaryKey>false</IsPrimaryKey> + <EnableScoreParam>false</EnableScoreParam> + <Type>STRING</Type> + </ColumnDefinition> + </TableSchema> + <Source> + <StreamId>org.apache.stratos.cloud.controller:1.0.0</StreamId> + </Source> + <RecordStoreName>EVENT_STORE</RecordStoreName> +</EventStoreConfiguration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/artifacts/eventstreams/cartridge_agent_health_stats_1.0.0.json ---------------------------------------------------------------------- diff --git a/extensions/das/artifacts/eventstreams/cartridge_agent_health_stats_1.0.0.json b/extensions/das/artifacts/eventstreams/cartridge_agent_health_stats_1.0.0.json new file mode 100644 index 0000000..ec61229 --- /dev/null +++ b/extensions/das/artifacts/eventstreams/cartridge_agent_health_stats_1.0.0.json @@ -0,0 +1,40 @@ +{ + "name": "cartridge_agent_health_stats", + "version": "1.0.0", + "nickName": "", + "description": "", + "payloadData": [ + { + "name": "time_stamp", + "type": "LONG" + }, + { + "name": "cluster_id", + "type": "STRING" + }, + { + "name": "cluster_instance_id", + "type": "STRING" + }, + { + "name": "network_partition_id", + "type": "STRING" + }, + { + "name": "member_id", + "type": "STRING" + }, + { + "name": "partition_id", + "type": "STRING" + }, + { + "name": "health_description", + "type": "STRING" + }, + { + "name": "value", + "type": "DOUBLE" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/artifacts/eventstreams/in_flight_requests_1.0.0.json ---------------------------------------------------------------------- diff --git a/extensions/das/artifacts/eventstreams/in_flight_requests_1.0.0.json b/extensions/das/artifacts/eventstreams/in_flight_requests_1.0.0.json new file mode 100644 index 0000000..8c5232a --- /dev/null +++ b/extensions/das/artifacts/eventstreams/in_flight_requests_1.0.0.json @@ -0,0 +1,28 @@ +{ + "name": "in_flight_requests", + "version": "1.0.0", + "nickName": "", + "description": "", + "payloadData": [ + { + "name": "time_stamp", + "type": "LONG" + }, + { + "name": "cluster_id", + "type": "STRING" + }, + { + "name": "cluster_instance_id", + "type": "STRING" + }, + { + "name": "network_partition_id", + "type": "STRING" + }, + { + "name": "in_flight_request_count", + "type": "DOUBLE" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/artifacts/eventstreams/org.apache.stratos.cloud.controller_1.0.0.json ---------------------------------------------------------------------- diff --git a/extensions/das/artifacts/eventstreams/org.apache.stratos.cloud.controller_1.0.0.json b/extensions/das/artifacts/eventstreams/org.apache.stratos.cloud.controller_1.0.0.json new file mode 100644 index 0000000..de1025f --- /dev/null +++ b/extensions/das/artifacts/eventstreams/org.apache.stratos.cloud.controller_1.0.0.json @@ -0,0 +1,112 @@ +{ + "name": "org.apache.stratos.cloud.controller", + "version": "1.0.0", + "nickName": "cloud.controller", + "description": "Instances booted up by the Cloud Controller", + "payloadData": [ + { + "name": "timeStamp", + "type": "LONG" + }, + { + "name": "memberId", + "type": "STRING" + }, + { + "name": "cartridgeType", + "type": "STRING" + }, + { + "name": "clusterId", + "type": "STRING" + }, + { + "name": "clusterInstanceId", + "type": "STRING" + }, + { + "name": "lbclusterId", + "type": "STRING" + }, + { + "name": "partitionId", + "type": "STRING" + }, + { + "name": "networkId", + "type": "STRING" + }, + { + "name": "instanceType", + "type": "STRING" + }, + { + "name": "scalingReason", + "type": "STRING" + }, + { + "name": "scalingTime", + "type": "LONG" + }, + { + "name": "isMultiTenant", + "type": "STRING" + }, + { + "name": "iaas", + "type": "STRING" + }, + { + "name": "status", + "type": "STRING" + }, + { + "name": "hostName", + "type": "STRING" + }, + { + "name": "hypervisor", + "type": "STRING" + }, + { + "name": "ram", + "type": "STRING" + }, + { + "name": "imageId", + "type": "STRING" + }, + { + "name": "loginPort", + "type": "INT" + }, + { + "name": "osName", + "type": "STRING" + }, + { + "name": "osVersion", + "type": "STRING" + }, + { + "name": "osArch", + "type": "STRING" + }, + { + "name": "is64bitOS", + "type": "STRING" + }, + { + "name": "privateIPAddresses", + "type": "STRING" + }, + { + "name": "publicIPAddresses", + "type": "STRING" + }, + { + "name": "allocateIPAddresses", + "type": "STRING" + } + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/artifacts/sparkscript/CCEvent ---------------------------------------------------------------------- diff --git a/extensions/das/artifacts/sparkscript/CCEvent b/extensions/das/artifacts/sparkscript/CCEvent new file mode 100644 index 0000000..b8bb6fd --- /dev/null +++ b/extensions/das/artifacts/sparkscript/CCEvent @@ -0,0 +1,18 @@ +CREATE TEMPORARY TABLE memberstatus +USING CarbonAnalytics +OPTIONS (tableName "ORG_APACHE_STRATOS_CLOUD_CONTROLLER"); + +CREATE TEMPORARY TABLE memberstatusnew +USING CarbonAnalytics +OPTIONS (tableName "CLUSTER_MEMBER_NEW", + schema "startTime String, endTime String, clusterId STRING, activatedInstanceCount INT, terminatedInstanceCount INT, activeInstanceCount INT"); + +;WITH InstanceCount as +(select clusterId, count(case when status='Active' and timeStamp > current_time(null)-60000 and timeStamp <= current_time(null) then 1 else NULL end) as activatedInstanceCount, count(case when status='Terminated' and timeStamp > current_time(null)-60000 and timeStamp <= current_time(null) then 1 else NULL end) as terminatedInstanceCount, (sum(case when status='Active' then 1 else 0 end) - sum(case when status='Terminated' then 1 else 0 end))as activeInstanceCount from memberstatus group by clusterId) +INSERT INTO table memberstatusnew select time(current_time(null)-60000),time(current_time(null)),clusterId, activatedInstanceCount, terminatedInstanceCount,activeInstanceCount from InstanceCount; + +CREATE TEMPORARY TABLE membersnew +USING CarbonAnalytics +OPTIONS (tableName "MEMBER_NEW",schema "clusterId STRING, clusterInstanceId STRING, networkId STRING, partitionId STRING, cartridgeType STRING, instanceType STRING, memberId STRING, scalingTime LONG,scalingReason STRING, timeStamp STRING"); + +INSERT INTO TABLE membersnew select clusterId,clusterInstanceId,networkId,partitionId,cartridgeType,instanceType, memberId,scalingTime,scalingReason,time(timeStamp)as timeStamp FROM memberstatus where status='Created'; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/das/pom.xml b/extensions/das/pom.xml new file mode 100644 index 0000000..d21d1be --- /dev/null +++ b/extensions/das/pom.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>stratos-extensions</artifactId> + <groupId>org.apache.stratos</groupId> + <version>4.1.1-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.stratos</groupId> + <artifactId>strats-das-extension</artifactId> + <packaging>pom</packaging> + <name>Apache Stratos - DAS Extension</name> + <description>Apache Stratos extensions for DAS.</description> + <modules> + <module>spark-udf</module> + </modules> + + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/spark-udf/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/das/spark-udf/pom.xml b/extensions/das/spark-udf/pom.xml new file mode 100644 index 0000000..ced0f0a --- /dev/null +++ b/extensions/das/spark-udf/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>strats-das-extension</artifactId> + <groupId>org.apache.stratos</groupId> + <version>4.1.1-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.stratos</groupId> + <artifactId>apache-stratos-spark-udf</artifactId> + <name>Apache Stratos - Spark UDF</name> + <description>Apache Stratos Spark UDF for DAS</description> + + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/das/spark-udf/src/main/java/org/apache/stratos/das/extension/spark/udf/TimeUDF.java ---------------------------------------------------------------------- diff --git a/extensions/das/spark-udf/src/main/java/org/apache/stratos/das/extension/spark/udf/TimeUDF.java b/extensions/das/spark-udf/src/main/java/org/apache/stratos/das/extension/spark/udf/TimeUDF.java new file mode 100644 index 0000000..0b8f408 --- /dev/null +++ b/extensions/das/spark-udf/src/main/java/org/apache/stratos/das/extension/spark/udf/TimeUDF.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.stratos.das.extension.spark.udf; + +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * Implementing UDF for implementing spark sql query related to time. + */ +public class TimeUDF { + /** + * Convert time(ms) to DateFormat + * + * @param timeStamp time in ms + * @return date as String + */ + public String time(Long timeStamp) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + Date date = new Date(timeStamp.longValue()); + return sdf.format(date); + } + + /** + * Get the current time in ms + * + * @param param + * @return + */ + public long current_time(Integer param) { + return System.currentTimeMillis(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/extensions/pom.xml ---------------------------------------------------------------------- diff --git a/extensions/pom.xml b/extensions/pom.xml index c57bc8a..07c2733 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -17,7 +17,8 @@ ~ specific language governing permissions and limitations ~ under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> <groupId>org.apache.stratos</groupId> @@ -36,6 +37,7 @@ <module>cep/stratos-cep-extension</module> <module>cep/distribution/</module> <module>load-balancer</module> + <module>das</module> </modules> </project> http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/products/stratos/modules/distribution/src/main/conf/drools/dependent-scaling.drl ---------------------------------------------------------------------- diff --git a/products/stratos/modules/distribution/src/main/conf/drools/dependent-scaling.drl b/products/stratos/modules/distribution/src/main/conf/drools/dependent-scaling.drl index 56e9164..a8102da 100644 --- a/products/stratos/modules/distribution/src/main/conf/drools/dependent-scaling.drl +++ b/products/stratos/modules/distribution/src/main/conf/drools/dependent-scaling.drl @@ -84,7 +84,9 @@ dialect "mvel" log.info("[dependency-scale] [scale-up] Partition available, hence trying to spawn an instance to scale up!" ); log.debug("[dependency-scale] [scale-up] " + " [partition] " + partitionContext.getPartitionId() + " [cluster] " + clusterId ); - delegator.delegateSpawn(partitionContext, clusterId, clusterInstanceContext.getId(), isPrimary); + long scalingTime = System.currentTimeMillis(); + String scalingReason = "Dependency scaling"; + delegator.delegateSpawn(partitionContext, clusterId, clusterInstanceContext.getId(), isPrimary,scalingReason,scalingTime); count++; } else { partitionsAvailable = false; http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/products/stratos/modules/distribution/src/main/conf/drools/mincheck.drl ---------------------------------------------------------------------- diff --git a/products/stratos/modules/distribution/src/main/conf/drools/mincheck.drl b/products/stratos/modules/distribution/src/main/conf/drools/mincheck.drl index 96b60da..4eaab2b 100755 --- a/products/stratos/modules/distribution/src/main/conf/drools/mincheck.drl +++ b/products/stratos/modules/distribution/src/main/conf/drools/mincheck.drl @@ -84,7 +84,10 @@ dialect "mvel" log.info("[min-check] Partition available, hence trying to spawn an instance to fulfil minimum count!" + " [cluster] " + clusterId); log.debug("[min-check] " + " [partition] " + partitionContext.getPartitionId() + " [cluster] " + clusterId); - delegator.delegateSpawn(partitionContext, clusterId, clusterInstanceContext.getId(), isPrimary); + long scalingTime = System.currentTimeMillis(); + String scalingReason = "Scaling up to fulfil minimum count, [Cluster Min Members] "+clusterInstanceContext.getMinInstanceCount()+" [Additional instances to be created] " + additionalInstances; + delegator.delegateSpawn(partitionContext, clusterId, clusterInstanceContext.getId(), isPrimary,scalingReason,scalingTime); + count++; } else { http://git-wip-us.apache.org/repos/asf/stratos/blob/1eeead43/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl ---------------------------------------------------------------------- diff --git a/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl b/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl index e6f8f67..3b4a916 100644 --- a/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl +++ b/products/stratos/modules/distribution/src/main/conf/drools/scaling.drl @@ -164,6 +164,10 @@ dialect "mvel" boolean partitionsAvailable = true; int count = 0; + String autoscalingReason = (numberOfRequiredInstances == numberOfInstancesReuquiredBasedOnRif)?"Scaling up due to RIF, [Predicted Value] "+rifPredictedValue+" [Threshold] "+rifThreshold:(numberOfRequiredInstances== numberOfInstancesReuquiredBasedOnMemoryConsumption)?"Scaling up due to MC, [Predicted Value] "+mcPredictedValue+" [Threshold] "+mcThreshold:"Scaling up due to LA, [Predicted Value] "+laPredictedValue+" [Threshold] "+laThreshold; + autoscalingReason += " [Number of required instances] "+numberOfRequiredInstances+" [Cluster Max Members] "+clusterMaxMembers+" [Additional instances to be created] " + additionalInstances; + + while(count != additionalInstances && partitionsAvailable){ ClusterLevelPartitionContext partitionContext = (ClusterLevelPartitionContext) partitionAlgorithm.getNextScaleUpPartitionContext(clusterInstanceContext.getPartitionCtxtsAsAnArray()); @@ -182,7 +186,8 @@ dialect "mvel" " [laPredictedValue] " + laPredictedValue + " [laThreshold] " + laThreshold); log.debug("[scale-up] " + " [partition] " + partitionContext.getPartitionId() + " [cluster] " + clusterId ); - delegator.delegateSpawn(partitionContext, clusterId, clusterInstanceContext.getId(), isPrimary); + long scalingTime = System.currentTimeMillis(); + delegator.delegateSpawn(partitionContext, clusterId, clusterInstanceContext.getId(), isPrimary,autoscalingReason,scalingTime); count++; } else {
