Commit 1bea6f2f authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Add logging for calls to Future::via

Summary: Adds sampled logging to track executors passed to Future::via.

Reviewed By: andriigrynenko

Differential Revision: D18233242

fbshipit-source-id: b5c004f643261a36fd0b63fb6e033263ece1662f
parent f6ac9ac1
......@@ -25,6 +25,7 @@
#include <folly/Optional.h>
#include <folly/Traits.h>
#include <folly/detail/AsyncTrace.h>
#include <folly/executors/ExecutorWithPriority.h>
#include <folly/executors/InlineExecutor.h>
#include <folly/executors/QueuedImmediateExecutor.h>
......@@ -720,6 +721,8 @@ SemiFuture<T>& SemiFuture<T>::operator=(Future<T>&& other) noexcept {
template <class T>
Future<T> SemiFuture<T>::via(Executor::KeepAlive<> executor) && {
folly::async_tracing::logSemiFutureVia(this->getExecutor(), executor.get());
if (!executor) {
throw_exception<FutureNoExecutor>();
}
......@@ -906,6 +909,8 @@ typename std::
template <class T>
Future<T> Future<T>::via(Executor::KeepAlive<> executor) && {
folly::async_tracing::logFutureVia(this->getExecutor(), executor.get());
this->setExecutor(std::move(executor));
auto newFuture = Future<T>(this->core_);
......@@ -921,6 +926,8 @@ Future<T> Future<T>::via(Executor::KeepAlive<> executor, int8_t priority) && {
template <class T>
Future<T> Future<T>::via(Executor::KeepAlive<> executor) & {
folly::async_tracing::logFutureVia(this->getExecutor(), executor.get());
this->throwIfInvalid();
Promise<T> p;
auto sf = p.getSemiFuture();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment