Skip to content
This repository was archived by the owner on Mar 27, 2021. It is now read-only.

Commit 6ef8d4b

Browse files
committed
[core] Close fetch / fetchSeries spans
1 parent 6353fef commit 6ef8d4b

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

heroic-component/src/main/java/com/spotify/heroic/tracing/EndSpanFutureReporter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ public EndSpanFutureReporter(final Span span) {
3636
}
3737

3838
@Override
39-
public void failed(final Throwable cause) throws Exception {
39+
public void failed(final Throwable cause) {
4040
span.putAttribute("error", booleanAttributeValue(true));
4141
Optional.ofNullable(cause.getMessage()).ifPresent(span::addAnnotation);
4242
span.setStatus(Status.INTERNAL);
4343
span.end();
4444
}
4545

4646
@Override
47-
public void resolved(final Object result) throws Exception {
47+
public void resolved(final Object result) {
4848
span.end();
4949
}
5050

5151
@Override
52-
public void cancelled() throws Exception {
52+
public void cancelled() {
5353
span.putAttribute("error", booleanAttributeValue(true));
5454
span.setStatus(Status.CANCELLED);
5555
span.end();

heroic-core/src/main/java/com/spotify/heroic/metric/LocalMetricManager.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
import javax.inject.Inject;
8080
import javax.inject.Named;
8181
import org.apache.commons.lang3.NotImplementedException;
82-
import org.slf4j.Logger;
8382

8483
@MetricScope
8584
public class LocalMetricManager implements MetricManager {
@@ -88,7 +87,6 @@ public class LocalMetricManager implements MetricManager {
8887
QueryTrace.identifier(LocalMetricManager.class, "query");
8988
private static final QueryTrace.Identifier FETCH =
9089
QueryTrace.identifier(LocalMetricManager.class, "fetch");
91-
private static final Logger log = org.slf4j.LoggerFactory.getLogger(LocalMetricManager.class);
9290

9391
private final OptionalLimit groupLimit;
9492
private final OptionalLimit seriesLimit;
@@ -231,7 +229,7 @@ private Transform(
231229
}
232230

233231
@Override
234-
public AsyncFuture<FullQuery> transform(final FindSeries result) throws Exception {
232+
public AsyncFuture<FullQuery> transform(final FindSeries result) {
235233
final Span fetchSpan = tracer.spanBuilderWithExplicitParent(
236234
"localMetricsManager.fetch", parentSpan).startSpan();
237235
final ResultLimits limits;
@@ -255,8 +253,12 @@ public AsyncFuture<FullQuery> transform(final FindSeries result) throws Exceptio
255253
limits = ResultLimits.of();
256254
}
257255

258-
/* if empty, there are not time series on this shard */
256+
/* if empty, there are no time series on this shard */
259257
if (result.isEmpty()) {
258+
259+
fetchSpan.putAttribute("resultEmpty", booleanAttributeValue(true));
260+
fetchSpan.end();
261+
260262
return async.resolved(FullQuery.empty(namedWatch.end(), limits));
261263
}
262264

0 commit comments

Comments
 (0)