This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from org.rhq.cassandra.schema import SchemaManager | |
if project.properties['db'] == 'dev': | |
self.log('PERFORMING STORAGE NODE SETUP TO LATEST SCHEMA') | |
username = project.properties.get('rhq.dev.cassandra.username', 'cassandra') | |
password = project.properties.get('rhq.dev.cassandra.password', 'cassandra') | |
seeds = project.properties.get('rhq.dev.cassandra.seeds', '127.0.0.1|9160|9142') | |
schemaManager = SchemaManager(username, password, seeds) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
importClass(org.rhq.cassandra.schema.SchemaManager); | |
if (project.properties['db'] == 'dev') { | |
self.log('PERFORMING STORAGE NODE SETUP TO LATEST SCHEMA'); | |
username = project.properties['rhq.dev.cassandra.username'] ? project.properties['rhq.dev.cassandra.username'] : 'cassandra'; | |
password = project.properties['rhq.dev.cassandra.password'] ? project.properties['rhq.dev.cassandra.password'] : 'cassandra'; | |
seeds = project.properties['rhq.dev.cassandra.seeds'] ? project.properties['rhq.dev.cassandra.seeds'] : '127.0.0.1|9160|9142'; | |
schemaManager = SchemaManager(username, password, seeds); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1"> | |
<!-- Explicitly indicate that we do not want sub deployments isolated; subdeployments need to see each other's classes --> | |
<ear-subdeployments-isolated>false</ear-subdeployments-isolated> | |
<!-- This corresponds to the top level deployment - which in this case in the EAR module --> | |
<deployment> | |
<dependencies> | |
<module name="org.jboss.common-core" export="true" /> <!-- needed to fix https://issues.jboss.org/browse/AS7-5336 --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SnappyNativeLoader | |
{ | |
private static HashMap<String, Boolean> loadedLibFiles = new HashMap<String, Boolean>(); | |
private static HashMap<String, Boolean> loadedLib = new HashMap<String, Boolean>(); | |
public static synchronized void load(String lib) { | |
if (loadedLibFiles.containsKey(lib) && loadedLibFiles.get(lib) == true) | |
return; | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns rhq.rest.client | |
(:require [clojure.data.json :as json]) | |
(:require [clj-http.client :as http])) | |
(def server-url "http://localhost:7080/rest/") | |
(def schedule-types | |
{:trait "TRAIT" | |
:numeric "MEASUREMENT"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns immutant.init | |
(:use immutant-demo.core) | |
(:require [immutant.web :as web] | |
[immutant.jobs :as jobs] | |
[rhq.rest.client :as rhq] | |
[clojure.tools.logging :as logging])) | |
(web/start ring-handler) | |
(web/start "/biscuits" another-ring-handler) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE rhq.raw_metrics ( | |
schedule_id int, | |
time timestamp, | |
value double, | |
PRIMARY KEY (schedule_id, time) | |
) WITH COMPACT STORAGE; | |
CREATE TABLE rhq.one_hour_metrics ( | |
schedule_id int, | |
time timestamp, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ServerTest extends MetricsTest { | |
private static final int TTL = 360; | |
private PlatformManager platformManager; | |
private DataAccess dataAccess; | |
private RawMetricMapper rawMapper; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test//(dependsOnMethods = "insertMetricsForOneId") | |
public void findRawMetricsForSingleId() throws Exception { | |
final String metricId = UUID.randomUUID().toString(); | |
long timestamp1 = System.currentTimeMillis(); | |
double value1 = 2.17; | |
ResultSetFuture insertFuture = dataAccess.insertData("raw", metricId, timestamp1, | |
ImmutableMap.of(DataType.RAW.ordinal(), value1), TTL); | |
// wait for the insert to finish | |
getUninterruptibly(insertFuture); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private AggregateNumericMetric calculateAggregate(Iterable<AggregateNumericMetric> metrics, long timestamp) { | |
double min = Double.NaN; | |
double max = min; | |
int count = 0; | |
ArithmeticMeanCalculator mean = new ArithmeticMeanCalculator(); | |
for (AggregateNumericMetric metric : metrics) { | |
if (count == 0) { | |
min = metric.getMin(); | |
max = metric.getMax(); |