├── .gitignore ├── .travis.yml ├── README.rdoc ├── core ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── ning │ │ │ └── metrics │ │ │ └── meteo │ │ │ ├── RealtimeSystem.java │ │ │ ├── binder │ │ │ ├── RealtimeSystemConfig.java │ │ │ ├── RealtimeSystemModule.java │ │ │ ├── StatementsConfig.java │ │ │ └── StreamConfig.java │ │ │ ├── esper │ │ │ ├── HoltWinters.java │ │ │ ├── HoltWintersComputer.java │ │ │ ├── HoltWintersViewFactory.java │ │ │ └── TPAggregator.java │ │ │ ├── publishers │ │ │ ├── AMQConnection.java │ │ │ ├── AMQListener.java │ │ │ ├── AMQPublisher.java │ │ │ ├── AMQPublisherConfig.java │ │ │ ├── AMQSession.java │ │ │ ├── AlertListener.java │ │ │ ├── AlertPublisherConfig.java │ │ │ ├── AreciboListener.java │ │ │ ├── AreciboPublisher.java │ │ │ ├── AreciboPublisherConfig.java │ │ │ ├── DebugListener.java │ │ │ ├── DebugPublisherConfig.java │ │ │ ├── EsperListener.java │ │ │ ├── FileListener.java │ │ │ ├── FilePublisherConfig.java │ │ │ ├── GraphiteListener.java │ │ │ ├── GraphitePublisher.java │ │ │ ├── GraphitePublisherConfig.java │ │ │ ├── OpenTSDBListener.java │ │ │ ├── OpenTSDBPublisher.java │ │ │ ├── OpenTSDBPublisherConfig.java │ │ │ ├── PublisherConfig.java │ │ │ ├── PublishersCompiler.java │ │ │ ├── ResmonListener.java │ │ │ ├── ResmonPublisher.java │ │ │ ├── ResmonPublisherConfig.java │ │ │ ├── ResourceListener.java │ │ │ └── ResourcePublisherConfig.java │ │ │ ├── server │ │ │ ├── JettyServer.java │ │ │ ├── SetupJULBridge.java │ │ │ └── resources │ │ │ │ └── StreamResource.java │ │ │ └── subscribers │ │ │ ├── AMQSubscriber.java │ │ │ ├── AMQSubscriberConfig.java │ │ │ ├── FileSubscriber.java │ │ │ ├── FileSubscriberConfig.java │ │ │ ├── JMXSubscriber.java │ │ │ ├── JMXSubscriberConfig.java │ │ │ ├── Subscriber.java │ │ │ ├── SubscriberConfig.java │ │ │ ├── SubscribersCompiler.java │ │ │ ├── TopicListener.java │ │ │ ├── UdpJsonSubscriber.java │ │ │ └── UdpJsonSubscriberConfig.java │ └── resources │ │ └── log4j.xml │ └── test │ └── java │ └── com │ └── ning │ └── metrics │ └── meteo │ ├── esper │ ├── RegularExpressionTest.java │ ├── TPAggregatorTest.java │ └── TestHoltWintersComputer.java │ ├── publishers │ ├── DummyPublisherConfig.java │ ├── TestPublishersCompiler.java │ └── TestPublishersCompilerStreamConfig.java │ └── subscribers │ └── TestSubscribersCompiler.java ├── doc └── realtime_analytics_at_ning │ ├── 2011 │ ├── 01 │ │ ├── 01 │ │ │ └── 21-27-49-frontpage.html │ │ ├── 02 │ │ │ ├── 18-18-43-ning-data-pipeline.html │ │ │ ├── 18-18-50-ning-data-pipeline-2.html │ │ │ └── 19-18-43-ning-data-pipeline-stats.html │ │ ├── 03 │ │ │ └── 18-19-47-sources-of-latency.html │ │ └── 04 │ │ │ ├── 18-19-47-optimizating-the-hard-way.html │ │ │ └── 20-19-47-optimizating-the-hard-way-3.html │ ├── 03 │ │ └── 16 │ │ │ ├── 21-31-00-brilliant-idea.html │ │ │ ├── 21-32-00-brilliant-idea-2.html │ │ │ ├── 21-42-04-how-hard-can-it-be.html │ │ │ ├── 22-07-00-qa-is-fine.html │ │ │ ├── 22-15-00-bring-it-on.html │ │ │ ├── 22-22-27-oops-1.html │ │ │ ├── 22-24-47-bug-1.html │ │ │ ├── 22-40-56-bring-it-on-2.html │ │ │ ├── 22-48-33-oops-2.2.html │ │ │ ├── 22-51-34-bug-2.html │ │ │ ├── 22-55-46-lessons-learned.html │ │ │ ├── 23-02-43-now-what.html │ │ │ ├── 23-02-58-2-esper.html │ │ │ ├── 23-02-59-final-architecture.html │ │ │ ├── 23-03-04-html_render_time.html │ │ │ ├── 23-03-05-html_render_time-2.html │ │ │ ├── 23-09-26-response_codes.html │ │ │ └── 23-09-27-response_codes-2.html │ └── 04 │ │ ├── 21 │ │ ├── 18-13-00-more-interesting-tp.html │ │ ├── 18-13-01-more-interesting-tp-2.html │ │ ├── 18-13-02-more-interesting-tp-3.html │ │ ├── 18-13-53-writing-uda-esper.html │ │ ├── 18-16-08-how-about-predicting.html │ │ └── 18-16-09-how-about-predicting-2.html │ │ ├── 22 │ │ ├── 15-38-59-holt-winters.html │ │ ├── 16-00-00-holt-winters-example.html │ │ ├── 17-01-49-hw-esper.html │ │ ├── 17-02-01-opentsdb-result.html │ │ ├── 19-02-02-opentsdb-result-2.html │ │ ├── 19-03-02-opentsdb-result-bands.html │ │ └── 19-04-02-opentsdb-result-bands-sql.html │ │ ├── 23 │ │ ├── 08-42-05-realtime-core-recap.html │ │ └── 09-00-00-demo.html │ │ └── 24 │ │ ├── 16-49-29-future-work.html │ │ ├── 16-49-35-papers.html │ │ └── 16-49-39-questions.html │ ├── LICENSE │ ├── README │ ├── images │ ├── ConfidenceBands.js.png │ ├── ConfidenceBands.orig.png │ ├── ConfidenceBands.png │ ├── HW-anomalie-cpu-3-smooth.orig.png │ ├── HW-anomalie-cpu-3-smooth.png │ ├── HW-anomalie-cpu-avg.png │ ├── HW-anomalie-cpu-exp.png │ ├── HW-anomalie-cpu-raw-zoom.js.png │ ├── HW-anomalie-cpu-raw.js.png │ ├── HW-anomalie-cpu-raw.png │ ├── HomepagePerformance.invert.png │ ├── HomepagePerformance.png │ ├── ProcessCpuTimeNormalOperationsCollector1Smoothed.png │ ├── SimpleWebServer-load.png │ ├── bon_sang.jpg │ ├── bring_it_on.big.jpg │ ├── bring_it_on.jpg │ ├── confidenceBandsPass1.png │ ├── graphite_production_test_network.invert.png │ ├── graphite_production_test_network.png │ ├── graphite_response_codes.invert.png │ ├── graphite_response_codes.png │ ├── ning-architecture-2.png │ ├── ning-architecture-3.png │ ├── ning-architecture.png │ ├── ning-logo.png │ ├── pass1_coll_jvm_gc.png │ ├── pass2_cpu_spike.png │ ├── pass2_splunk.png │ ├── prediction_demo.jpg │ ├── qa_is_fine.jpg │ ├── rt-architecture.png │ ├── vip-latent-issue.png │ ├── vip-latent.png │ └── xkcd_pie_chart.png │ ├── index.html │ ├── old_slides │ ├── 2011-01-04-19-19-47-optimizating-the-hard-way-2.markdown │ ├── 2011-03-16-22-44-19-oops-2.markdown │ ├── 2011-03-16-23-02-58-graphite.markdown │ ├── 2011-04-21-18-09-12-graphite-the-good.markdown │ ├── 2011-04-21-18-09-15-graphite-the-bad.markdown │ ├── 2011-04-22-16-00-01-holt-winters-example.markdown │ ├── 2011-04-22-18-00-00-hw-esper-avg.markdown │ ├── 2011-04-22-18-02-01-opentsdb-result.markdown │ ├── 2011-04-22-19-00-00-hw-esper-exp.markdown │ ├── 2011-04-22-19-02-01-opentsdb-result.markdown │ ├── 2011-04-22-20-00-00-opentsdb-the-good.markdown │ └── 2011-04-22-21-00-00-opentsdb-the-bad.markdown │ ├── slippy │ ├── README.mdown │ └── src │ │ ├── 2010-05-30 Example.html │ │ ├── LICENSE │ │ ├── config.dist.php │ │ ├── highlighter │ │ ├── LGPLv3.txt │ │ ├── clipboard.swf │ │ ├── help.png │ │ ├── magnifier.png │ │ ├── page_white_code.png │ │ ├── page_white_copy.png │ │ ├── printer.png │ │ ├── shBrushAS3.js │ │ ├── shBrushBash.js │ │ ├── shBrushCSharp.js │ │ ├── shBrushColdFusion.js │ │ ├── shBrushCpp.js │ │ ├── shBrushCss.js │ │ ├── shBrushDelphi.js │ │ ├── shBrushDiff.js │ │ ├── shBrushErlang.js │ │ ├── shBrushGroovy.js │ │ ├── shBrushJScript.js │ │ ├── shBrushJava.js │ │ ├── shBrushJavaFX.js │ │ ├── shBrushPerl.js │ │ ├── shBrushPhp.js │ │ ├── shBrushPlain.js │ │ ├── shBrushPowerShell.js │ │ ├── shBrushPython.js │ │ ├── shBrushRuby.js │ │ ├── shBrushScala.js │ │ ├── shBrushSql.js │ │ ├── shBrushVb.js │ │ ├── shBrushXml.js │ │ ├── shCore.css │ │ ├── shCore.js │ │ ├── shLegacy.js │ │ ├── shThemeDefault.css │ │ ├── shThemeDjango.css │ │ ├── shThemeEclipse.css │ │ ├── shThemeEmacs.css │ │ ├── shThemeFadeToGrey.css │ │ ├── shThemeMidnight.css │ │ └── shThemeRDark.css │ │ ├── index.php │ │ ├── jquery-1.4.2.min.js │ │ ├── jquery.history.js │ │ ├── repo.php │ │ ├── slippy-0.9.0.css │ │ ├── slippy-0.9.0.js │ │ ├── slippy-dark.css │ │ └── slippy-pure.css │ └── stylesheets │ ├── highlighter.css │ └── slippy-pure-big-font.css ├── netezza ├── pom.xml └── src │ └── main │ └── java │ └── com │ └── ning │ └── metrics │ └── meteo │ └── netezza │ └── subscribers │ ├── NetezzaSubscriber.java │ └── NetezzaSubscriberConfig.java └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | out 2 | .idea 3 | target 4 | *.iml 5 | *.ipr 6 | *.iws 7 | classes/* 8 | test-output/* 9 | release.properties 10 | pom.xml.releaseBackup 11 | testing 12 | tmp* 13 | s4_core-0.3.0.0/s4_core/logs 14 | s4_core-0.3.0.0/s4_apps 15 | s4_core-0.3.0.0/s4_core/lock 16 | dev/ 17 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/RealtimeSystem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo; 18 | 19 | import com.google.inject.Guice; 20 | import com.google.inject.Injector; 21 | import com.google.inject.servlet.ServletModule; 22 | import com.ning.metrics.meteo.binder.RealtimeSystemModule; 23 | import com.ning.metrics.meteo.server.JettyServer; 24 | import com.ning.metrics.meteo.subscribers.SubscribersCompiler; 25 | import com.sun.jersey.api.core.PackagesResourceConfig; 26 | import com.sun.jersey.guice.spi.container.servlet.GuiceContainer; 27 | import org.eclipse.jetty.servlet.DefaultServlet; 28 | 29 | import java.util.HashMap; 30 | 31 | public class RealtimeSystem 32 | { 33 | public static void main(final String[] args) throws Exception 34 | { 35 | final Injector injector = Guice.createInjector( 36 | new RealtimeSystemModule(), 37 | new ServletModule() 38 | { 39 | @Override 40 | protected void configureServlets() 41 | { 42 | // Static files 43 | bind(DefaultServlet.class).asEagerSingleton(); 44 | serve("/media/*").with(DefaultServlet.class); 45 | 46 | serve("*").with(GuiceContainer.class, new HashMap() 47 | { 48 | { 49 | put(PackagesResourceConfig.PROPERTY_PACKAGES, "com.ning.metrics.meteo.server.resources"); 50 | } 51 | }); 52 | } 53 | } 54 | ); 55 | 56 | final SubscribersCompiler subscribersCompiler = injector.getInstance(SubscribersCompiler.class); 57 | subscribersCompiler.startAll(); 58 | 59 | final JettyServer jetty = injector.getInstance(JettyServer.class); 60 | jetty.start(injector); 61 | 62 | Runtime.getRuntime().addShutdownHook(new Thread() 63 | { 64 | @Override 65 | public void run() 66 | { 67 | subscribersCompiler.stopAll(); 68 | jetty.stop(); 69 | } 70 | }); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/binder/RealtimeSystemConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.binder; 18 | 19 | import org.skife.config.Config; 20 | import org.skife.config.Default; 21 | 22 | public interface RealtimeSystemConfig 23 | { 24 | @Config("rt.server.ip") 25 | @Default("127.0.0.1") 26 | String getLocalIp(); 27 | 28 | @Config("rt.server.port") 29 | @Default("8080") 30 | int getLocalPort(); 31 | 32 | @Config("rt.jetty.stats") 33 | @Default("true") 34 | boolean isJettyStatsOn(); 35 | 36 | /** 37 | * @return main configuration file 38 | */ 39 | @Config(value = "rt.configFile") 40 | @Default("rt_conf.json") 41 | String getConfigurationFile(); 42 | 43 | /** 44 | * @return configuration file for the Esper engine 45 | */ 46 | @Config(value = "rt.esper.configFile") 47 | @Default("esper_conf.xml") 48 | String getEsperConfigurationFile(); 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/binder/StatementsConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.binder; 18 | 19 | import com.ning.metrics.meteo.publishers.PublisherConfig; 20 | import com.ning.metrics.meteo.subscribers.SubscriberConfig; 21 | 22 | import java.util.List; 23 | 24 | public class StatementsConfig 25 | { 26 | public List publishers; 27 | public List subscribers; 28 | public List streams; 29 | 30 | public List getPublishers() 31 | { 32 | return publishers; 33 | } 34 | 35 | public void setPublishers(List publishers) 36 | { 37 | this.publishers = publishers; 38 | } 39 | 40 | public List getSubscribers() 41 | { 42 | return subscribers; 43 | } 44 | 45 | public void setSubscribers(List subscribers) 46 | { 47 | this.subscribers = subscribers; 48 | } 49 | 50 | public List getStatements() 51 | { 52 | return streams; 53 | } 54 | 55 | public void setStatementConfigs(List statementsConfigs) 56 | { 57 | this.streams = statementsConfigs; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/binder/StreamConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.binder; 18 | 19 | import com.ning.metrics.meteo.publishers.PublisherConfig; 20 | import org.codehaus.jackson.annotate.JsonIgnore; 21 | 22 | import java.util.HashMap; 23 | import java.util.List; 24 | 25 | public class StreamConfig 26 | { 27 | public String name; 28 | public List sql; 29 | public List> routes; 30 | @JsonIgnore 31 | private List publishers; 32 | 33 | public String getName() 34 | { 35 | return name; 36 | } 37 | 38 | public void setName(String name) 39 | { 40 | this.name = name; 41 | } 42 | 43 | public List getSql() 44 | { 45 | return sql; 46 | } 47 | 48 | public void setSql(List sql) 49 | { 50 | this.sql = sql; 51 | } 52 | 53 | public List> getRoutes() 54 | { 55 | return routes; 56 | } 57 | 58 | public void setRoutes(List> routes) 59 | { 60 | this.routes = routes; 61 | } 62 | 63 | // Merge of global publishers and local overrides from routes 64 | public void setPublishers(List newRoutes) 65 | { 66 | this.publishers = newRoutes; 67 | } 68 | 69 | public List getPublishers() 70 | { 71 | return publishers; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/AMQListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.EventBean; 20 | import com.espertech.esper.client.UpdateListener; 21 | 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | 25 | class AMQListener extends EsperListener implements UpdateListener 26 | { 27 | private final AMQPublisherConfig config; 28 | private final AMQPublisher publisher; 29 | 30 | public AMQListener(final AMQPublisherConfig config) 31 | { 32 | this.config = config; 33 | this.publisher = new AMQPublisher(config); 34 | } 35 | 36 | @Override 37 | public void update(final EventBean[] newEvents, final EventBean[] oldEvents) 38 | { 39 | if (newEvents != null) { 40 | for (final EventBean newEvent : newEvents) { 41 | publisher.send(config.getPrefix(), toMap(newEvent)); 42 | } 43 | } 44 | } 45 | 46 | private static Map toMap(final EventBean bean) 47 | { 48 | final HashMap res = new HashMap(); 49 | for (final String attribute : bean.getEventType().getPropertyNames()) { 50 | res.put(attribute, bean.get(attribute)); 51 | } 52 | return res; 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/AMQPublisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import org.apache.log4j.Logger; 20 | import org.codehaus.jackson.map.ObjectMapper; 21 | 22 | import java.io.IOException; 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | 26 | class AMQPublisher 27 | { 28 | private static final Logger log = Logger.getLogger(AMQPublisher.class); 29 | private static final ObjectMapper mapper = new ObjectMapper(); 30 | 31 | private final Map sessionsPerType = new HashMap(); 32 | private final Object queueMapMonitor = new Object(); 33 | private final AMQPublisherConfig config; 34 | private final AMQConnection connection; 35 | 36 | public AMQPublisher(final AMQPublisherConfig config) 37 | { 38 | this.config = config; 39 | connection = new AMQConnection(config); 40 | } 41 | 42 | public void send(final String metric, final Map value) 43 | { 44 | try { 45 | publish(metric, value); 46 | } 47 | catch (IOException e) { 48 | log.warn("Error sending event to AMQ: " + e.getLocalizedMessage()); 49 | } 50 | } 51 | 52 | private void publish(final String eventType, final Map event) throws IOException 53 | { 54 | AMQSession session = sessionsPerType.get(eventType); 55 | 56 | if (session == null) { 57 | synchronized (queueMapMonitor) { 58 | session = sessionsPerType.get(eventType); 59 | if (session == null) { 60 | session = connection.getSessionFor(eventType, config); 61 | sessionsPerType.put(eventType, session); 62 | } 63 | } 64 | } 65 | 66 | session.send(mapper.writeValueAsBytes(event)); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/AMQPublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | class AMQPublisherConfig extends PublisherConfig 20 | { 21 | private String uri; 22 | private String prefix; 23 | private Integer messagesTTLMilliseconds; 24 | private Boolean useAsyncSend; 25 | private Boolean useBytesMessage; 26 | 27 | public String getUri() 28 | { 29 | return uri; 30 | } 31 | 32 | public void setUri(final String uri) 33 | { 34 | this.uri = uri; 35 | } 36 | 37 | public String getPrefix() 38 | { 39 | return prefix; 40 | } 41 | 42 | public void setPrefix(final String prefix) 43 | { 44 | this.prefix = prefix; 45 | } 46 | 47 | public long getMessagesTTLMilliseconds() 48 | { 49 | return messagesTTLMilliseconds; 50 | } 51 | 52 | public void setMessagesTTLMilliseconds(final Integer messagesTTLMilliseconds) 53 | { 54 | this.messagesTTLMilliseconds = messagesTTLMilliseconds; 55 | } 56 | 57 | public Boolean getUseAsyncSend() 58 | { 59 | return useAsyncSend; 60 | } 61 | 62 | public void setUseAsyncSend(final Boolean useAsyncSend) 63 | { 64 | this.useAsyncSend = useAsyncSend; 65 | } 66 | 67 | public Boolean getUseBytesMessage() 68 | { 69 | return useBytesMessage; 70 | } 71 | 72 | public void setUseBytesMessage(final Boolean useBytesMessage) 73 | { 74 | this.useBytesMessage = useBytesMessage; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/AlertListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.EventBean; 20 | import com.espertech.esper.client.UpdateListener; 21 | import org.apache.commons.mail.HtmlEmail; 22 | import org.apache.log4j.Logger; 23 | 24 | import javax.mail.internet.InternetAddress; 25 | import java.util.Arrays; 26 | 27 | class AlertListener extends EsperListener implements UpdateListener 28 | { 29 | private final static Logger log = Logger.getLogger(AlertListener.class); 30 | private final AlertPublisherConfig config; 31 | 32 | public AlertListener(AlertPublisherConfig config) 33 | { 34 | this.config = config; 35 | } 36 | 37 | @Override 38 | public void update(EventBean[] newEvents, EventBean[] oldEvents) 39 | { 40 | // TODO register esper callback which sends email -> how to specify what to look for in the event ? 41 | 42 | if (newEvents != null) { 43 | for (EventBean newEvent : newEvents) { 44 | Double result1 = (Double) newEvent.get("result1"); 45 | 46 | if (result1 != null) { 47 | createAndSendAlertEmail(String.format("Boo ! Result " + result1)); 48 | } 49 | } 50 | } 51 | } 52 | 53 | private void createAndSendAlertEmail(String body) 54 | { 55 | try { 56 | log.info(String.format("Sending alert email to [%s]: %s", config.getRecipients(), body)); 57 | 58 | HtmlEmail email = new HtmlEmail(); 59 | 60 | email.setTextMsg(body); 61 | email.setFrom("esper-is-awesome@example.com"); 62 | email.setTo(Arrays.asList(new InternetAddress(config.getRecipients()))); 63 | email.setHostName(config.getHost()); 64 | email.setSmtpPort(config.getPort()); 65 | email.send(); 66 | } 67 | catch (Exception ex) { 68 | log.warn("Could not create or send email", ex); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/AlertPublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | class AlertPublisherConfig extends PublisherConfig 20 | { 21 | private String host; 22 | private Integer port; 23 | private String recipients; 24 | 25 | public String getHost() 26 | { 27 | return host; 28 | } 29 | 30 | public void setHost(String host) 31 | { 32 | this.host = host; 33 | } 34 | 35 | public Integer getPort() 36 | { 37 | return port; 38 | } 39 | 40 | public void setPort(int port) 41 | { 42 | this.port = port; 43 | } 44 | 45 | public String getRecipients() 46 | { 47 | return recipients; 48 | } 49 | 50 | public void setRecipients(String recipients) 51 | { 52 | this.recipients = recipients; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/AreciboListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.EventBean; 20 | import com.espertech.esper.client.UpdateListener; 21 | 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | 25 | class AreciboListener extends EsperListener implements UpdateListener 26 | { 27 | private final AreciboPublisherConfig config; 28 | private final AreciboPublisher publisher; 29 | 30 | public AreciboListener(AreciboPublisherConfig config) 31 | { 32 | this.config = config; 33 | this.publisher = new AreciboPublisher(config); 34 | } 35 | 36 | @Override 37 | public void update(EventBean[] newEvents, EventBean[] oldEvents) 38 | { 39 | if (newEvents != null) { 40 | for (EventBean newEvent : newEvents) { 41 | publisher.send(config.getPrefix(), toMap(newEvent)); 42 | } 43 | } 44 | } 45 | 46 | private static Map toMap(EventBean bean) 47 | { 48 | HashMap res = new HashMap(); 49 | for (String attribute : bean.getEventType().getPropertyNames()) { 50 | res.put(attribute, bean.get(attribute)); 51 | } 52 | return res; 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/AreciboPublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | class AreciboPublisherConfig extends PublisherConfig 20 | { 21 | private String host; 22 | private Integer port; 23 | private String prefix; 24 | 25 | public Integer getPort() 26 | { 27 | return port; 28 | } 29 | 30 | public void setPort(int port) 31 | { 32 | this.port = port; 33 | } 34 | 35 | public String getHost() 36 | { 37 | return host; 38 | } 39 | 40 | public void setHost(String host) 41 | { 42 | this.host = host; 43 | } 44 | 45 | public String getPrefix() 46 | { 47 | return prefix; 48 | } 49 | 50 | public void setPrefix(String prefix) 51 | { 52 | this.prefix = prefix; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/DebugListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.EventBean; 20 | import com.espertech.esper.client.UpdateListener; 21 | import org.apache.log4j.Logger; 22 | 23 | class DebugListener extends EsperListener implements UpdateListener 24 | { 25 | private final static Logger log = Logger.getLogger(DebugListener.class); 26 | 27 | private final DebugPublisherConfig config; 28 | 29 | public DebugListener(DebugPublisherConfig config) 30 | { 31 | this.config = config; 32 | } 33 | 34 | @Override 35 | public void update(EventBean[] newEvents, EventBean[] oldEvents) 36 | { 37 | if (newEvents != null) { 38 | StringBuilder builder = new StringBuilder(); 39 | for (EventBean newEvent : newEvents) { 40 | String typeName = getEventName(newEvent); 41 | 42 | builder.setLength(0); 43 | for (String attribute : newEvent.getEventType().getPropertyNames()) { 44 | String fullName = (typeName == null ? attribute : typeName + "." + attribute); 45 | 46 | if (config.isIncluded(fullName)) { 47 | Object value = newEvent.get(attribute); 48 | 49 | builder.append("\n "); 50 | builder.append(fullName); 51 | builder.append("="); 52 | if (value == null) { 53 | builder.append("null"); 54 | } 55 | else if (value instanceof String) { 56 | builder.append('\"'); 57 | builder.append(value); 58 | builder.append('\"'); 59 | } 60 | else { 61 | builder.append(value); 62 | } 63 | } 64 | } 65 | if (builder.length() > 0) { 66 | log.info(builder.toString()); 67 | } 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/DebugPublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | class DebugPublisherConfig extends PublisherConfig 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/EsperListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.EventBean; 20 | import com.espertech.esper.client.EventPropertyDescriptor; 21 | import com.espertech.esper.event.map.MapEventType; 22 | 23 | public class EsperListener 24 | { 25 | /** 26 | * Given an Event from the Esper core engine, get its name. 27 | * This return null for UUID-based names (select statements), the specified name otherwise (named streams, e.g. insert) 28 | * 29 | * @param newEvent Event to extract the name from 30 | * @return event name if human-readable, null otherwise 31 | */ 32 | static String getEventName(EventBean newEvent) 33 | { 34 | String typeName = newEvent.getEventType().getName(); 35 | 36 | // For automatically generated event names (uuid, most likely from a select statement), the public name 37 | // is null. 38 | if (newEvent.getEventType() instanceof MapEventType) { 39 | typeName = ((MapEventType) newEvent.getEventType()).getMetadata().getPublicName(); 40 | } 41 | 42 | return typeName; 43 | } 44 | 45 | 46 | /** 47 | * Given an Event form the Esper core engine, get its timestamp 48 | * 49 | * @param newEvent Event to extract its timestamp from 50 | * @param configTimeAttribute time attribute in the publisher configuration, can be null 51 | * @return the event timestamp 52 | */ 53 | public static Long getEventMillis(EventBean newEvent, String configTimeAttribute) 54 | { 55 | Long timeInMs = null; 56 | 57 | if (configTimeAttribute != null) { 58 | EventPropertyDescriptor desc = newEvent.getEventType().getPropertyDescriptor(configTimeAttribute); 59 | 60 | if (desc != null) { 61 | Object value = newEvent.get(configTimeAttribute); 62 | 63 | if (value != null) { 64 | timeInMs = Long.parseLong(value.toString()); 65 | } 66 | } 67 | } 68 | 69 | if (timeInMs == null) { 70 | timeInMs = System.currentTimeMillis(); 71 | } 72 | 73 | return timeInMs; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/FileListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.EventBean; 20 | import com.espertech.esper.client.UpdateListener; 21 | import org.apache.log4j.Logger; 22 | 23 | import java.io.FileWriter; 24 | import java.io.IOException; 25 | import java.io.PrintWriter; 26 | 27 | class FileListener extends EsperListener implements UpdateListener 28 | { 29 | private final static Logger log = Logger.getLogger(FileListener.class); 30 | 31 | private final FilePublisherConfig config; 32 | 33 | private PrintWriter writer = null; 34 | 35 | public FileListener(FilePublisherConfig config) 36 | { 37 | this.config = config; 38 | try { 39 | if (config.getPath() == null) { 40 | throw new IOException("File path not specified!"); 41 | } 42 | 43 | writer = new PrintWriter(new FileWriter(config.getPath())); 44 | } 45 | catch (IOException e) { 46 | log.warn(String.format("Unable to write to %s, file publisher disabled", config.getPath())); 47 | } 48 | } 49 | 50 | @Override 51 | public void update(EventBean[] newEvents, EventBean[] oldEvents) 52 | { 53 | if (newEvents != null && writer != null) { 54 | StringBuilder builder = new StringBuilder(); 55 | for (EventBean newEvent : newEvents) { 56 | String typeName = getEventName(newEvent); 57 | 58 | builder.setLength(0); 59 | for (String attribute : newEvent.getEventType().getPropertyNames()) { 60 | String fullName = (typeName == null ? attribute : typeName + "." + attribute); 61 | 62 | if (config.isIncluded(fullName)) { 63 | Object value = newEvent.get(attribute); 64 | 65 | builder.append(getEventMillis(newEvent, config.getTimeAttribute())); 66 | builder.append(config.getSeparator()); 67 | builder.append(fullName); 68 | builder.append(config.getSeparator()); 69 | if (value == null) { 70 | builder.append("null"); 71 | } 72 | else if (value instanceof String) { 73 | builder.append('\"'); 74 | builder.append(value); 75 | builder.append('\"'); 76 | } 77 | else { 78 | builder.append(value); 79 | } 80 | builder.append("\n"); 81 | } 82 | } 83 | 84 | if (builder.length() > 0) { 85 | writer.print(builder.toString()); 86 | writer.flush(); 87 | } 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/FilePublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | class FilePublisherConfig extends PublisherConfig 20 | { 21 | private String path; 22 | private String separator = ","; 23 | 24 | public String getPath() 25 | { 26 | return path; 27 | } 28 | 29 | public void setPath(String path) 30 | { 31 | this.path = path; 32 | } 33 | 34 | public String getSeparator() 35 | { 36 | return separator; 37 | } 38 | 39 | public void setSeparator(String separator) 40 | { 41 | this.separator = separator; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/GraphiteListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.EventBean; 20 | import com.espertech.esper.client.UpdateListener; 21 | 22 | class GraphiteListener implements UpdateListener 23 | { 24 | private final GraphitePublisherConfig config; 25 | private final GraphitePublisher publisher; 26 | 27 | public GraphiteListener(GraphitePublisherConfig config) 28 | { 29 | this.config = config; 30 | this.publisher = new GraphitePublisher(config); 31 | 32 | publisher.failSafeConnect(); 33 | } 34 | 35 | @Override 36 | public void update(EventBean[] newEvents, EventBean[] oldEvents) 37 | { 38 | if (newEvents != null) { 39 | for (EventBean newEvent : newEvents) { 40 | for (String attribute : newEvent.getEventType().getPropertyNames()) { 41 | publisher.send(config.getPrefix() + "." + attribute, newEvent.get(attribute)); 42 | } 43 | } 44 | } 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/GraphitePublisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import org.apache.log4j.Logger; 20 | 21 | import java.io.IOException; 22 | import java.io.PrintStream; 23 | import java.net.Socket; 24 | 25 | class GraphitePublisher 26 | { 27 | private static final Logger log = Logger.getLogger(GraphitePublisher.class); 28 | 29 | private GraphitePublisherConfig config; 30 | private Socket socket; 31 | 32 | public GraphitePublisher(GraphitePublisherConfig config) 33 | { 34 | this.config = config; 35 | } 36 | 37 | public void send(String metric, Object value) 38 | { 39 | try { 40 | String m = String.format("%s %s %d", metric, value, (System.currentTimeMillis() / 1000)); 41 | PrintStream ps = new PrintStream(socket.getOutputStream()); 42 | ps.println(m); 43 | 44 | log.debug(String.format("Sent to Graphite: %s", m)); 45 | } 46 | catch (IOException e) { 47 | log.warn("Dropping event - unable to send data to Graphite", e); 48 | failSafeConnect(); 49 | } 50 | } 51 | 52 | public void connect() throws IOException 53 | { 54 | socket = new Socket(config.getHost(), config.getPort()); 55 | } 56 | 57 | public void disconnect() throws IOException 58 | { 59 | if (socket != null) { 60 | socket.close(); 61 | } 62 | } 63 | 64 | public void failSafeConnect() 65 | { 66 | failSafeConnect(1000, 10000); 67 | } 68 | 69 | public void failSafeConnect(final int initialBackoffTime, final int maxBackoffTime) 70 | { 71 | int backoffTime = initialBackoffTime; 72 | 73 | // Disconnect if we have a broken connection 74 | try { 75 | disconnect(); 76 | } 77 | catch (IOException e) { 78 | log.debug("Exception trying to close an already broken connection", e); 79 | } 80 | 81 | // Try to open 82 | try { 83 | log.info("Attempting to connect to Graphite"); 84 | connect(); 85 | return; 86 | } 87 | catch (IOException e) { 88 | log.warn("Unable to connect to Graphite. Will retry in " + backoffTime + " ms", e); 89 | } 90 | 91 | // Failed :( Let's try again 92 | try { 93 | disconnect(); 94 | } 95 | catch (IOException e) { 96 | log.debug("Exception trying to close an already broken connection", e); 97 | } 98 | 99 | try { 100 | Thread.sleep(backoffTime); 101 | } 102 | catch (InterruptedException ie) { 103 | Thread.currentThread().interrupt(); 104 | } 105 | 106 | backoffTime = backoffTime * 2; 107 | if (backoffTime > maxBackoffTime) { 108 | backoffTime = maxBackoffTime; 109 | } 110 | 111 | failSafeConnect(backoffTime, maxBackoffTime); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/GraphitePublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | class GraphitePublisherConfig extends PublisherConfig 20 | { 21 | private String host; 22 | private Integer port; 23 | 24 | private String prefix; 25 | 26 | public Integer getPort() 27 | { 28 | return port; 29 | } 30 | 31 | public void setPort(Integer port) 32 | { 33 | this.port = port; 34 | } 35 | 36 | public String getHost() 37 | { 38 | return host; 39 | } 40 | 41 | public void setHost(String host) 42 | { 43 | this.host = host; 44 | } 45 | 46 | public String getPrefix() 47 | { 48 | return prefix; 49 | } 50 | 51 | public void setPrefix(String prefix) 52 | { 53 | this.prefix = prefix; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/OpenTSDBListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.EventBean; 20 | import com.espertech.esper.client.UpdateListener; 21 | 22 | class OpenTSDBListener extends EsperListener implements UpdateListener 23 | { 24 | private final OpenTSDBPublisherConfig config; 25 | private final OpenTSDBPublisher publisher; 26 | 27 | public OpenTSDBListener(OpenTSDBPublisherConfig config) 28 | { 29 | this.config = config; 30 | this.publisher = new OpenTSDBPublisher(config); 31 | 32 | publisher.failSafeConnect(); 33 | } 34 | 35 | @Override 36 | public void update(EventBean[] newEvents, EventBean[] oldEvents) 37 | { 38 | if (newEvents != null) { 39 | for (EventBean newEvent : newEvents) { 40 | String typeName = getEventName(newEvent); 41 | Long timeInMs = getEventMillis(newEvent, config.getTimeAttribute()); 42 | 43 | for (String attribute : newEvent.getEventType().getPropertyNames()) { 44 | String fullName = (typeName == null ? attribute : typeName + "." + attribute); 45 | 46 | if (config.isIncluded(fullName)) { 47 | Object value = newEvent.get(attribute); 48 | 49 | if (value != null) { 50 | publisher.send(config.getPrefix() + "." + attribute, timeInMs, value); 51 | } 52 | } 53 | } 54 | } 55 | } 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/OpenTSDBPublisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import org.apache.log4j.Logger; 20 | 21 | import java.io.IOException; 22 | import java.io.PrintStream; 23 | import java.net.Socket; 24 | 25 | class OpenTSDBPublisher 26 | { 27 | private static final Logger log = Logger.getLogger(OpenTSDBPublisher.class); 28 | 29 | private OpenTSDBPublisherConfig config; 30 | private Socket socket; 31 | private PrintStream ps; 32 | 33 | public OpenTSDBPublisher(OpenTSDBPublisherConfig config) 34 | { 35 | this.config = config; 36 | } 37 | 38 | public void send(String metric, long timeInMS, Object value) 39 | { 40 | try { 41 | String m = String.format("put %s %d %s host=unknown", metric, timeInMS / 1000, value); 42 | ps.println(m); 43 | 44 | log.debug(String.format("Sent to OpenTSDB: %s", m)); 45 | } 46 | catch (Exception e) { 47 | log.warn("Dropping event - unable to send data to OpenTSDB", e); 48 | failSafeConnect(); 49 | } 50 | } 51 | 52 | public void connect() throws IOException 53 | { 54 | socket = new Socket(config.getHost(), config.getPort()); 55 | ps = new PrintStream(socket.getOutputStream()); 56 | } 57 | 58 | public void disconnect() throws IOException 59 | { 60 | if (ps != null) { 61 | ps.close(); 62 | } 63 | if (socket != null) { 64 | socket.close(); 65 | } 66 | } 67 | 68 | public void failSafeConnect() 69 | { 70 | failSafeConnect(1000, 10000); 71 | } 72 | 73 | public void failSafeConnect(final int initialBackoffTime, final int maxBackoffTime) 74 | { 75 | int backoffTime = initialBackoffTime; 76 | 77 | // Disconnect if we have a broken connection 78 | try { 79 | disconnect(); 80 | } 81 | catch (IOException e) { 82 | log.debug("Exception trying to close an already broken connection", e); 83 | } 84 | 85 | // Try to open 86 | try { 87 | log.info("Attempting to connect to OpenTSDB"); 88 | connect(); 89 | return; 90 | } 91 | catch (IOException e) { 92 | log.warn("Unable to connect to OpenTSDB. Will retry in " + backoffTime + " ms", e); 93 | } 94 | 95 | // Failed :( Let's try again 96 | try { 97 | disconnect(); 98 | } 99 | catch (IOException e) { 100 | log.debug("Exception trying to close an already broken connection", e); 101 | } 102 | 103 | try { 104 | Thread.sleep(backoffTime); 105 | } 106 | catch (InterruptedException ie) { 107 | Thread.currentThread().interrupt(); 108 | } 109 | 110 | backoffTime = backoffTime * 2; 111 | if (backoffTime > maxBackoffTime) { 112 | backoffTime = maxBackoffTime; 113 | } 114 | 115 | failSafeConnect(backoffTime, maxBackoffTime); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/OpenTSDBPublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | class OpenTSDBPublisherConfig extends PublisherConfig 20 | { 21 | private String host; 22 | private Integer port; 23 | private String prefix; 24 | 25 | public Integer getPort() 26 | { 27 | return port; 28 | } 29 | 30 | public void setPort(Integer port) 31 | { 32 | this.port = port; 33 | } 34 | 35 | public String getHost() 36 | { 37 | return host; 38 | } 39 | 40 | public void setHost(String host) 41 | { 42 | this.host = host; 43 | } 44 | 45 | public String getPrefix() 46 | { 47 | return prefix; 48 | } 49 | 50 | public void setPrefix(String prefix) 51 | { 52 | this.prefix = prefix; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/PublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import org.codehaus.jackson.annotate.JsonTypeInfo; 20 | 21 | import java.util.ArrayList; 22 | import java.util.Collections; 23 | import java.util.List; 24 | import java.util.regex.Pattern; 25 | 26 | @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class") 27 | public class PublisherConfig 28 | { 29 | private String name; 30 | private String type; 31 | private List filters = new ArrayList(); 32 | private String timeAttribute = "timestamp"; 33 | 34 | public String getName() 35 | { 36 | return name; 37 | } 38 | 39 | public void setName(String name) 40 | { 41 | this.name = name; 42 | } 43 | 44 | public String getType() 45 | { 46 | return type; 47 | } 48 | 49 | public void setType(String type) 50 | { 51 | this.type = type; 52 | } 53 | 54 | public List getFilters() 55 | { 56 | return Collections.unmodifiableList(filters); 57 | } 58 | 59 | public void setFilters(List filters) 60 | { 61 | this.filters.clear(); 62 | for (String filter : filters) { 63 | this.filters.add(Pattern.compile(filter)); 64 | } 65 | } 66 | 67 | public boolean isIncluded(String str) 68 | { 69 | if (filters.isEmpty()) { 70 | return true; 71 | } 72 | for (Pattern pattern : filters) { 73 | if (pattern.matcher(str).matches()) { 74 | return true; 75 | } 76 | } 77 | return false; 78 | } 79 | 80 | public String getTimeAttribute() 81 | { 82 | return timeAttribute; 83 | } 84 | 85 | public void setTimeAttribute(String timeAttribute) 86 | { 87 | this.timeAttribute = timeAttribute; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/ResmonListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.EventBean; 20 | import com.espertech.esper.client.UpdateListener; 21 | 22 | class ResmonListener extends EsperListener implements UpdateListener 23 | { 24 | private final ResmonPublisherConfig config; 25 | private final ResmonPublisher publisher; 26 | 27 | public ResmonListener(ResmonPublisherConfig config) throws Exception 28 | { 29 | this.config = config; 30 | this.publisher = new ResmonPublisher(); 31 | } 32 | 33 | @Override 34 | public void update(EventBean[] newEvents, EventBean[] oldEvents) 35 | { 36 | if (newEvents != null) { 37 | for (EventBean newEvent : newEvents) { 38 | for (String attribute : newEvent.getEventType().getPropertyNames()) { 39 | Object value = newEvent.get(attribute); 40 | 41 | if (value != null) { 42 | publisher.send(config.getPrefix() + "." + attribute, value); 43 | } 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/ResmonPublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | class ResmonPublisherConfig extends PublisherConfig 20 | { 21 | private String host; 22 | private Integer port; 23 | 24 | private String prefix; 25 | 26 | public Integer getPort() 27 | { 28 | return port; 29 | } 30 | 31 | public void setPort(Integer port) 32 | { 33 | this.port = port; 34 | } 35 | 36 | public String getHost() 37 | { 38 | return host; 39 | } 40 | 41 | public void setHost(String host) 42 | { 43 | this.host = host; 44 | } 45 | 46 | public String getPrefix() 47 | { 48 | return prefix; 49 | } 50 | 51 | public void setPrefix(String prefix) 52 | { 53 | this.prefix = prefix; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/ResourceListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.EventBean; 20 | import com.espertech.esper.client.UpdateListener; 21 | import com.google.common.cache.Cache; 22 | import com.google.common.cache.CacheBuilder; 23 | import com.google.common.collect.Maps; 24 | import org.joda.time.DateTime; 25 | import org.joda.time.DateTimeZone; 26 | 27 | import java.util.Map; 28 | import java.util.concurrent.TimeUnit; 29 | 30 | public class ResourceListener implements UpdateListener 31 | { 32 | private final ResourcePublisherConfig config; 33 | private final Map> samplesCache = Maps.newConcurrentMap(); 34 | private final Object mapLock = new Object(); 35 | 36 | public ResourceListener(ResourcePublisherConfig config) 37 | { 38 | this.config = config; 39 | } 40 | 41 | @Override 42 | public void update(EventBean[] newEvents, EventBean[] oldEvents) 43 | { 44 | if (newEvents != null) { 45 | for (EventBean newEvent : newEvents) { 46 | for (String attribute : newEvent.getEventType().getPropertyNames()) { 47 | add(attribute, new DateTime(DateTimeZone.UTC), newEvent.get(attribute)); 48 | } 49 | } 50 | } 51 | } 52 | 53 | public Map> getSamplesCache() 54 | { 55 | return samplesCache; 56 | } 57 | 58 | private void add(String attribute, DateTime dateTime, Object sample) 59 | { 60 | Cache samplesForType = samplesCache.get(attribute); 61 | 62 | // Build the samples cache for this type if it doesn't exist 63 | if (samplesForType == null) { 64 | synchronized (mapLock) { 65 | samplesForType = samplesCache.get(attribute); 66 | if (samplesForType == null) { 67 | samplesForType = CacheBuilder.newBuilder() 68 | .maximumSize(config.getCacheMaxSize()) 69 | .expireAfterWrite(config.getCacheExpirySeconds(), TimeUnit.SECONDS) 70 | .build(); 71 | samplesCache.put(attribute, samplesForType); 72 | } 73 | } 74 | } 75 | 76 | samplesForType.put(dateTime, sample); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/publishers/ResourcePublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | class ResourcePublisherConfig extends PublisherConfig 20 | { 21 | private long cacheExpirySeconds = 90; 22 | private long cacheMaxSize = 100000; 23 | 24 | public long getCacheExpirySeconds() 25 | { 26 | return cacheExpirySeconds; 27 | } 28 | 29 | public void setCacheExpirySeconds(long cacheExpirySeconds) 30 | { 31 | this.cacheExpirySeconds = cacheExpirySeconds; 32 | } 33 | 34 | public long getCacheMaxSize() 35 | { 36 | return cacheMaxSize; 37 | } 38 | 39 | public void setCacheMaxSize(long cacheMaxSize) 40 | { 41 | this.cacheMaxSize = cacheMaxSize; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/server/SetupJULBridge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.server; 18 | 19 | import org.apache.commons.lang.ArrayUtils; 20 | import org.slf4j.bridge.SLF4JBridgeHandler; 21 | 22 | import javax.servlet.ServletContextEvent; 23 | import javax.servlet.ServletContextListener; 24 | import java.util.logging.Handler; 25 | import java.util.logging.LogManager; 26 | import java.util.logging.Logger; 27 | 28 | /** 29 | * Takes java.util.logging and redirects it into log4j. 30 | */ 31 | public class SetupJULBridge implements ServletContextListener 32 | { 33 | private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(SetupJULBridge.class); 34 | 35 | @Override 36 | public void contextInitialized(final ServletContextEvent event) 37 | { 38 | // we first remove the default handler(s) 39 | final Logger rootLogger = LogManager.getLogManager().getLogger(""); 40 | final Handler[] handlers = rootLogger.getHandlers(); 41 | 42 | if (!ArrayUtils.isEmpty(handlers)) { 43 | for (final Handler handler : handlers) { 44 | rootLogger.removeHandler(handler); 45 | } 46 | } 47 | // and then we let jul-to-sfl4j do its magic so that jersey messages go to sfl4j (and thus log4j) 48 | SLF4JBridgeHandler.install(); 49 | 50 | log.info("Assimilated java.util Logging"); 51 | } 52 | 53 | @Override 54 | public void contextDestroyed(final ServletContextEvent event) 55 | { 56 | SLF4JBridgeHandler.uninstall(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/subscribers/AMQSubscriberConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.subscribers; 18 | 19 | class AMQSubscriberConfig extends SubscriberConfig 20 | { 21 | public String protocol; 22 | public String host; 23 | public int port; 24 | public String username; 25 | public String password; 26 | public String topic; 27 | public int initialBackoffTime = 1000; 28 | public int maxBackoffTime = 30 * 1000; 29 | 30 | public String getHost() 31 | { 32 | return host; 33 | } 34 | 35 | public void setHost(String host) 36 | { 37 | this.host = host; 38 | } 39 | 40 | public String getPassword() 41 | { 42 | return password; 43 | } 44 | 45 | public void setPassword(String password) 46 | { 47 | this.password = password; 48 | } 49 | 50 | public int getPort() 51 | { 52 | return port; 53 | } 54 | 55 | public void setPort(int port) 56 | { 57 | this.port = port; 58 | } 59 | 60 | public String getProtocol() 61 | { 62 | return protocol; 63 | } 64 | 65 | public void setProtocol(String protocol) 66 | { 67 | this.protocol = protocol; 68 | } 69 | 70 | public String getTopic() 71 | { 72 | return topic; 73 | } 74 | 75 | public void setTopic(String topic) 76 | { 77 | this.topic = topic; 78 | } 79 | 80 | public String getUsername() 81 | { 82 | return username; 83 | } 84 | 85 | public void setUsername(String username) 86 | { 87 | this.username = username; 88 | } 89 | 90 | public int getInitialBackoffTime() 91 | { 92 | return initialBackoffTime; 93 | } 94 | 95 | public void setInitialBackoffTime(int initialBackoffTime) 96 | { 97 | this.initialBackoffTime = initialBackoffTime; 98 | } 99 | 100 | public int getMaxBackoffTime() 101 | { 102 | return maxBackoffTime; 103 | } 104 | 105 | public void setMaxBackoffTime(int maxBackoffTime) 106 | { 107 | this.maxBackoffTime = maxBackoffTime; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/subscribers/FileSubscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.subscribers; 18 | 19 | import com.espertech.esper.client.EPServiceProvider; 20 | import com.google.common.collect.ImmutableList; 21 | import com.google.inject.Inject; 22 | import org.apache.commons.io.IOUtils; 23 | import org.apache.log4j.Logger; 24 | import org.joda.time.DateTime; 25 | import org.joda.time.DateTimeZone; 26 | 27 | import java.io.FileReader; 28 | import java.io.IOException; 29 | import java.util.LinkedHashMap; 30 | import java.util.List; 31 | 32 | class FileSubscriber implements Subscriber 33 | { 34 | private final Logger log = Logger.getLogger(FileSubscriber.class); 35 | 36 | private final EPServiceProvider esperSink; 37 | private final FileSubscriberConfig subscriberConfig; 38 | 39 | private final static LinkedHashMap map = new LinkedHashMap(); 40 | 41 | @Inject 42 | public FileSubscriber(FileSubscriberConfig subscriberConfig, EPServiceProvider esperSink) 43 | { 44 | this.subscriberConfig = subscriberConfig; 45 | this.esperSink = esperSink; 46 | } 47 | 48 | @Override 49 | public void subscribe() 50 | { 51 | List> dataPoints = getDataPoints(); 52 | log.info(String.format("Found %d data points", dataPoints.size())); 53 | for (LinkedHashMap s : dataPoints) { 54 | try { 55 | log.debug("Received a message, yay!\n" + s); 56 | esperSink.getEPRuntime().sendEvent(s, subscriberConfig.getEventOutputName()); 57 | } 58 | catch (ClassCastException ex) { 59 | log.info("Received message that I couldn't parse: " + s, ex); 60 | } 61 | } 62 | } 63 | 64 | @Override 65 | public void unsubscribe() 66 | { 67 | // Do nothing 68 | } 69 | 70 | private ImmutableList> getDataPoints() 71 | { 72 | ImmutableList.Builder> builder = new ImmutableList.Builder>(); 73 | 74 | try { 75 | for (String line : (List) IOUtils.readLines(new FileReader(subscriberConfig.getFilePath()))) { 76 | if (line.trim().length() > 0) { 77 | map.clear(); 78 | String[] items = line.split(subscriberConfig.getSeparator()); 79 | long dateTime = new DateTime(items[0], DateTimeZone.forID("UTC")).getMillis(); 80 | map.put("timestamp", dateTime); 81 | for (int j = 1; j < items.length; j++) { 82 | double value = Double.valueOf(items[j]); 83 | map.put(subscriberConfig.getAttributes()[j-1], value); 84 | } 85 | builder.add(new LinkedHashMap(map)); 86 | } 87 | } 88 | 89 | return builder.build(); 90 | } 91 | catch (IOException e) { 92 | log.error("Unable to read file: " + subscriberConfig.getFilePath()); 93 | return null; 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/subscribers/FileSubscriberConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.subscribers; 18 | 19 | class FileSubscriberConfig extends SubscriberConfig 20 | { 21 | private String filePath; 22 | private String separator = ","; 23 | public String[] attributes; 24 | 25 | public String getFilePath() 26 | { 27 | return filePath; 28 | } 29 | 30 | public void setFilePath(String filePath) 31 | { 32 | this.filePath = filePath; 33 | } 34 | 35 | public String getSeparator() 36 | { 37 | return separator; 38 | } 39 | 40 | public void setSeparator(String separator) 41 | { 42 | this.separator = separator; 43 | } 44 | 45 | public String[] getAttributes() 46 | { 47 | return attributes; 48 | } 49 | 50 | public void setAttributes(String attributeList) 51 | { 52 | this.attributes = (attributeList == null ? new String[0] : attributeList.split("\\s*,\\s*")); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/subscribers/JMXSubscriberConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.subscribers; 18 | 19 | class JMXSubscriberConfig extends SubscriberConfig 20 | { 21 | private String host; 22 | private int port = 8989; 23 | private String query; 24 | public String[] attributes; 25 | private long pollIntervalInMillis = 1000; 26 | 27 | public String getHost() 28 | { 29 | return host; 30 | } 31 | 32 | public void setHost(String host) 33 | { 34 | this.host = host; 35 | } 36 | 37 | public int getPort() 38 | { 39 | return port; 40 | } 41 | 42 | public void setPort(int port) 43 | { 44 | this.port = port; 45 | } 46 | 47 | public String getQuery() 48 | { 49 | return query; 50 | } 51 | 52 | public void setQuery(String query) 53 | { 54 | this.query = query; 55 | } 56 | 57 | public String[] getAttributes() 58 | { 59 | return attributes; 60 | } 61 | 62 | public void setAttributes(String attributeList) 63 | { 64 | this.attributes = (attributeList == null ? new String[0] : attributeList.split("\\s*,\\s*")); 65 | } 66 | 67 | public long getPollIntervalInMillis() 68 | { 69 | return pollIntervalInMillis; 70 | } 71 | 72 | public void setPollIntervalInMillis(long pollIntervalInMillis) 73 | { 74 | this.pollIntervalInMillis = pollIntervalInMillis; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/subscribers/Subscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.subscribers; 18 | 19 | public interface Subscriber 20 | { 21 | public void subscribe(); 22 | 23 | public void unsubscribe(); 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/subscribers/SubscriberConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.subscribers; 18 | 19 | import org.codehaus.jackson.annotate.JsonTypeInfo; 20 | 21 | @JsonTypeInfo(use= JsonTypeInfo.Id.CLASS) 22 | public class SubscriberConfig 23 | { 24 | public boolean enabled = true; 25 | 26 | public boolean isEnabled() 27 | { 28 | return enabled; 29 | } 30 | 31 | public void setEnabled(boolean enabled) 32 | { 33 | this.enabled = enabled; 34 | } 35 | 36 | /** 37 | * Event name in the Esper engine 38 | */ 39 | public String eventOutputName; 40 | 41 | /** 42 | * Subscriber class name 43 | */ 44 | public String type; 45 | 46 | /** 47 | * Name used in routes 48 | */ 49 | public String name; 50 | 51 | public String getEventOutputName() 52 | { 53 | return eventOutputName; 54 | } 55 | 56 | public void setEventOutputName(String eventOutputName) 57 | { 58 | this.eventOutputName = eventOutputName; 59 | } 60 | 61 | public String getType() 62 | { 63 | return type; 64 | } 65 | 66 | public void setType(String type) 67 | { 68 | this.type = type; 69 | } 70 | 71 | public String getName() 72 | { 73 | return name; 74 | } 75 | 76 | public void setName(String name) 77 | { 78 | this.name = name; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /core/src/main/java/com/ning/metrics/meteo/subscribers/UdpJsonSubscriberConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.subscribers; 18 | 19 | /** 20 | * Configuration class for UdpJsonSubscriber. 21 | * 22 | * @author William Speirs 23 | */ 24 | class UdpJsonSubscriberConfig extends SubscriberConfig 25 | { 26 | private int port; 27 | private int packetSize; 28 | 29 | public int getPort() { 30 | return port; 31 | } 32 | 33 | public void setPort(int port) { 34 | this.port = port; 35 | } 36 | 37 | public int getPacketSize() { 38 | return packetSize == 0 ? 1024 : packetSize; 39 | } 40 | 41 | public void setPacketSize(int packetSize) { 42 | this.packetSize = packetSize; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/resources/log4j.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /core/src/test/java/com/ning/metrics/meteo/esper/RegularExpressionTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.esper; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | import java.util.regex.Matcher; 23 | import java.util.regex.Pattern; 24 | 25 | public class RegularExpressionTest 26 | { 27 | @Test 28 | public void slashTest() 29 | { 30 | String pattern = "($|/?+((\\?|\\#|\\&).*$)?+)"; 31 | Assert.assertTrue(testPattern("/main/index", "^/main/index" + pattern)); 32 | Assert.assertTrue(testPattern("/main/index/", "^/main/index" + pattern)); 33 | Assert.assertTrue(testPattern("/main/index?foo=bar", "^/main/index" + pattern)); 34 | Assert.assertTrue(testPattern("/main/index/?foo=bar", "^/main/index" + pattern)); 35 | Assert.assertFalse(testPattern("/main/index/admin", "^/main/index" + pattern)); 36 | Assert.assertFalse(testPattern("/main/index/admin?foo=bar", "^/main/index" + pattern)); 37 | 38 | Assert.assertTrue(testPattern("/photo/foo/bar", "^/photo/.*")); 39 | Assert.assertFalse(testPattern("/main/photo/foo", "^/photo/.*")); 40 | } 41 | 42 | private boolean testPattern(String s, String pattern) 43 | { 44 | Pattern p = Pattern.compile(pattern); 45 | Matcher m = p.matcher(s); 46 | return m.matches(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /core/src/test/java/com/ning/metrics/meteo/esper/TPAggregatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.esper; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | public class TPAggregatorTest 23 | { 24 | @Test 25 | public void test40thPercentile() throws Exception 26 | { 27 | TPAggregator tp = new TPAggregator(); 28 | Object[] values = {40, null}; 29 | 30 | values[1] = 15; 31 | tp.enter(values); 32 | 33 | values[1] = 20; 34 | tp.enter(values); 35 | 36 | values[1] = 35; 37 | tp.enter(values); 38 | 39 | values[1] = 40; 40 | tp.enter(values); 41 | 42 | values[1] = 50; 43 | tp.enter(values); 44 | 45 | Assert.assertEquals(tp.getValue(), 29.0); 46 | } 47 | 48 | @Test 49 | public void test90thPercentile() throws Exception 50 | { 51 | TPAggregator tp = new TPAggregator(); 52 | Object[] values = {90, null}; 53 | 54 | for (int i = 0; i <= 100; i++) { 55 | values[1] = i; 56 | tp.enter(values); 57 | } 58 | 59 | Assert.assertEquals(tp.getValue(), 90.0); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /core/src/test/java/com/ning/metrics/meteo/publishers/DummyPublisherConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | public class DummyPublisherConfig extends PublisherConfig 20 | { 21 | private String host; 22 | private Integer port; 23 | private String prefix; 24 | 25 | public Integer getPort() 26 | { 27 | return port; 28 | } 29 | 30 | public void setPort(Integer port) 31 | { 32 | this.port = port; 33 | } 34 | 35 | public String getHost() 36 | { 37 | return host; 38 | } 39 | 40 | public void setHost(String host) 41 | { 42 | this.host = host; 43 | } 44 | 45 | public String getPrefix() 46 | { 47 | return prefix; 48 | } 49 | 50 | public void setPrefix(String prefix) 51 | { 52 | this.prefix = prefix; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /core/src/test/java/com/ning/metrics/meteo/publishers/TestPublishersCompiler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.publishers; 18 | 19 | import com.espertech.esper.client.UpdateListener; 20 | import org.testng.annotations.BeforeTest; 21 | import org.testng.annotations.Test; 22 | 23 | import static org.testng.Assert.assertTrue; 24 | 25 | public class TestPublishersCompiler 26 | { 27 | private DebugPublisherConfig publisherConfig; 28 | 29 | @BeforeTest 30 | public void setUp() 31 | { 32 | publisherConfig = new DebugPublisherConfig(); 33 | publisherConfig.setName("Debug"); 34 | publisherConfig.setType("com.ning.metrics.meteo.publishers.DebugListener"); 35 | } 36 | 37 | @Test(groups = "fast") 38 | public void testInstantiateListener() throws Exception 39 | { 40 | final UpdateListener listener = PublishersCompiler.instantiateUpdateListener(publisherConfig); 41 | assertTrue(listener instanceof DebugListener); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/01/01/21-27-49-frontpage.html: -------------------------------------------------------------------------------- 1 |

Realtime Analytics at

2 |
3 |

Ning Tech Talk

4 |
5 |

Pierre-Alexandre Meyer

6 | 7 |

http://mouraf.org

8 | 9 |

@pamonrails

10 | 11 |

pierre@ning.com

12 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/01/02/18-18-43-ning-data-pipeline.html: -------------------------------------------------------------------------------- 1 |

Data pipeline

2 |
3 |

Ning Data pipeline

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/01/02/18-18-50-ning-data-pipeline-2.html: -------------------------------------------------------------------------------- 1 |

Events

2 |
struct JettyLog   {
 3 |     1:i64 event_date,
 4 |     2:string host,
 5 |     3:string path,
 6 |     4:string query,
 7 |     5:string sourceipaddress,
 8 |     6:string trace,
 9 |     7:i64 appid,
10 |     8:i64 profileid,
11 |     9:string profile,
12 |     10:string contenttype,
13 |     11:i32 status,
14 |     12:i32 responselength,
15 |     13:string method,
16 |     14:string scheme,
17 |     15:i32 timetofirstbyte,
18 |     16:string corehostname,
19 |     17:string coreipaddress,
20 |     18:i32 coreport,
21 |     19:string coretype,
22 |     20:i32 responsetime
23 | }
24 | 
25 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/01/02/19-18-43-ning-data-pipeline-stats.html: -------------------------------------------------------------------------------- 1 |

Stats

2 | 3 |
    4 |
  • ~50 different event types
  • 5 | 6 |
  • New event type created for each new feature
  • 7 | 8 |
  • Peak at 6K events per second
  • 9 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/01/03/18-19-47-sources-of-latency.html: -------------------------------------------------------------------------------- 1 |

High latency

2 | 3 |
    4 |
  • Java library: 1 minute buffer
  • 5 | 6 |
  • Collector to HDFS: 30 seconds to 5 minutes
  • 7 | 8 |
  • In practice, 90 seconds between client and HDFS
  • 9 | 10 |
  • Netezza loader: run every hour
  • 11 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/01/04/18-19-47-optimizating-the-hard-way.html: -------------------------------------------------------------------------------- 1 |

Optimization: the hard way

2 | 3 |
    4 |
  1. Lower local buffering (client, collector): 60’ between network creation and event in HDFS
  2. 5 | 6 |
  3. Incremental Netezza loader: 3-7 minutes later in Netezza
  4. 7 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/01/04/20-19-47-optimizating-the-hard-way-3.html: -------------------------------------------------------------------------------- 1 |

Optimization: the harder way

2 | 3 |
    4 |
  • Comet/Websocket from the client
  • 5 | 6 |
  • Collector stream into HDFS (append, sync)
  • 7 | 8 |
  • Parallel loads in Netezza (synonyms, materialized views)
  • 9 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/21-31-00-brilliant-idea.html: -------------------------------------------------------------------------------- 1 |

Brilliant idea

2 |
3 |

Bon sang mais cest bien sûr !

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/21-32-00-brilliant-idea-2.html: -------------------------------------------------------------------------------- 1 |

Data pipeline

2 |
3 |

Ning Data pipeline

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/21-42-04-how-hard-can-it-be.html: -------------------------------------------------------------------------------- 1 |
public boolean sendMessage(Event event)
 2 |     {
 3 |         boolean success = false;
 4 | 
 5 |         MessageProducer producer = null;
 6 |         try {
 7 |             // Create the destination
 8 |             final ActiveMQTopic topic = new ActiveMQTopic(event.getType());
 9 | 
10 |             // Create a MessageProducer from the Session to the Topic
11 |             producer = session.createProducer(topic);
12 |             producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
13 |             producer.setTimeToLive(messagesTTLMilliseconds);
14 | 
15 |             TextMessage message = session.createTextMessage(event.toJSON());
16 | 
17 |             // Tell the producer to send the message
18 |             producer.send(message);
19 |         }
20 |         catch (JMSException e) {
21 |             // Connection flacky, maybe got dropped? ActiveMQ enpoint died?
22 |             logger.warn("Unable to send message: " + event, e);
23 |             requestReconnection();
24 |         }
25 | 
26 |         return success
27 |     }
28 | 
29 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/22-07-00-qa-is-fine.html: -------------------------------------------------------------------------------- 1 |

In QA

2 |
3 |

Works fine!

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/22-15-00-bring-it-on.html: -------------------------------------------------------------------------------- 1 |

In production

2 |
3 |

Bring it on!

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/22-22-27-oops-1.html: -------------------------------------------------------------------------------- 1 |

Oops

2 | 3 |

GC spike

4 |
5 |

Collector GC

6 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/22-24-47-bug-1.html: -------------------------------------------------------------------------------- 1 |

Producers leak

2 |
--- ActiveMQSender.java.old
 3 | +++ ActiveMQSender.java
 4 | @@ -25,6 +23,8 @@
 5 |              // Connection flacky, maybe got dropped? ActiveMQ died?
 6 |              logger.warn("Unable to send message: " + event, e);
 7 |              requestReconnection();
 8 | +        } finally {
 9 | +            producer?.close(); // One day...
10 |          }
11 | 
12 |          return success
13 | 
14 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/22-40-56-bring-it-on-2.html: -------------------------------------------------------------------------------- 1 |

In production

2 |
3 |

Bring it on!

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/22-48-33-oops-2.2.html: -------------------------------------------------------------------------------- 1 |

Oops #2

2 | 3 |

CPU spike

4 |
5 |

CPU spike

6 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/22-51-34-bug-2.html: -------------------------------------------------------------------------------- 1 |

Bad logging

2 |
--- ActiveMQSender.java.old
 3 | +++ ActiveMQSender.java
 4 | @@ -23,7 +23,6 @@
 5 |          }
 6 |          catch (JMSException e) {
 7 |              // Connection flacky, maybe got dropped? ActiveMQ died?
 8 | -            logger.warn("Unable to send message: " + event, e);
 9 |              requestReconnection();
10 |          }
11 | 
12 |
13 |

Among fixes:

14 | 15 |
    16 |
  • output every X failures
  • 17 | 18 |
  • don’t flush logs
  • 19 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/22-55-46-lessons-learned.html: -------------------------------------------------------------------------------- 1 |

Lessons learned

2 | 3 |

It’s ok to fail

4 | 5 |

Just make sure to have

6 | 7 |
    8 |
  • monitoring
  • 9 | 10 |
  • alerting
  • 11 | 12 |
  • runtime JMX switches
  • 13 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/23-02-43-now-what.html: -------------------------------------------------------------------------------- 1 |

Now what?

2 | 3 |

Charts!

4 |
5 |

Charts!

6 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/23-02-58-2-esper.html: -------------------------------------------------------------------------------- 1 |

Esper

2 | 3 |
    4 |
  • Event processor
  • 5 | 6 |
  • Designed for high frequency time-based data
  • 7 | 8 |
  • SQL-like DSL
  • 9 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/23-02-59-final-architecture.html: -------------------------------------------------------------------------------- 1 |

Data pipeline

2 |
3 |

Ning Data pipeline

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/23-03-04-html_render_time.html: -------------------------------------------------------------------------------- 1 |

Performance metrics

2 |
3 |

Performance metrics

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/23-03-05-html_render_time-2.html: -------------------------------------------------------------------------------- 1 |

Esper query

2 |
select
3 |   html_time
4 | from BazelCSPerfLite
5 | where application='test_network'
6 | 
7 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/23-09-26-response_codes.html: -------------------------------------------------------------------------------- 1 |

Health

2 |
3 |

Response codes

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/03/16/23-09-27-response_codes-2.html: -------------------------------------------------------------------------------- 1 |

Esper query

2 |
select
 3 |   istream count(responseCode) as twoxx
 4 | from FrontDoorVisit.win:time(10 sec)
 5 | where responseCode >= 200 and responseCode < 300
 6 | 
 7 | select
 8 |   istream count(responseCode) as threexx
 9 | from FrontDoorVisit.win:time(10 sec)
10 | where responseCode >= 300 and responseCode < 400
11 | 
12 | select
13 |   istream count(responseCode) as fourxx
14 | from FrontDoorVisit.win:time(10 sec)
15 | where responseCode >= 400 and responseCode < 500
16 | 
17 | select
18 |   istream count(responseCode) as fivexx
19 | from FrontDoorVisit.win:time(10 sec)
20 | where responseCode >= 500
21 | 
22 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/21/18-13-00-more-interesting-tp.html: -------------------------------------------------------------------------------- 1 |

More interesting: TP

2 | 3 |

SLA: page should render in < 1 second for 90% users

-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/21/18-13-01-more-interesting-tp-2.html: -------------------------------------------------------------------------------- 1 |

Performance metrics

2 |
3 |

HTML render time TPs

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/21/18-13-02-more-interesting-tp-3.html: -------------------------------------------------------------------------------- 1 |

Esper query

2 |
select
 3 |   istream tp(90, timeToFirstByte) as tp90
 4 | , tp(99, timeToFirstByte) as tp99
 5 | , count(*) as visits
 6 | from FrontDoorVisit.win:time(60 sec)
 7 | where responseCode < 300
 8 | and (path regexp '($|/?+((?|#|&).*$)?+)'
 9 |   or path regexp '/main($|/?+((?|#|&).*$)?+)')
10 | 
11 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/21/18-13-53-writing-uda-esper.html: -------------------------------------------------------------------------------- 1 |

Esper UDA

2 |
public Object getValue()
 3 | {
 4 |     int nbElements = vector.size();
 5 | 
 6 |     if (nbElements == 0) {
 7 |         return null;
 8 |     }
 9 | 
10 |     double rank = percentile / 100. * (nbElements - 1) + 1;
11 |     int k = (int) rank;
12 |     double d = rank - k;
13 | 
14 |     if (k == 0) {
15 |         return vector.getValue(0);
16 |     }
17 |     else if (k == nbElements) {
18 |         return vector.getValue(nbElements - 1);
19 |     }
20 |     else {
21 |         return vector.getValue(k - 1) +
22 |             d * (vector.getValue(k) - vector.getValue(k - 1));
23 |     }
24 | }
25 | 
26 |
<plugin-aggregation-function
27 |     name="tp"
28 |     function-class="com.ning.metrics.realtime.esper.TPAggregator"/>
29 | 
30 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/21/18-16-08-how-about-predicting.html: -------------------------------------------------------------------------------- 1 |

More interesting

2 | 3 |

Could we have predicted it?

4 |
5 |

Collector GC

6 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/21/18-16-09-how-about-predicting-2.html: -------------------------------------------------------------------------------- 1 |

Thresholds?

2 | 3 |

But could we have predicted this?

4 |
5 |

Latent issue

6 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/22/15-38-59-holt-winters.html: -------------------------------------------------------------------------------- 1 |

Holt-Winters

2 |
3 |

Holt-Winters example

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/22/16-00-00-holt-winters-example.html: -------------------------------------------------------------------------------- 1 |

Holt-Winters: example

2 | 3 |
    4 |
  • JVM System Load average
  • 5 | 6 |
  • Jetty 7
  • 7 | 8 |
  • Simulate failure: slow handler (bzip2 4M file)
  • 9 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/22/17-01-49-hw-esper.html: -------------------------------------------------------------------------------- 1 |

HW in Esper

2 |
select
 3 |   lastRaw as raw
 4 | , forecast
 5 | , deviation
 6 | from LoadAverage.ning:predict(SystemLoadAverage, 0.2, 0.01)
 7 | 
8 |
9 |

Configuration:

10 |
<plugin-view
11 |     namespace="ning"
12 |     name="predict"
13 |     factory-class="com.ning.metrics.realtime.esper.HoltWintersViewFactory"/>
14 | 
15 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/22/17-02-01-opentsdb-result.html: -------------------------------------------------------------------------------- 1 |

High deviation

2 |
3 |

OpenTSDB

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/22/19-02-02-opentsdb-result-2.html: -------------------------------------------------------------------------------- 1 |

Smoothing and deviation

2 |
3 |

OpenTSDB

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/22/19-03-02-opentsdb-result-bands.html: -------------------------------------------------------------------------------- 1 |

Confidence bands

2 |
3 |

OpenTSDB

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/22/19-04-02-opentsdb-result-bands-sql.html: -------------------------------------------------------------------------------- 1 |

Esper query

2 |
insert into HWStream
 3 | select
 4 |   lastRaw as raw
 5 | , forecast
 6 | , deviation
 7 | from LoadAverage.ning:predict(SystemLoadAverage, 0.3, 0.1);
 8 | 
 9 | select timestamp, raw, forecast from HWStream;
10 | 
11 | select
12 |   timestamp
13 | , forecast + 2.5 * avg(deviation) as upper_bend
14 | , forecast - 2.5 * avg(deviation) as lower_bend
15 | from HWStream.win:time(12 sec);
16 | 
17 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/23/08-42-05-realtime-core-recap.html: -------------------------------------------------------------------------------- 1 |
2 |

Realtime architecture

3 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/23/09-00-00-demo.html: -------------------------------------------------------------------------------- 1 |

Demo!

2 |
3 |

Demo

4 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/24/16-49-29-future-work.html: -------------------------------------------------------------------------------- 1 |

Future work

2 | 3 |
    4 |
  • Alerting (beyond first pass)
  • 5 | 6 |
  • Replace OpenTSDB
  • 7 | 8 |
  • Integrate with Arecibo
  • 9 | 10 |
  • Large-scale (tons of metrics)
  • 11 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/24/16-49-35-papers.html: -------------------------------------------------------------------------------- 1 |

References

2 | 3 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/2011/04/24/16-49-39-questions.html: -------------------------------------------------------------------------------- 1 |

Questions?

2 | 3 |

Code and slides available at github.com/ning

-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/LICENSE: -------------------------------------------------------------------------------- 1 | http://zoonek2.free.fr/UNIX/48_R/15.html 2 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/README: -------------------------------------------------------------------------------- 1 | These are the slides from the Ning Tech-Talk: 2 | 3 | http://www.meetup.com/Ning-Tech-Talks/events/17221783/ 4 | 5 | Army photos are in the public domain 6 | xkcd attribution: xkcd.com 7 | Prediction picture attribution: http://www.flickr.com/photos/assbach/237458105/sizes/l/in/photostream/O 8 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/ConfidenceBands.js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/ConfidenceBands.js.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/ConfidenceBands.orig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/ConfidenceBands.orig.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/ConfidenceBands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/ConfidenceBands.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-3-smooth.orig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-3-smooth.orig.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-3-smooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-3-smooth.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-avg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-avg.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-exp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-exp.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-raw-zoom.js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-raw-zoom.js.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-raw.js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-raw.js.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-raw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/HW-anomalie-cpu-raw.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/HomepagePerformance.invert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/HomepagePerformance.invert.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/HomepagePerformance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/HomepagePerformance.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/ProcessCpuTimeNormalOperationsCollector1Smoothed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/ProcessCpuTimeNormalOperationsCollector1Smoothed.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/SimpleWebServer-load.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/SimpleWebServer-load.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/bon_sang.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/bon_sang.jpg -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/bring_it_on.big.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/bring_it_on.big.jpg -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/bring_it_on.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/bring_it_on.jpg -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/confidenceBandsPass1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/confidenceBandsPass1.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/graphite_production_test_network.invert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/graphite_production_test_network.invert.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/graphite_production_test_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/graphite_production_test_network.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/graphite_response_codes.invert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/graphite_response_codes.invert.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/graphite_response_codes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/graphite_response_codes.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/ning-architecture-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/ning-architecture-2.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/ning-architecture-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/ning-architecture-3.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/ning-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/ning-architecture.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/ning-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/ning-logo.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/pass1_coll_jvm_gc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/pass1_coll_jvm_gc.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/pass2_cpu_spike.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/pass2_cpu_spike.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/pass2_splunk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/pass2_splunk.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/prediction_demo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/prediction_demo.jpg -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/qa_is_fine.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/qa_is_fine.jpg -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/rt-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/rt-architecture.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/vip-latent-issue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/vip-latent-issue.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/vip-latent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/vip-latent.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/images/xkcd_pie_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pierre/meteo/98b2501b7388abd06f155fa9d264ba022fe7641d/doc/realtime_analytics_at_ning/images/xkcd_pie_chart.png -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-01-04-19-19-47-optimizating-the-hard-way-2.markdown: -------------------------------------------------------------------------------- 1 | # Optimization: the hard way 2 | 3 | * 60' between network creation and event in HDFS 4 | * 3-7 minutes later in Netezza -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-03-16-22-44-19-oops-2.markdown: -------------------------------------------------------------------------------- 1 | # Oops #2 2 | 3 |
4 | ![Splunk alert](images/pass2_splunk.png) 5 |
6 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-03-16-23-02-58-graphite.markdown: -------------------------------------------------------------------------------- 1 | # Graphite 2 | 3 | * Charting UI/API 4 | * Custom RRD engine (whisper) 5 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-04-21-18-09-12-graphite-the-good.markdown: -------------------------------------------------------------------------------- 1 | # Graphite: the good 2 | 3 | * Easy to send data 4 | * Easy to create rich line graphs 5 | * Provides HTTP API and designer UI -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-04-21-18-09-15-graphite-the-bad.markdown: -------------------------------------------------------------------------------- 1 | # Graphite: the bad 2 | 3 | * Poor documentation 4 | * Hard to debug 5 | * Scalability? -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-04-22-16-00-01-holt-winters-example.markdown: -------------------------------------------------------------------------------- 1 | # Holt-Winters: example 2 | 3 |
4 | ![Jconsole](images/SimpleWebServer-load.png) 5 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-04-22-18-00-00-hw-esper-avg.markdown: -------------------------------------------------------------------------------- 1 | # HW in Esper 2 | 3 | {% highlight sql %} 4 | insert into HWStream 5 | select 6 | lastRaw as raw 7 | , forecast 8 | , deviation 9 | from LoadAverage.ning:predict(SystemLoadAverage, 0.2, 0.01); 10 | 11 | select raw, forecast from HWStream; 12 | select avg(deviation) as deviation from HWStream.win:time(2 sec); 13 | {% endhighlight %} -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-04-22-18-02-01-opentsdb-result.markdown: -------------------------------------------------------------------------------- 1 | # Holt-Winters: example 2 | 3 |
4 | ![OpenTSDB](images/HW-anomalie-cpu-avg.png) 5 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-04-22-19-00-00-hw-esper-exp.markdown: -------------------------------------------------------------------------------- 1 | # HW in Esper 2 | 3 | {% highlight sql %} 4 | insert into HWStream 5 | select 6 | lastRaw as raw 7 | , forecast 8 | , deviation 9 | from LoadAverage.ning:predict(SystemLoadAverage, 0.2, 0.01); 10 | 11 | select raw, forecast from HWStream; 12 | select forecast as deviation from HWStream.ning:predict(deviation, 0.2, 0.01); 13 | {% endhighlight %} 14 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-04-22-19-02-01-opentsdb-result.markdown: -------------------------------------------------------------------------------- 1 | # Holt-Winters: example 2 | 3 |
4 | ![OpenTSDB](images/HW-anomalie-cpu-exp.png) 5 |
-------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-04-22-20-00-00-opentsdb-the-good.markdown: -------------------------------------------------------------------------------- 1 | # OpenTSDB: the good 2 | 3 | * Easy to send data 4 | * Provides HTTP API 5 | * No RRD, HBase! -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/old_slides/2011-04-22-21-00-00-opentsdb-the-bad.markdown: -------------------------------------------------------------------------------- 1 | # OpenTSDB: the bad 2 | 3 | * UI (limited, e.g. cannot save) 4 | * Need to create metrics manually -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/README.mdown: -------------------------------------------------------------------------------- 1 | Slippy - HTML Slides 2 | ==================== 3 | 4 | Demo / Documentation 5 | -------------------- 6 | 7 | See the example slide deck live on [slides.seld.be][1] 8 | 9 | [1]: http://slides.seld.be/?file=2010-05-30+Example.html 10 | 11 | Contribute 12 | ---------- 13 | 14 | If you like this piece of software, please consider contributing back with Flattr or Pledgie: 15 | 16 | Click here to lend your support to slippy and make a donation via pledgie.com ! 17 | 18 | Code contributions or ideas are obviously also much welcome. 19 | 20 | Usage 21 | ----- 22 | 23 | Navigate, double click anywhere, press space or use the left/up and right/down arrow keys 24 | 25 | Go to a slide directly, press number keys and then enter 26 | 27 | Get an overview, press escape, tab or delete then click on a slide to go straight to it 28 | 29 | Author 30 | ------ 31 | 32 | Jordi Boggiano - 33 | - 34 | 35 | Changelog 36 | --------- 37 | 38 | - 1.0.0 39 | - Switched license to BSD 40 | - Slide decks files are now standalone html files that don't need php 41 | - However it is recommended if you have code blocks since it will convert html special chars automatically 42 | - Note that this breaks compatibility with previous slide decks, since the js/css files have to be included by hand in it now 43 | - Added layout functionality, see the slide on layouts in the example deck for docs 44 | - Added parameters to the main slippy js command that enable users to easily tweak/override things, see example file 45 | - Added swipe/double-tap support on touch devices 46 | - Splitted css in structural/theme stylesheets for easy customization 47 | - Improved the default theme for better readability on projectors 48 | - Auto-sizing to the browser dimensions 49 | - Added page up, page down support for prev/next slide, and home/end to go to the begining or end of presentaiton 50 | - Animations are going the right way now when using overview/direct input and going backwards 51 | - Added a template to render the slide repository page 52 | - Added a packager that embeds everything for easy distribution of slides as one html file 53 | - JS Alerts are now cleared when changing slide, but stay visible longer 54 | - Fixed bug preventing "0" to be used to switch to slides 55 | 56 | - 0.9.0 57 | - Initial Public Release 58 | 59 | License 60 | ------- 61 | 62 | Slippy is licensed under the New BSD License, which means you can do pretty much anything you want with it - However, I encourage you to share your slides and stylesheets if you make some, but there is no obligation whatsoever. 63 | 64 | New BSD License - see the src/LICENSE file for details 65 | 66 | Compatibility 67 | ------------- 68 | 69 | It should work with all browsers, except for the overview function that does not work in IE8 and below. 70 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Jordi Boggiano 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of Slippy nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/config.dist.php: -------------------------------------------------------------------------------- 1 | . 29 | */ 30 | SyntaxHighlighter.brushes.AS3 = function() 31 | { 32 | // Created by Peter Atoria @ http://iAtoria.com 33 | 34 | var inits = 'class interface function package'; 35 | 36 | var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' + 37 | 'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' + 38 | 'extends false final finally flash_proxy for get if implements import in include Infinity ' + 39 | 'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' + 40 | 'Null Number Object object_proxy override parseFloat parseInt private protected public ' + 41 | 'return set static String super switch this throw true try typeof uint undefined unescape ' + 42 | 'use void while with' 43 | ; 44 | 45 | this.regexList = [ 46 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 47 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 48 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 49 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 50 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 51 | { regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations 52 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 53 | { regex: new RegExp('var', 'gm'), css: 'variable' }, // variable 54 | { regex: new RegExp('trace', 'gm'), css: 'color1' } // trace 55 | ]; 56 | 57 | this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags); 58 | }; 59 | 60 | SyntaxHighlighter.brushes.AS3.prototype = new SyntaxHighlighter.Highlighter(); 61 | SyntaxHighlighter.brushes.AS3.aliases = ['actionscript3', 'as3']; 62 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushBash.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Bash = function() 31 | { 32 | var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne gt lt ge le'; 33 | var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' + 34 | 'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' + 35 | 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' + 36 | 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' + 37 | 'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' + 38 | 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' + 39 | 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' + 40 | 'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' + 41 | 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' + 42 | 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' + 43 | 'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' + 44 | 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' + 45 | 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' + 46 | 'vi watch wc whereis which who whoami Wget xargs yes' 47 | ; 48 | 49 | this.findMatches = function(regexList, code) 50 | { 51 | code = code.replace(/>/g, '>').replace(/</g, '<'); 52 | this.code = code; 53 | return SyntaxHighlighter.Highlighter.prototype.findMatches.apply(this, [regexList, code]); 54 | }; 55 | 56 | this.regexList = [ 57 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments 58 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 59 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 60 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 61 | { regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands 62 | ]; 63 | } 64 | 65 | SyntaxHighlighter.brushes.Bash.prototype = new SyntaxHighlighter.Highlighter(); 66 | SyntaxHighlighter.brushes.Bash.aliases = ['bash', 'shell']; 67 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushCSharp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.CSharp = function() 31 | { 32 | var keywords = 'abstract as base bool break byte case catch char checked class const ' + 33 | 'continue decimal default delegate do double else enum event explicit ' + 34 | 'extern false finally fixed float for foreach get goto if implicit in int ' + 35 | 'interface internal is lock long namespace new null object operator out ' + 36 | 'override params private protected public readonly ref return sbyte sealed set ' + 37 | 'short sizeof stackalloc static string struct switch this throw true try ' + 38 | 'typeof uint ulong unchecked unsafe ushort using virtual void while'; 39 | 40 | function fixComments(match, regexInfo) 41 | { 42 | var css = (match[0].indexOf("///") == 0) 43 | ? 'color1' 44 | : 'comments' 45 | ; 46 | 47 | return [new SyntaxHighlighter.Match(match[0], match.index, css)]; 48 | } 49 | 50 | this.regexList = [ 51 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments 52 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 53 | { regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings 54 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 55 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 56 | { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 57 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword 58 | { regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial' 59 | { regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield' 60 | ]; 61 | 62 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 63 | }; 64 | 65 | SyntaxHighlighter.brushes.CSharp.prototype = new SyntaxHighlighter.Highlighter(); 66 | SyntaxHighlighter.brushes.CSharp.aliases = ['c#', 'c-sharp', 'csharp']; 67 | 68 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushDelphi.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Delphi = function() 31 | { 32 | var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' + 33 | 'case char class comp const constructor currency destructor div do double ' + 34 | 'downto else end except exports extended false file finalization finally ' + 35 | 'for function goto if implementation in inherited int64 initialization ' + 36 | 'integer interface is label library longint longword mod nil not object ' + 37 | 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' + 38 | 'pint64 pointer private procedure program property pshortstring pstring ' + 39 | 'pvariant pwidechar pwidestring protected public published raise real real48 ' + 40 | 'record repeat set shl shortint shortstring shr single smallint string then ' + 41 | 'threadvar to true try type unit until uses val var varirnt while widechar ' + 42 | 'widestring with word write writeln xor'; 43 | 44 | this.regexList = [ 45 | { regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *) 46 | { regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { } 47 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line 48 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 49 | { regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags 50 | { regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345 51 | { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3 52 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword 53 | ]; 54 | }; 55 | 56 | SyntaxHighlighter.brushes.Delphi.prototype = new SyntaxHighlighter.Highlighter(); 57 | SyntaxHighlighter.brushes.Delphi.aliases = ['delphi', 'pascal', 'pas']; 58 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushDiff.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Diff = function() 31 | { 32 | this.regexList = [ 33 | { regex: /^\+\+\+.*$/gm, css: 'color2' }, 34 | { regex: /^\-\-\-.*$/gm, css: 'color2' }, 35 | { regex: /^\s.*$/gm, css: 'color1' }, 36 | { regex: /^@@.*@@$/gm, css: 'variable' }, 37 | { regex: /^\+[^\+]{1}.*$/gm, css: 'string' }, 38 | { regex: /^\-[^\-]{1}.*$/gm, css: 'comments' } 39 | ]; 40 | }; 41 | 42 | SyntaxHighlighter.brushes.Diff.prototype = new SyntaxHighlighter.Highlighter(); 43 | SyntaxHighlighter.brushes.Diff.aliases = ['diff', 'patch']; 44 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushErlang.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Erlang = function() 31 | { 32 | // Contributed by Jean-Lou Dupont 33 | // http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html 34 | 35 | // According to: http://erlang.org/doc/reference_manual/introduction.html#1.5 36 | var keywords = 'after and andalso band begin bnot bor bsl bsr bxor '+ 37 | 'case catch cond div end fun if let not of or orelse '+ 38 | 'query receive rem try when xor'+ 39 | // additional 40 | ' module export import define'; 41 | 42 | this.regexList = [ 43 | { regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), css: 'constants' }, 44 | { regex: new RegExp("\\%.+", 'gm'), css: 'comments' }, 45 | { regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), css: 'preprocessor' }, 46 | { regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), css: 'functions' }, 47 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, 48 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, 49 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } 50 | ]; 51 | }; 52 | 53 | SyntaxHighlighter.brushes.Erlang.prototype = new SyntaxHighlighter.Highlighter(); 54 | SyntaxHighlighter.brushes.Erlang.aliases = ['erl', 'erlang']; 55 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushGroovy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Groovy = function() 31 | { 32 | // Contributed by Andres Almiray 33 | // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter 34 | 35 | var keywords = 'as assert break case catch class continue def default do else extends finally ' + 36 | 'if in implements import instanceof interface new package property return switch ' + 37 | 'throw throws try while public protected private static'; 38 | var types = 'void boolean byte char short int long float double'; 39 | var constants = 'null'; 40 | var methods = 'allProperties count get size '+ 41 | 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' + 42 | 'findIndexOf grep inject max min reverseEach sort ' + 43 | 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' + 44 | 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' + 45 | 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' + 46 | 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' + 47 | 'transformChar transformLine withOutputStream withPrintWriter withStream ' + 48 | 'withStreams withWriter withWriterAppend write writeLine '+ 49 | 'dump inspect invokeMethod print println step times upto use waitForOrKill '+ 50 | 'getText'; 51 | 52 | this.regexList = [ 53 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 54 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 55 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 56 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 57 | { regex: /""".*"""/g, css: 'string' }, // GStrings 58 | { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers 59 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword 60 | { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type 61 | { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants 62 | { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods 63 | ]; 64 | 65 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 66 | } 67 | 68 | SyntaxHighlighter.brushes.Groovy.prototype = new SyntaxHighlighter.Highlighter(); 69 | SyntaxHighlighter.brushes.Groovy.aliases = ['groovy']; 70 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushJScript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.JScript = function() 31 | { 32 | var keywords = 'break case catch continue ' + 33 | 'default delete do else false ' + 34 | 'for function if in instanceof ' + 35 | 'new null return super switch ' + 36 | 'this throw true try typeof var while with' 37 | ; 38 | 39 | this.regexList = [ 40 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 41 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 42 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 43 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 44 | { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 45 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords 46 | ]; 47 | 48 | this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags); 49 | }; 50 | 51 | SyntaxHighlighter.brushes.JScript.prototype = new SyntaxHighlighter.Highlighter(); 52 | SyntaxHighlighter.brushes.JScript.aliases = ['js', 'jscript', 'javascript']; 53 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushJava.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Java = function() 31 | { 32 | var keywords = 'abstract assert boolean break byte case catch char class const ' + 33 | 'continue default do double else enum extends ' + 34 | 'false final finally float for goto if implements import ' + 35 | 'instanceof int interface long native new null ' + 36 | 'package private protected public return ' + 37 | 'short static strictfp super switch synchronized this throw throws true ' + 38 | 'transient try void volatile while'; 39 | 40 | this.regexList = [ 41 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 42 | { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments 43 | { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments 44 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 45 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 46 | { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers 47 | { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno 48 | { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword 49 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword 50 | ]; 51 | 52 | this.forHtmlScript({ 53 | left : /(<|<)%[@!=]?/g, 54 | right : /%(>|>)/g 55 | }); 56 | }; 57 | 58 | SyntaxHighlighter.brushes.Java.prototype = new SyntaxHighlighter.Highlighter(); 59 | SyntaxHighlighter.brushes.Java.aliases = ['java']; 60 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushJavaFX.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.JavaFX = function() 31 | { 32 | // Contributed by Patrick Webster 33 | // http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html 34 | var datatypes = 'Boolean Byte Character Double Duration ' 35 | + 'Float Integer Long Number Short String Void' 36 | ; 37 | 38 | var keywords = 'abstract after and as assert at before bind bound break catch class ' 39 | + 'continue def delete else exclusive extends false finally first for from ' 40 | + 'function if import in indexof init insert instanceof into inverse last ' 41 | + 'lazy mixin mod nativearray new not null on or override package postinit ' 42 | + 'protected public public-init public-read replace return reverse sizeof ' 43 | + 'step super then this throw true try tween typeof var where while with ' 44 | + 'attribute let private readonly static trigger' 45 | ; 46 | 47 | this.regexList = [ 48 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, 49 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, 50 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, 51 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, 52 | { regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, css: 'color2' }, // numbers 53 | { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'variable' }, // datatypes 54 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } 55 | ]; 56 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 57 | }; 58 | 59 | SyntaxHighlighter.brushes.JavaFX.prototype = new SyntaxHighlighter.Highlighter(); 60 | SyntaxHighlighter.brushes.JavaFX.aliases = ['jfx', 'javafx']; 61 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushPerl.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Perl = function() 31 | { 32 | // Contributed by David Simmons-Duffin and Marty Kube 33 | 34 | var funcs = 35 | 'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' + 36 | 'chroot close closedir connect cos crypt defined delete each endgrent ' + 37 | 'endhostent endnetent endprotoent endpwent endservent eof exec exists ' + 38 | 'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' + 39 | 'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' + 40 | 'getnetbyname getnetent getpeername getpgrp getppid getpriority ' + 41 | 'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' + 42 | 'getservbyname getservbyport getservent getsockname getsockopt glob ' + 43 | 'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' + 44 | 'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' + 45 | 'oct open opendir ord pack pipe pop pos print printf prototype push ' + 46 | 'quotemeta rand read readdir readline readlink readpipe recv rename ' + 47 | 'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' + 48 | 'semget semop send setgrent sethostent setnetent setpgrp setpriority ' + 49 | 'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' + 50 | 'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' + 51 | 'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' + 52 | 'system syswrite tell telldir time times tr truncate uc ucfirst umask ' + 53 | 'undef unlink unpack unshift utime values vec wait waitpid warn write'; 54 | 55 | var keywords = 56 | 'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' + 57 | 'for foreach goto if import last local my next no our package redo ref ' + 58 | 'require return sub tie tied unless untie until use wantarray while'; 59 | 60 | this.regexList = [ 61 | { regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' }, 62 | { regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang 63 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, 64 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, 65 | { regex: new RegExp('(\\$|@|%)\\w+', 'g'), css: 'variable' }, 66 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, 67 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } 68 | ]; 69 | 70 | this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags); 71 | } 72 | 73 | SyntaxHighlighter.brushes.Perl.prototype = new SyntaxHighlighter.Highlighter(); 74 | SyntaxHighlighter.brushes.Perl.aliases = ['perl', 'Perl', 'pl']; -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushPlain.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Plain = function() 31 | { 32 | }; 33 | 34 | SyntaxHighlighter.brushes.Plain.prototype = new SyntaxHighlighter.Highlighter(); 35 | SyntaxHighlighter.brushes.Plain.aliases = ['text', 'plain']; 36 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushPython.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Python = function() 31 | { 32 | // Contributed by Gheorghe Milas and Ahmad Sherif 33 | 34 | var keywords = 'and assert break class continue def del elif else ' + 35 | 'except exec finally for from global if import in is ' + 36 | 'lambda not or pass print raise return try yield while'; 37 | 38 | var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' + 39 | 'chr classmethod cmp coerce compile complex delattr dict dir ' + 40 | 'divmod enumerate eval execfile file filter float format frozenset ' + 41 | 'getattr globals hasattr hash help hex id input int intern ' + 42 | 'isinstance issubclass iter len list locals long map max min next ' + 43 | 'object oct open ord pow print property range raw_input reduce ' + 44 | 'reload repr reversed round set setattr slice sorted staticmethod ' + 45 | 'str sum super tuple type type unichr unicode vars xrange zip'; 46 | 47 | var special = 'None True False self cls class_'; 48 | 49 | this.regexList = [ 50 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, 51 | { regex: /^\s*@\w+/gm, css: 'decorator' }, 52 | { regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' }, 53 | { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' }, 54 | { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' }, 55 | { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' }, 56 | { regex: /\b\d+\.?\w*/g, css: 'value' }, 57 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, 58 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, 59 | { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' } 60 | ]; 61 | 62 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 63 | }; 64 | 65 | SyntaxHighlighter.brushes.Python.prototype = new SyntaxHighlighter.Highlighter(); 66 | SyntaxHighlighter.brushes.Python.aliases = ['py', 'python']; 67 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushRuby.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Ruby = function() 31 | { 32 | // Contributed by Erik Peterson. 33 | 34 | var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' + 35 | 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' + 36 | 'self super then throw true undef unless until when while yield'; 37 | 38 | var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' + 39 | 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' + 40 | 'ThreadGroup Thread Time TrueClass'; 41 | 42 | this.regexList = [ 43 | { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments 44 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings 45 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings 46 | { regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants 47 | { regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols 48 | { regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables 49 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 50 | { regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins 51 | ]; 52 | 53 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 54 | }; 55 | 56 | SyntaxHighlighter.brushes.Ruby.prototype = new SyntaxHighlighter.Highlighter(); 57 | SyntaxHighlighter.brushes.Ruby.aliases = ['ruby', 'rails', 'ror', 'rb']; 58 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushScala.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Scala = function() 31 | { 32 | // Contributed by Yegor Jbanov and David Bernard. 33 | 34 | var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' + 35 | 'override try lazy for var catch throw type extends class while with new final yield abstract ' + 36 | 'else do if return protected private this package false'; 37 | 38 | var keyops = '[_:=><%#@]+'; 39 | 40 | this.regexList = [ 41 | { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments 42 | { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments 43 | { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings 44 | { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string 45 | { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings 46 | { regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers 47 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords 48 | { regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword 49 | ]; 50 | } 51 | 52 | SyntaxHighlighter.brushes.Scala.prototype = new SyntaxHighlighter.Highlighter(); 53 | SyntaxHighlighter.brushes.Scala.aliases = ['scala']; 54 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushSql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Sql = function() 31 | { 32 | var funcs = 'abs avg case cast coalesce convert count current_timestamp ' + 33 | 'current_user day isnull left lower month nullif replace right ' + 34 | 'session_user space substring sum system_user upper user year'; 35 | 36 | var keywords = 'absolute action add after alter as asc at authorization begin bigint ' + 37 | 'binary bit by cascade char character check checkpoint close collate ' + 38 | 'column commit committed connect connection constraint contains continue ' + 39 | 'create cube current current_date current_time cursor database date ' + 40 | 'deallocate dec decimal declare default delete desc distinct double drop ' + 41 | 'dynamic else end end-exec escape except exec execute false fetch first ' + 42 | 'float for force foreign forward free from full function global goto grant ' + 43 | 'group grouping having hour ignore index inner insensitive insert instead ' + 44 | 'int integer intersect into is isolation key last level load local max min ' + 45 | 'minute modify move name national nchar next no numeric of off on only ' + 46 | 'open option order out output partial password precision prepare primary ' + 47 | 'prior privileges procedure public read real references relative repeatable ' + 48 | 'restrict return returns revoke rollback rollup rows rule schema scroll ' + 49 | 'second section select sequence serializable set size smallint static ' + 50 | 'statistics table temp temporary then time timestamp to top transaction ' + 51 | 'translation trigger true truncate uncommitted union unique update values ' + 52 | 'varchar varying view when where with work'; 53 | 54 | var operators = 'all and any between cross in join like not null or outer some'; 55 | 56 | this.regexList = [ 57 | { regex: /--(.*)$/gm, css: 'comments' }, // one line and multiline comments 58 | { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings 59 | { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // single quoted strings 60 | { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'color2' }, // functions 61 | { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such 62 | { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword 63 | ]; 64 | }; 65 | 66 | SyntaxHighlighter.brushes.Sql.prototype = new SyntaxHighlighter.Highlighter(); 67 | SyntaxHighlighter.brushes.Sql.aliases = ['sql']; 68 | 69 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushVb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Vb = function() 31 | { 32 | var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' + 33 | 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' + 34 | 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' + 35 | 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' + 36 | 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' + 37 | 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' + 38 | 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' + 39 | 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' + 40 | 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' + 41 | 'Overloads Overridable Overrides ParamArray Preserve Private Property ' + 42 | 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' + 43 | 'Return Select Set Shadows Shared Short Single Static Step Stop String ' + 44 | 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' + 45 | 'Variant When While With WithEvents WriteOnly Xor'; 46 | 47 | this.regexList = [ 48 | { regex: /'.*$/gm, css: 'comments' }, // one line comments 49 | { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings 50 | { regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion 51 | { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword 52 | ]; 53 | 54 | this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags); 55 | }; 56 | 57 | SyntaxHighlighter.brushes.Vb.prototype = new SyntaxHighlighter.Highlighter(); 58 | SyntaxHighlighter.brushes.Vb.aliases = ['vb', 'vbnet']; 59 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shBrushXml.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | SyntaxHighlighter.brushes.Xml = function() 31 | { 32 | function process(match, regexInfo) 33 | { 34 | var constructor = SyntaxHighlighter.Match, 35 | code = match[0], 36 | tag = new XRegExp('(<|<)[\\s\\/\\?]*(?[:\\w-\\.]+)', 'xg').exec(code), 37 | result = [] 38 | ; 39 | 40 | if (match.attributes != null) 41 | { 42 | var attributes, 43 | regex = new XRegExp('(? [\\w:\\-\\.]+)' + 44 | '\\s*=\\s*' + 45 | '(? ".*?"|\'.*?\'|\\w+)', 46 | 'xg'); 47 | 48 | while ((attributes = regex.exec(code)) != null) 49 | { 50 | result.push(new constructor(attributes.name, match.index + attributes.index, 'color1')); 51 | result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string')); 52 | } 53 | } 54 | 55 | if (tag != null) 56 | result.push( 57 | new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword') 58 | ); 59 | 60 | return result; 61 | } 62 | 63 | this.regexList = [ 64 | { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // 65 | { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // 66 | { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process } 67 | ]; 68 | }; 69 | 70 | SyntaxHighlighter.brushes.Xml.prototype = new SyntaxHighlighter.Highlighter(); 71 | SyntaxHighlighter.brushes.Xml.aliases = ['xml', 'xhtml', 'xslt', 'html']; 72 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shLegacy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 y={d:{}};y.d={F:6(S,l,q,k,m,n){6 J(z,Y){1 V=16 15("^"+Y+"\\\\[(?\\\\w+)\\\\]$","14"),x=2;h(1 i=0;i. 29 | */ 30 | /** 31 | * Django SyntaxHighlighter theme 32 | */ 33 | 34 | /************************************ 35 | * Interface elements. 36 | ************************************/ 37 | 38 | .syntaxhighlighter 39 | { 40 | background-color: #0B2F20 !important; 41 | } 42 | 43 | /* Gutter line numbers */ 44 | .syntaxhighlighter .line .number 45 | { 46 | color: #497958 !important; 47 | } 48 | 49 | /* Add border to the lines */ 50 | .syntaxhighlighter .line .content 51 | { 52 | border-left: 3px solid #41A83E !important; 53 | color: #B9BDB6 !important; 54 | } 55 | 56 | .syntaxhighlighter.printing .line .content 57 | { 58 | border: 0 !important; 59 | } 60 | 61 | /* First line */ 62 | .syntaxhighlighter .line.alt1 63 | { 64 | } 65 | 66 | /* Second line */ 67 | .syntaxhighlighter .line.alt2 68 | { 69 | background-color: #0a2b1d !important; 70 | } 71 | 72 | .syntaxhighlighter .toolbar 73 | { 74 | background-color: #245032 !important; 75 | border: #0B2F20 solid 1px !important; 76 | } 77 | 78 | .syntaxhighlighter .toolbar a 79 | { 80 | color: #C4B14A !important; 81 | } 82 | 83 | .syntaxhighlighter .toolbar a:hover 84 | { 85 | color: #FFE862 !important; 86 | } 87 | 88 | /************************************ 89 | * Actual syntax highlighter colors. 90 | ************************************/ 91 | .syntaxhighlighter .plain, 92 | .syntaxhighlighter .plain a 93 | { 94 | color: #F8F8F8 !important; 95 | } 96 | 97 | .syntaxhighlighter .comments, 98 | .syntaxhighlighter .comments a 99 | { 100 | color: #336442 !important; 101 | font-style: italic !important; 102 | } 103 | 104 | .syntaxhighlighter .string, 105 | .syntaxhighlighter .string a 106 | { 107 | color: #9DF39F !important; 108 | } 109 | 110 | .syntaxhighlighter .keyword 111 | { 112 | color: #96DD3B !important; 113 | font-weight: bold !important; 114 | } 115 | 116 | .syntaxhighlighter .preprocessor 117 | { 118 | color: #91BB9E !important; 119 | } 120 | 121 | .syntaxhighlighter .variable 122 | { 123 | color: #FFAA3E !important; 124 | } 125 | 126 | .syntaxhighlighter .value 127 | { 128 | color: #F7E741 !important; 129 | } 130 | 131 | .syntaxhighlighter .functions 132 | { 133 | color: #FFAA3E !important; 134 | } 135 | 136 | .syntaxhighlighter .constants 137 | { 138 | color: #E0E8FF !important; 139 | } 140 | 141 | .syntaxhighlighter .script 142 | { 143 | background-color: #497958 !important; 144 | } 145 | 146 | .syntaxhighlighter .color1, 147 | .syntaxhighlighter .color1 a 148 | { 149 | color: #EB939A !important; 150 | } 151 | 152 | .syntaxhighlighter .color2, 153 | .syntaxhighlighter .color2 a 154 | { 155 | color: #91BB9E !important; 156 | } 157 | 158 | .syntaxhighlighter .color3, 159 | .syntaxhighlighter .color3 a 160 | { 161 | color: #EDEF7D !important; 162 | } 163 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/highlighter/shThemeEmacs.css: -------------------------------------------------------------------------------- 1 | /** 2 | * SyntaxHighlighter 3 | * http://alexgorbatchev.com/ 4 | * 5 | * SyntaxHighlighter is donationware. If you are using it, please donate. 6 | * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate 7 | * 8 | * @version 9 | * 2.1.364 (October 15 2009) 10 | * 11 | * @copyright 12 | * Copyright (C) 2004-2009 Alex Gorbatchev. 13 | * 14 | * @license 15 | * This file is part of SyntaxHighlighter. 16 | * 17 | * SyntaxHighlighter is free software: you can redistribute it and/or modify 18 | * it under the terms of the GNU Lesser General Public License as published by 19 | * the Free Software Foundation, either version 3 of the License, or 20 | * (at your option) any later version. 21 | * 22 | * SyntaxHighlighter is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 | * GNU General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU General Public License 28 | * along with SyntaxHighlighter. If not, see . 29 | */ 30 | /** 31 | * Emacs SyntaxHighlighter theme based on theme by Joshua Emmons 32 | * http://www.skia.net/ 33 | */ 34 | 35 | /************************************ 36 | * Interface elements. 37 | ************************************/ 38 | 39 | .syntaxhighlighter 40 | { 41 | background-color: #000000 !important; 42 | } 43 | 44 | /* Gutter line numbers */ 45 | .syntaxhighlighter .line .number 46 | { 47 | color: #D3D3D3 !important; 48 | } 49 | 50 | /* Add border to the lines */ 51 | .syntaxhighlighter .line .content 52 | { 53 | border-left: 3px solid #990000 !important; 54 | color: #B9BDB6 !important; 55 | } 56 | 57 | .syntaxhighlighter.printing .line .content 58 | { 59 | border: 0 !important; 60 | } 61 | 62 | /* First line */ 63 | .syntaxhighlighter .line.alt1 64 | { 65 | } 66 | 67 | /* Second line */ 68 | .syntaxhighlighter .line.alt2 69 | { 70 | background-color: #0f0f0f !important; 71 | } 72 | 73 | .syntaxhighlighter .toolbar 74 | { 75 | background-color: #000000 !important; 76 | border: #000000 solid 1px !important; 77 | } 78 | 79 | .syntaxhighlighter .toolbar a 80 | { 81 | color: #646763 !important; 82 | } 83 | 84 | .syntaxhighlighter .toolbar a:hover 85 | { 86 | color: #9CCFF4 !important; 87 | } 88 | 89 | /************************************ 90 | * Actual syntax highlighter colors. 91 | ************************************/ 92 | .syntaxhighlighter .plain, 93 | .syntaxhighlighter .plain a 94 | { 95 | color: #D3D3D3 !important; 96 | } 97 | 98 | .syntaxhighlighter .comments, 99 | .syntaxhighlighter .comments a 100 | { 101 | color: #FF7D27 !important; 102 | } 103 | 104 | .syntaxhighlighter .string, 105 | .syntaxhighlighter .string a 106 | { 107 | color: #FF9E7B !important; 108 | } 109 | 110 | .syntaxhighlighter .keyword 111 | { 112 | color: #00FFFF !important; 113 | } 114 | 115 | .syntaxhighlighter .preprocessor 116 | { 117 | color: #AEC4DE !important; 118 | } 119 | 120 | .syntaxhighlighter .variable 121 | { 122 | color: #FFAA3E !important; 123 | } 124 | 125 | .syntaxhighlighter .value 126 | { 127 | color: #090 !important; 128 | } 129 | 130 | .syntaxhighlighter .functions 131 | { 132 | color: #81CEF9 !important; 133 | } 134 | 135 | .syntaxhighlighter .constants 136 | { 137 | color: #FF9E7B !important; 138 | } 139 | 140 | .syntaxhighlighter .script 141 | { 142 | background-color: #990000 !important; 143 | } 144 | 145 | .syntaxhighlighter .color1, 146 | .syntaxhighlighter .color1 a 147 | { 148 | color: #EBDB8D !important; 149 | } 150 | 151 | .syntaxhighlighter .color2, 152 | .syntaxhighlighter .color2 a 153 | { 154 | color: #FF7D27 !important; 155 | } 156 | 157 | .syntaxhighlighter .color3, 158 | .syntaxhighlighter .color3 a 159 | { 160 | color: #AEC4DE !important; 161 | } 162 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/repo.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Slippy Slides Repository 5 | 6 | 14 | 15 | 16 |

This is a Slippy Repository

17 | 18 |

You can find the sources for this application on github, and browse the available slide decks in the list below.

19 | 20 |
    21 | '; 24 | echo '

    25 | '.$deck['topic'].' 26 | Download 27 |

    '; 28 | if (isset($deck['date'])) { 29 | echo $deck['date']; 30 | } 31 | if (isset($deck['venue'])) { 32 | echo ' @ '.$deck['venue']; 33 | } 34 | echo ''; 35 | } 36 | ?> 37 |
38 | 39 | 40 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/slippy-dark.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Slippy 3 | * Copyright (C) 2010, Jordi Boggiano 4 | * http://seld.be/ - j.boggiano@seld.be 5 | * 6 | * Licensed under the new BSD License 7 | * See the LICENSE file for details 8 | */ 9 | /** 10 | * Slippy Dark Theme 11 | */ 12 | /** Core */ 13 | html, body { 14 | background: #000; 15 | color: #fff; 16 | } 17 | 18 | body { 19 | font-family: Tahoma, Verdana, sans-serif; 20 | } 21 | 22 | a, a:link, a:active, a:visited { 23 | color: #ff8; 24 | text-decoration: none; 25 | } 26 | 27 | a.eval { 28 | background-color: #eb1b1b; 29 | color: #000; 30 | margin: .2em .4em 0 0; 31 | } 32 | 33 | .slide { 34 | -moz-border-radius: 2em 0; 35 | -webkit-border-radius: 2em 0; 36 | border-radius: 2em 0; 37 | border: .1em solid #ccc; 38 | background: #242f53; 39 | } 40 | 41 | /** Overview screen */ 42 | .overview .slide.active { 43 | border: 0.5em solid #ffa; 44 | } 45 | .overviewWrapper:hover { 46 | position: relative; 47 | top: -.1em; 48 | left: -.1em; 49 | } 50 | 51 | /** Footer */ 52 | .footer { 53 | -moz-border-radius: .8em 0 2em; 54 | -webkit-border-radius: .8em 0 2em; 55 | border-radius: .8em 0 2em; 56 | border-top: .1em solid #ccc; 57 | border-left: .1em solid #ccc; 58 | left: -.1em; 59 | text-align: center; 60 | background: #1b233f; 61 | } 62 | .footerContent { 63 | font-size: .85em; 64 | padding: .5em 1em; 65 | } 66 | .footer span { 67 | margin: .25em 0; 68 | } 69 | 70 | /** Specific element styling */ 71 | .slide.big .slideContent > *:not(.footer) { 72 | font-size: 1.7em; 73 | } 74 | 75 | h1, h2, h3, h4 { 76 | margin: 0 0 .5em; 77 | font-size: 1.5em; 78 | font-weight: bold; 79 | } 80 | 81 | h1 { 82 | text-align: center; 83 | margin-top: 1em; 84 | } 85 | 86 | .vcenter h1 { 87 | margin-top: 0; 88 | } 89 | 90 | h2 { 91 | margin-bottom: .25em; 92 | font-size: 1.4em; 93 | } 94 | 95 | h3 { 96 | margin-bottom: .25em; 97 | font-size: 1.2em; 98 | } 99 | 100 | h4 { 101 | margin-bottom: .25em; 102 | font-size: 1.1em; 103 | } 104 | 105 | li { 106 | font-size: 1.2em; 107 | } 108 | 109 | p { 110 | margin:.25em 0; 111 | } 112 | 113 | ol, ul { 114 | list-style: disc outside none; 115 | margin-left: 2em; 116 | } 117 | 118 | ol { 119 | list-style-type: decimal; 120 | } 121 | 122 | /** References links */ 123 | a[rel=src] { 124 | font-size: .6em; 125 | } 126 | a[rel=src]:before { 127 | content: "ref:"; 128 | } 129 | 130 | /** Current slide indicator */ 131 | .slideDisplay { 132 | color: #aaa; 133 | padding: 1em; 134 | } 135 | 136 | /** TV Switcher */ 137 | .switcherDigits { 138 | color: #00ff00; 139 | font: bold 2em "Courier New", Courier, fixed, sans-serif; 140 | margin: .3em; 141 | } 142 | 143 | /** Alerts */ 144 | .alert { 145 | padding: .3em; 146 | margin: 0 0 12px 0; 147 | border: 2px solid #ccc; 148 | background: #242f53; 149 | color: #fff; 150 | -webkit-border-radius: .3em; 151 | -moz-border-radius: .3em; 152 | border-radius: .3em; 153 | } 154 | -------------------------------------------------------------------------------- /doc/realtime_analytics_at_ning/slippy/src/slippy-pure.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Slippy 3 | * Copyright (C) 2010, Jordi Boggiano 4 | * http://seld.be/ - j.boggiano@seld.be 5 | * 6 | * Licensed under the new BSD License 7 | * See the LICENSE file for details 8 | */ 9 | /** 10 | * Slippy Pure Theme 11 | */ 12 | 13 | /** Core */ 14 | body, html { 15 | background: #eee; 16 | color: #000; 17 | font-family: Tahoma,Verdana,sans-serif; 18 | } 19 | 20 | body, html { 21 | overflow: hidden; 22 | height: 100%; 23 | } 24 | 25 | a:visited, a:active, a:link, a { 26 | cursor: pointer; 27 | color: #622; 28 | } 29 | 30 | a.eval { 31 | background-color: #eb1b1b; 32 | color: #000; 33 | margin: .2em .4em 0 0; 34 | } 35 | 36 | /** Overview screen */ 37 | .overview .slide { 38 | -moz-border-radius: 2em; 39 | -webkit-border-radius: 2em; 40 | border-radius: 2em; 41 | border: 0.5em solid #ccc; 42 | } 43 | .overview .slide.active { 44 | border: 0.5em solid #888; 45 | } 46 | .overviewWrapper:hover { 47 | position: relative; 48 | top: -.1em; 49 | left: -.1em; 50 | } 51 | 52 | /** Footer */ 53 | .footer { 54 | bottom: 0; 55 | left: 0; 56 | text-align: center; 57 | } 58 | .footerContent { 59 | font-size: .85em; 60 | padding: .5em 1em; 61 | } 62 | .footer span { 63 | margin: .25em 0; 64 | } 65 | 66 | /** Specific element styling */ 67 | .slide.big .slideContent > *:not(.footer) { 68 | font-size: 1.7em; 69 | } 70 | 71 | h1, h2, h3, h4 { 72 | margin: 0 0 .5em; 73 | font-size: 1.5em; 74 | font-weight: bold; 75 | } 76 | 77 | h1 { 78 | text-align: center; 79 | margin-top: 1em; 80 | } 81 | 82 | .vcenter h1 { 83 | margin-top: 0; 84 | } 85 | 86 | h2 { 87 | margin-bottom: .25em; 88 | font-size: 1.4em; 89 | } 90 | 91 | h3 { 92 | margin-bottom: .25em; 93 | font-size: 1.2em; 94 | } 95 | 96 | h4 { 97 | margin-bottom: .25em; 98 | font-size: 1.1em; 99 | } 100 | 101 | em { 102 | font-style: normal; 103 | color: #ca0207; 104 | } 105 | 106 | li { 107 | font-size: 1.2em; 108 | } 109 | 110 | p { 111 | margin:.25em 0; 112 | } 113 | 114 | ol, ul { 115 | list-style: disc outside none; 116 | margin-left: 2em; 117 | } 118 | 119 | ol { 120 | list-style-type: decimal; 121 | } 122 | 123 | /** References links */ 124 | a[rel=src] { 125 | font-size: .6em; 126 | } 127 | a[rel=src]:before { 128 | content: "ref:"; 129 | } 130 | 131 | /** Current slide indicator */ 132 | .slideDisplay { 133 | color: #aaa; 134 | padding: 1em; 135 | } 136 | 137 | /** TV Switcher */ 138 | .switcherDigits { 139 | color: #00ff00; 140 | background: #000; 141 | top: 0; 142 | left: 0; 143 | position: absolute; 144 | display: inline; 145 | padding: .5em; 146 | font: bold 2em "Courier New", Courier, fixed, sans-serif; 147 | margin: .3em; 148 | } 149 | 150 | /** Alerts */ 151 | .alert { 152 | padding: .3em; 153 | margin: 0 0 12px 0; 154 | border: 2px solid #ccc; 155 | background: #fff; 156 | color: #000; 157 | -webkit-border-radius: .3em; 158 | -moz-border-radius: .3em; 159 | border-radius: .3em; 160 | font-size:1.2em; 161 | } 162 | 163 | @media print { 164 | .slide { 165 | text-shadow: #000 0 0 0; 166 | } 167 | } -------------------------------------------------------------------------------- /netezza/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 4.0.0 21 | 22 | com.ning 23 | metrics.realtime-parent 24 | 1.1.0-SNAPSHOT 25 | ../pom.xml 26 | 27 | com.ning 28 | metrics.realtime-netezza 29 | netezza 30 | jar 31 | 32 | 33 | com.espertech 34 | esper 35 | 36 | 37 | com.google.guava 38 | guava 39 | 40 | 41 | com.google.inject 42 | guice 43 | 44 | 45 | com.ning 46 | metrics.realtime-core 47 | 48 | 49 | org.slf4j 50 | slf4j-api 51 | 52 | 53 | org.netezza 54 | nzjdbc3 55 | 5.0.8-12182 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /netezza/src/main/java/com/ning/metrics/meteo/netezza/subscribers/NetezzaSubscriberConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010-2013 Ning, Inc. 3 | * 4 | * Ning licenses this file to you under the Apache License, version 2.0 5 | * (the "License"); you may not use this file except in compliance with the 6 | * License. You may obtain a copy of the License at: 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations 14 | * under the License. 15 | */ 16 | 17 | package com.ning.metrics.meteo.netezza.subscribers; 18 | 19 | import com.ning.metrics.meteo.subscribers.SubscriberConfig; 20 | 21 | public class NetezzaSubscriberConfig extends SubscriberConfig 22 | { 23 | public String sqlQuery; 24 | public String host; 25 | public int port = 5480; 26 | public String username; 27 | public String password; 28 | public String database; 29 | 30 | public String getHost() 31 | { 32 | return host; 33 | } 34 | 35 | public void setHost(final String host) 36 | { 37 | this.host = host; 38 | } 39 | 40 | public String getPassword() 41 | { 42 | return password; 43 | } 44 | 45 | public void setPassword(final String password) 46 | { 47 | this.password = password; 48 | } 49 | 50 | public int getPort() 51 | { 52 | return port; 53 | } 54 | 55 | public void setPort(final int port) 56 | { 57 | this.port = port; 58 | } 59 | 60 | public String getSqlQuery() 61 | { 62 | return sqlQuery; 63 | } 64 | 65 | public void setSqlQuery(final String sqlQuery) 66 | { 67 | this.sqlQuery = sqlQuery; 68 | } 69 | 70 | public String getDatabase() 71 | { 72 | return database; 73 | } 74 | 75 | public void setDatabase(final String database) 76 | { 77 | this.database = database; 78 | } 79 | 80 | public String getUsername() 81 | { 82 | return username; 83 | } 84 | 85 | public void setUsername(final String username) 86 | { 87 | this.username = username; 88 | } 89 | } 90 | --------------------------------------------------------------------------------