Source:
public void insertMetrics(Collection<IMetric> metrics, ColumnFamily cf) throws ConnectionException { Timer.Context ctx = Instrumentation.getWriteTimerContext(cf.getName()); Multimap<Locator, IMetric> map = asMultimap(metrics); MutationBatch batch = keyspace.prepareMutationBatch(); try { for (Locator locator : map.keySet()) { ColumnListMutation<Long> mutation = batch.withRow(cf, locator); boolean locatorInsertOk = false; for (IMetric metric : map.get(locator)) { boolean shouldPersist = true; if (metric instanceof Metric) { final boolean isString = DataType.isStringMetric(metric.getMetricValue()); final boolean isBoolean = DataType.isBooleanMetric(metric.getMetricValue()); if (!isString && !isBoolean) locatorInsertOk = true; shouldPersist = shouldPersist((Metric)metric); } else { if (DataType.isEnumMetric(metric.getMetricValue())) { insertEnumValuesWithHashcodes(metric.getLocator(), (BluefloodEnumRollup) metric.getMetricValue(), batch); } locatorInsertOk = true; } if (shouldPersist) { mutation.putColumn( metric.getCollectionTime(), metric.getMetricValue(), (AbstractSerializer) (Serializers.serializerFor(metric.getMetricValue().getClass())), metric.getTtlInSeconds()); Instrumentation.markFullResPreaggregatedMetricWritten(); } } if (!AstyanaxWriter.isLocatorCurrent(locator)) { if (locatorInsertOk) insertLocator(locator, batch); AstyanaxWriter.setLocatorCurrent(locator); } } try { batch.execute(); } catch (ConnectionException e) { Instrumentation.markWriteError(e); log.error("Connection exception persisting data", e); throw e; } } finally { ctx.stop(); } }

Target:
public void insertMetrics(Collection<IMetric> metrics, ColumnFamily cf) throws ConnectionException { Timer.Context ctx = Instrumentation.getWriteTimerContext(cf.getName()); Multimap<Locator, IMetric> map = asMultimap(metrics); MutationBatch batch = keyspace.prepareMutationBatch(); try { for (Locator locator : map.keySet()) { ColumnListMutation<Long> mutation = batch.withRow(cf, locator); boolean locatorInsertOk = false; for (IMetric metric : map.get(locator)) { boolean shouldPersist = true; if (metric instanceof Metric) { final boolean isString = DataType.isStringMetric(metric.getMetricValue()); final boolean isBoolean = DataType.isBooleanMetric(metric.getMetricValue()); if (!isString && !isBoolean) locatorInsertOk = true; shouldPersist = shouldPersist((Metric)metric); } else { if (DataType.isEnumMetric(metric.getMetricValue())) { insertEnumValuesWithHashcodes(metric.getLocator(), (BluefloodEnumRollup) metric.getMetricValue(), batch); } locatorInsertOk = true; } if (shouldPersist) { mutation.putColumn( metric.getCollectionTime(), metric.getMetricValue(), (AbstractSerializer) (Serializers.serializerFor(metric.getMetricValue().getClass())), metric.getTtlInSeconds()); if (cf.getName().equals(CassandraModel.CF_METRICS_PREAGGREGATED_FULL_NAME)) { Instrumentation.markFullResPreaggregatedMetricWritten(); } } } if (!AstyanaxWriter.isLocatorCurrent(locator)) { if (locatorInsertOk) insertLocator(locator, batch); AstyanaxWriter.setLocatorCurrent(locator); } } try { batch.execute(); } catch (ConnectionException e) { Instrumentation.markWriteError(e); log.error("Connection exception persisting data", e); throw e; } } finally { ctx.stop(); } }