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 StateListenerTest { | |
private static final Log logger = LogFactory.getLog(StateListenerTest.class); | |
@Test | |
public void listenForStateChanges() throws Exception { | |
Cluster cluster = new ClusterBuilder() | |
.addContactPoints("127.0.0.1") | |
.withCredentials("rhqadmin", "rhqadmin") | |
.build(); |
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
Observable<Lease> leaseObservable = leaseService.find(timeSlice) | |
.filter(lease -> lease.getOwner() == null) | |
.map(lease -> lease.setOwner(owner)); | |
Observable<Boolean> acquiredObservable = leaseObservable.flatMap(leaseService::acquire) | |
.filter(acquired -> acquired); | |
Observable.zip(leaseObservable, acquiredObservable, ((lease, acquired) -> lease)) | |
.flatMap(lease -> findTasks(lease, taskType)) | |
.map(executeTasksSegment) | |
.flatMap(this::rescheduleTask) | |
.flatMap(taskContainer -> rxSession.execute(queries.deleteTasks.bind( |
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
@Path("/") | |
@Consumes(APPLICATION_JSON) | |
@Produces(APPLICATION_JSON) | |
public class AsyncHandler { | |
private static final ListeningExecutorService threadPool = MoreExecutors.listeningDecorator( | |
Executors.newFixedThreadPool(4)); | |
@POST | |
@Path("/{tenantId}/metrics/numeric/{id}/data") |
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 void addDataForMetric( | |
@Suspended final AsyncResponse asyncResponse, | |
@PathParam("tenantId") final String tenantId, @PathParam("id") String id, | |
@ApiParam(value = "List of datapoints containing timestamp and value", required = true) | |
List<NumericData> data | |
) { | |
Callable<Response> callable = () -> { | |
// long sleep = random.nextLong() % SLEEP; | |
// if (sleep > 0) { | |
// 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
class TestScriptBase { | |
@Override | |
Object run() { | |
return null | |
} | |
def execute() { | |
BigDecimal.metaClass.equals = { return true } | |
script() | |
} |
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
BigDecimal.metaClass.equals = { return compareTo(it); } |
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
mstruk: jsanda: sure, let's discuss it | |
08:02 jsanda: which means we also need to consider queries | |
08:02 mstruk: jsanda: yeah, in this case I hide something akin to stored procs behind /rhq-metrics/event-log endpoint | |
08:03 mstruk: jsanda: well … hardcoded in java ... | |
08:03 mstruk: jsanda: this needs to be made more generic | |
08:03 jsanda: yeah, i figured that, but it looks like a great start from what i saw | |
08:04 jsanda: not sure if it is a good starting point, but i'm looking at https://github.com/mstruk/rhq-metrics/blob/liveoak/core-api/src/main/java/org/rhq/metrics/core/LogEvent.java | |
08:04 jsanda: here's my first question | |
08:04 jsanda: what fields minimally describe an event? | |
08:05 mstruk: jsanda: for my purposes I have two types of events actually |
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
Tracing session: 0fc8fc00-6ff8-11e4-bd7b-33b208512135 | |
activity | timestamp | source | source_elapsed | |
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-----------+---------------- | |
execute_cql3_query | 09:26:33,539 | 127.0.0.1 | 0 | |
Parsing select * from metrics where bucket = 'raw' and metric_id = 'snert.local.bytes_in' and time >= '2014-11-01' and time < '2014-11-12 14:21:00-0500' LIMIT 10000; | 09:26:33,541 | 127.0.0.1 | 2296 | |
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 data ( | |
metric text, | |
time timeuuid, | |
attributes map<text, text> static, | |
value double, | |
PRIMARY KEY (metric, time) | |
); | |
CREATE TABLE grouped_data ( | |
group text, |
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
# Defines the number of tokens randomly assigned to a node on the ring. The more tokens, | |
# relative to other nodes, the larger the proportion of data that this node will store. You | |
# probably want all nodes to have the same number of tokens assuming they have equal | |
# hardware capability. Tokens are randomly generated with the expectation of an even | |
# distribution. With that said, there can be some variation. Either increasing this value | |
# or increasing the number of nodes in the cluster will help even out the distribution. | |
rhq.storage.num-tokens=256 | |
# A comma-delimited list of IP addresses/host names that are deemed contact points. | |
# Cassandra nodes use this list of hosts to find each other and learn the |