continue;
}
// todo: per-line instrumentation starts here.
CheckFromJson checkFromJson = gson.fromJson(line, CheckFromJson.class);
if (!CheckFromJson.isValid(checkFromJson)) {
invalidMetricsCounter.inc();
} else {
for (String metricName : checkFromJson.getMetricNames()) {
MetricPoint metricPoint = checkFromJson.getMetric(metricName);
// Bail out for string metrics
if(metricPoint.getType() == String.class) {
line = reader.readLine();
continue;
}
Locator metricLocator;
if(checkFromJson.getCheckType().contains("remote")) {
String longMetricName = String.format("%s.rackspace.monitoring.entities.%s.checks.%s.%s.%s.%s",
checkFromJson.getTenantId(),
checkFromJson.getEntityId(),
checkFromJson.getCheckType(),
checkFromJson.getCheckId(),
checkFromJson.getMonitoringZoneId(),
metricName).trim();
metricLocator = Locator.createLocatorFromDbKey(longMetricName);
} else {
String longMetricName = String.format("%s.rackspace.monitoring.entities.%s.checks.%s.%s.%s",
checkFromJson.getTenantId(),
checkFromJson.getEntityId(),
checkFromJson.getCheckType(),
checkFromJson.getCheckId(),
metricName).trim();
metricLocator = Locator.createLocatorFromDbKey(longMetricName);
}
if (!shardsToBackfill.contains(Util.computeShard(metricLocator.toString()))) {
line = reader.readLine();
continue;
}
long timestamp = checkFromJson.getTimestamp();
long snappedMillis = Granularity.MIN_5.snapMillis(timestamp);
Range rangeOfThisTimestamp = new Range(snappedMillis, snappedMillis + Granularity.MIN_5.milliseconds() - 1);
//Do not add timestamps that lie out of range