diff --git a/heroic-component/src/main/java/com/spotify/heroic/tracing/EndSpanFutureReporter.java b/heroic-component/src/main/java/com/spotify/heroic/tracing/EndSpanFutureReporter.java index 3bb7ffd49..87759d510 100644 --- a/heroic-component/src/main/java/com/spotify/heroic/tracing/EndSpanFutureReporter.java +++ b/heroic-component/src/main/java/com/spotify/heroic/tracing/EndSpanFutureReporter.java @@ -36,7 +36,7 @@ public EndSpanFutureReporter(final Span span) { } @Override - public void failed(final Throwable cause) throws Exception { + public void failed(final Throwable cause) { span.putAttribute("error", booleanAttributeValue(true)); Optional.ofNullable(cause.getMessage()).ifPresent(span::addAnnotation); span.setStatus(Status.INTERNAL); @@ -44,12 +44,12 @@ public void failed(final Throwable cause) throws Exception { } @Override - public void resolved(final Object result) throws Exception { + public void resolved(final Object result) { span.end(); } @Override - public void cancelled() throws Exception { + public void cancelled() { span.putAttribute("error", booleanAttributeValue(true)); span.setStatus(Status.CANCELLED); span.end(); diff --git a/heroic-core/src/main/java/com/spotify/heroic/metric/LocalMetricManager.java b/heroic-core/src/main/java/com/spotify/heroic/metric/LocalMetricManager.java index 29de801d7..761a29f66 100644 --- a/heroic-core/src/main/java/com/spotify/heroic/metric/LocalMetricManager.java +++ b/heroic-core/src/main/java/com/spotify/heroic/metric/LocalMetricManager.java @@ -82,7 +82,6 @@ import javax.inject.Inject; import javax.inject.Named; import org.apache.commons.lang3.NotImplementedException; -import org.slf4j.Logger; @MetricScope public class LocalMetricManager implements MetricManager { @@ -91,7 +90,6 @@ public class LocalMetricManager implements MetricManager { QueryTrace.identifier(LocalMetricManager.class, "query"); private static final QueryTrace.Identifier FETCH = QueryTrace.identifier(LocalMetricManager.class, "fetch"); - private static final Logger log = org.slf4j.LoggerFactory.getLogger(LocalMetricManager.class); private final OptionalLimit groupLimit; private final OptionalLimit seriesLimit; @@ -236,7 +234,7 @@ private Transform( } @Override - public AsyncFuture transform(final FindSeries result) throws Exception { + public AsyncFuture transform(final FindSeries result) { final Span fetchSpan = tracer.spanBuilderWithExplicitParent( "localMetricsManager.fetch", parentSpan).startSpan(); final ResultLimits limits; @@ -260,8 +258,13 @@ public AsyncFuture transform(final FindSeries result) throws Exceptio limits = ResultLimits.of(); } - /* if empty, there are not time series on this shard */ + /* if empty, there are no time series on this shard */ if (result.isEmpty()) { + + fetchSpan.addAnnotation("There are no time series on this shard"); + fetchSpan.putAttribute("resultEmpty", booleanAttributeValue(true)); + fetchSpan.end(); + return async.resolved(FullQuery.empty(namedWatch.end(), limits)); }