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
@POST | |
@Path("/metrics") | |
@Consumes({"application/json","application/xml"}) | |
public void addMetrics(@Suspended AsyncResponse asyncResponse, Collection<IdDataPoint> dataPoints) { | |
Set<RawNumericMetric> rawSet = new HashSet<>(dataPoints.size()); | |
for (IdDataPoint dataPoint : dataPoints) { | |
RawNumericMetric rawMetric = new RawNumericMetric(dataPoint.getId(), dataPoint.getValue(), | |
dataPoint.getTimestamp()); | |
rawSet.add(rawMetric); |
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 TYPE data_point (time timestamp, value map<int, double>); | |
CREATE TABLE tags ( | |
tag_name text, | |
tag_value text, | |
metric_id text, | |
values list<data_point>, | |
PRIMARY KEY (tag_name, tag_value, metric_id) | |
); |
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 void addData(final AsyncResponse asyncResponse, Set<RawNumericMetric> rawData) { | |
ListenableFuture<Map<RawNumericMetric,Throwable>> future = metricsService.addData(rawData); | |
Futures.addCallback(future, new FutureCallback<Map<RawNumericMetric, Throwable>>() { | |
@Override | |
public void onSuccess(Map<RawNumericMetric, Throwable> errors) { | |
Response jaxrs = Response.ok().type(MediaType.APPLICATION_JSON_TYPE).build(); | |
asyncResponse.resume(jaxrs); | |
} | |
@Override |
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 metrics ( | |
bucket text, | |
metric_id text, | |
time timestamp, | |
attributes map<text, text> static, | |
value map<int, double>, | |
PRIMARY KEY ((bucket, metric_id), time) | |
) |
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 RateLimitTest { | |
@Test | |
public void throttle() { | |
RateLimiter rateLimiter = RateLimiter.create(5, 5, TimeUnit.SECONDS); | |
for (int i = 0; i < 25; ++i) { | |
rateLimiter.acquire(); | |
System.out.println("i = " + i); | |
} | |
rateLimiter.setRate(1); |
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
# Cassandra storage config YAML | |
# NOTE: | |
# See http://wiki.apache.org/cassandra/StorageConfiguration for | |
# full explanations of configuration directives | |
# /NOTE | |
# The name of the cluster. This is mainly used to prevent machines in | |
# one logical cluster from joining another. | |
cluster_name: ${cluster.name} |
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 |
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
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
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 |