-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix testLatestDeps * Fix play-2.6 testLatestDeps too
- Loading branch information
Showing
5 changed files
with
60 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
...in/java/io/opentelemetry/javaagent/instrumentation/play/v2_6/RequestCompleteCallback.java
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
...main/java/io/opentelemetry/javaagent/instrumentation/play/v2_6/ResponseFutureWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.play.v2_6; | ||
|
||
import static io.opentelemetry.javaagent.instrumentation.play.v2_6.PlayTracer.tracer; | ||
|
||
import io.opentelemetry.context.Context; | ||
import play.api.mvc.Result; | ||
import scala.concurrent.ExecutionContext; | ||
import scala.concurrent.Future; | ||
import scala.runtime.AbstractFunction1; | ||
|
||
public class ResponseFutureWrapper { | ||
|
||
public static Future<Result> wrap( | ||
Future<Result> future, Context context, ExecutionContext executionContext) { | ||
|
||
return future.transform( | ||
new AbstractFunction1<Result, Result>() { | ||
@Override | ||
public Result apply(Result result) { | ||
tracer().end(context); | ||
return result; | ||
} | ||
}, | ||
new AbstractFunction1<Throwable, Throwable>() { | ||
@Override | ||
public Throwable apply(Throwable throwable) { | ||
tracer().endExceptionally(context, throwable); | ||
return throwable; | ||
} | ||
}, | ||
executionContext); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters