Skip to content

Commit

Permalink
[HWKMETRICS-478] Adding additional logging for max size.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Negrea committed Sep 30, 2016
1 parent 0d75f46 commit 874c673
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -30,6 +30,8 @@
import java.util.Set;
import java.util.function.BiFunction;

import org.hawkular.metrics.core.service.log.CoreLogger;
import org.hawkular.metrics.core.service.log.CoreLogging;
import org.hawkular.metrics.core.service.transformers.BatchStatementTransformer;
import org.hawkular.metrics.model.AvailabilityType;
import org.hawkular.metrics.model.DataPoint;
Expand Down Expand Up @@ -57,6 +59,8 @@
*/
public class DataAccessImpl implements DataAccess {

private static final CoreLogger log = CoreLogging.getCoreLogger(DataAccessImpl.class);

public static final long DPART = 0;
private Session session;

Expand Down Expand Up @@ -574,6 +578,8 @@ public Observable<Integer> insertStringData(Metric<String> metric, int maxSize)
public Observable<Integer> insertStringData(Metric<String> metric, int ttl, int maxSize) {
return Observable.from(metric.getDataPoints())
.map(dataPoint -> {
log.infoMaxSizeStringMetrics(maxSize);

if (maxSize != -1 && dataPoint.getValue().length() > maxSize) {
throw new IllegalArgumentException(dataPoint + " exceeds max string length of " + maxSize +
" characters");
Expand Down

0 comments on commit 874c673

Please sign in to comment.