Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 82 additions & 6 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# Startup options cannot be selected via config.
startup --host_jvm_args=-Xmx2g

build --workspace_status_command=bazel/get_workspace_status
build --workspace_status_command="bash bazel/get_workspace_status"
build --experimental_local_memory_estimate
build --experimental_strict_action_env=true
build --host_force_python=PY2
build --host_force_python=PY3
build --action_env=BAZEL_LINKLIBS=-l%:libstdc++.a
build --action_env=BAZEL_LINKOPTS=-lm
build --host_javabase=@bazel_tools//tools/jdk:remote_jdk11
Expand Down Expand Up @@ -113,6 +113,28 @@ build:sizeopt -c opt --copt -Os
# Test options
build --test_env=HEAPCHECK=normal --test_env=PPROF_PATH

# Coverage options
coverage --config=coverage
build:coverage --action_env=BAZEL_USE_LLVM_NATIVE_COVERAGE=1
build:coverage --action_env=GCOV=llvm-profdata
build:coverage --copt=-DNDEBUG
build:coverage --test_timeout=900
build:coverage --define=ENVOY_CONFIG_COVERAGE=1
build:coverage --cxxopt="-DENVOY_CONFIG_COVERAGE=1"
build:coverage --coverage_support=@envoy//bazel/coverage:coverage_support
build:coverage --test_env=CC_CODE_COVERAGE_SCRIPT=external/envoy/bazel/coverage/collect_cc_coverage.sh
build:coverage --test_env=HEAPCHECK=
build:coverage --combined_report=lcov
build:coverage --strategy=TestRunner=sandboxed,local
build:coverage --strategy=CoverageReport=sandboxed,local
build:coverage --experimental_use_llvm_covmap
build:coverage --collect_code_coverage
build:coverage --instrumentation_filter="//source(?!/common/chromium_url|/extensions/quic_listeners/quiche/platform)[/:],//include[/:]"
coverage:test-coverage --test_arg="--log-path /dev/null"
coverage:test-coverage --test_arg="-l trace"
coverage:fuzz-coverage --config=asan-fuzzer
coverage:fuzz-coverage --run_under=@envoy//bazel/coverage:fuzz_coverage_wrapper.sh

# Remote execution: https://docs.bazel.build/versions/master/remote-execution.html
build:rbe-toolchain --host_platform=@envoy_build_tools//toolchains:rbe_ubuntu_clang_platform
build:rbe-toolchain --platforms=@envoy_build_tools//toolchains:rbe_ubuntu_clang_platform
Expand Down Expand Up @@ -161,8 +183,8 @@ build:remote-msan --config=rbe-toolchain-clang-libc++
build:remote-msan --config=rbe-toolchain-msan

# Docker sandbox
# NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/master/toolchains/rbe_toolchains_config.bzl#L7
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu@sha256:3788a87461f2b3dc8048ad0ce5df40438a56e0a8f1a4ab0f61b4ef0d8c11ff1f
# NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/master/toolchains/rbe_toolchains_config.bzl#L8
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:04f06115b6ee7cfea74930353fb47a41149cbec3
build:docker-sandbox --spawn_strategy=docker
build:docker-sandbox --strategy=Javac=docker
build:docker-sandbox --strategy=Closure=docker
Expand Down Expand Up @@ -191,10 +213,64 @@ build:remote-ci --remote_executor=grpcs://remotebuildexecution.googleapis.com
# Fuzz builds
build:asan-fuzzer --config=clang-asan
build:asan-fuzzer --define=FUZZING_ENGINE=libfuzzer
build:asan-fuzzer --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
build:asan-fuzzer --copt=-fsanitize=fuzzer-no-link
build:asan-fuzzer --copt=-fno-omit-frame-pointer
build:asan-fuzzer --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
# Remove UBSAN halt_on_error to avoid crashing on protobuf errors.
build:asan-fuzzer --test_env=UBSAN_OPTIONS=print_stacktrace=1

# Fuzzing without ASAN. This is useful for profiling fuzzers without any ASAN artifacts.
build:plain-fuzzer --define=FUZZING_ENGINE=libfuzzer
build:plain-fuzzer --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
build:plain-fuzzer --copt=-fsanitize=fuzzer-no-link

# Compile database generation config
# We don't care about built binaries so always strip and use fastbuild.
build:compdb -c fastbuild
build:compdb --strip=always
build:compdb --build_tag_filters=-nocompdb
build:compdb --define=ENVOY_CONFIG_COMPILATION_DATABASE=1

# Windows build quirks
build:windows --action_env=TMPDIR
build:windows --define signal_trace=disabled
build:windows --define hot_restart=disabled
build:windows --define tcmalloc=disabled
build:windows --define manual_stamp=manual_stamp

# Should not be required after upstream fix to bazel,
# and already a no-op to linux/macos builds
# see issue https://github.com/bazelbuild/rules_foreign_cc/issues/301
build:windows --copt="-DCARES_STATICLIB"
build:windows --copt="-DNGHTTP2_STATICLIB"
build:windows --copt="-DCURL_STATICLIB"

# Required to work around build defects on Windows MSVC cl
# Unguarded gcc pragmas in quiche are not recognized by MSVC
build:msvc-cl --copt="/wd4068"
# Allows 'nodiscard' function return values to be discarded
build:msvc-cl --copt="/wd4834"
# Allows inline functions to be undefined
build:msvc-cl --copt="/wd4506"
build:msvc-cl --copt="-D_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING"

# Required to work around Windows clang-cl build defects
# Ignore conflicting definitions of _WIN32_WINNT
# Overriding __TIME__ etc is problematic (and is actually an invalid no-op)
build:clang-cl --copt="-Wno-macro-redefined"
build:clang-cl --copt="-Wno-builtin-macro-redefined"
build:clang-cl --action_env=USE_CLANG_CL=1

# Defaults to 'auto' - Off for windows, so override to linux behavior
build:windows --enable_runfiles=yes

# This should become adopted by bazel as the default
build:windows --features=compiler_param_file

# These options attempt to force a monolithic binary including the CRT
build:windows --features=fully_static_link
build:windows --features=static_link_msvcrt
build:windows --dynamic_mode=off

try-import %workspace%/clang.bazelrc
try-import %workspace%/user.bazelrc
try-import %workspace%/user.bazelrc
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.0
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
references:
envoy-build-image: &envoy-build-image
# Jan 9th, 2020
envoyproxy/envoy-build-ubuntu@sha256:3788a87461f2b3dc8048ad0ce5df40438a56e0a8f1a4ab0f61b4ef0d8c11ff1f
envoyproxy/envoy-build-ubuntu:04f06115b6ee7cfea74930353fb47a41149cbec3
version: 2
jobs:
build:
Expand Down
4 changes: 4 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ load("@envoy//bazel:repositories.bzl", "envoy_dependencies")

envoy_dependencies()

load("@envoy//bazel:repositories_extra.bzl", "envoy_dependencies_extra")

envoy_dependencies_extra()

load("@envoy//bazel:dependency_imports.bzl", "envoy_dependency_imports")

envoy_dependency_imports()
Expand Down
14 changes: 2 additions & 12 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

ENVOY_COMMIT = "3a2512d923e2eee1fce9f4f6a23cf93f2e7ed93f" # March 1st, 2020
ENVOY_SHA = "6a643ae3141762c403aa031cc19e65c441759785fd7dda51dcf5ad5f149283d0"

RULES_PYTHON_COMMIT = "dd7f9c5f01bafbfea08c44092b6b0c8fc8fcb77f" # Feb 22nd, 2020
RULES_PYTHON_SHA = "0aa9ec790a58053e3ab5af397879b267a625955f8297c239b2d8559c6773397b"
ENVOY_COMMIT = "74290ef76a76fbbf50f072dc33438791f93f68c7" # May 25th, 2020
ENVOY_SHA = "123ad63c7081f2575aa08a5038d2302d7def3ea5d86cc4dd274757b597212446"

HDR_HISTOGRAM_C_VERSION = "0.9.13" # Feb 22nd, 2020
HDR_HISTOGRAM_C_SHA = "2bd4a4631b64f2f8cf968ef49dd03ff3c51b487c3c98a01217ae4cf4a35b8310"
Expand Down Expand Up @@ -55,10 +52,3 @@ cc_library(
strip_prefix = "HdrHistogram_c-%s" % HDR_HISTOGRAM_C_VERSION,
url = "https://github.com/HdrHistogram/HdrHistogram_c/archive/%s.tar.gz" % HDR_HISTOGRAM_C_VERSION,
)

http_archive(
name = "io_bazel_rules_python",
sha256 = RULES_PYTHON_SHA,
strip_prefix = "rules_python-%s" % RULES_PYTHON_COMMIT,
url = "https://github.com/bazelbuild/rules_python/archive/%s.tar.gz" % RULES_PYTHON_COMMIT,
)
19 changes: 14 additions & 5 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,20 @@ function do_asan() {
echo "bazel ASAN/UBSAN debug build with tests"
echo "Building and testing envoy tests..."
cd "${SRCDIR}"
run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan //test/...

# We build this in steps to avoid running out of memory in CI
run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/exe/... && \
run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //source/server/... && \
run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/mocks/... && \
run_bazel build ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/... && \
run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-asan -- //test/...
}

function do_tsan() {
echo "bazel TSAN debug build with tests"
echo "Building and testing envoy tests..."
cd "${SRCDIR}"
[ -z "$CIRCLECI" ] || export BAZEL_BUILD_OPTIONS="${BAZEL_TEST_OPTIONS} --local_ram_resources=12288"
run_bazel test ${BAZEL_TEST_OPTIONS} -c dbg --config=clang-tsan //test/...
}

Expand Down Expand Up @@ -115,6 +122,12 @@ if [ -n "$CIRCLECI" ]; then
fi
# We constrain parallelism in CI to avoid running out of memory.
NUM_CPUS=8
if [[ "$1" == "asan" ]]; then
NUM_CPUS=5
fi
if [[ "$1" == "coverage" ]]; then
NUM_CPUS=3
fi
fi

if grep 'docker\|lxc' /proc/1/cgroup; then
Expand Down Expand Up @@ -177,10 +190,6 @@ case "$1" in
exit 0
;;
asan)
if [ -n "$CIRCLECI" ]; then
# Decrease parallelism to avoid running out of memory
NUM_CPUS=7
fi
do_asan
exit 0
;;
Expand Down
12 changes: 10 additions & 2 deletions ci/docker/docker_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ fi
DOCKER_IMAGE_PREFIX="${DOCKER_IMAGE_PREFIX:-envoyproxy/nighthawk}"

# push the nighthawk image on tags or merge to master
if [[ -n "$CIRCLE_TAG" ]] || [[ "$CIRCLE_BRANCH" = 'master' ]]; then
if [[ "$CIRCLE_BRANCH" = 'master' ]]; then
docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD"
docker push "${DOCKER_IMAGE_PREFIX}-dev:latest"
docker tag "${DOCKER_IMAGE_PREFIX}-dev:latest" "${DOCKER_IMAGE_PREFIX}-dev:${CIRCLE_SHA1}"
docker push "${DOCKER_IMAGE_PREFIX}-dev:${CIRCLE_SHA1}"
else
echo 'Ignoring non-master branch for docker push.'
if [[ -n "$CIRCLE_TAG" ]]; then
TAG="$CIRCLE_TAG"
docker login -u "$DOCKERHUB_USERNAME" -p "$DOCKERHUB_PASSWORD"
docker push "${DOCKER_IMAGE_PREFIX}:${TAG}"
docker tag "${DOCKER_IMAGE_PREFIX}:${TAG}" "${DOCKER_IMAGE_PREFIX}:${TAG}"
docker push "${DOCKER_IMAGE_PREFIX}:${TAG}"
else
echo 'Ignoring non-master branch for docker push.'
fi
fi
31 changes: 28 additions & 3 deletions include/nighthawk/client/factories.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,44 @@ namespace Client {
class BenchmarkClientFactory {
public:
virtual ~BenchmarkClientFactory() = default;

/**
* Constructs a BenchmarkClient
*
* @param api reference to the Api object.
* @param dispatcher supplies the owning thread's dispatcher.
* @param scope stats scope for any stats tracked by the benchmark client.
* @param cluster_manager Cluster manager preconfigured with our target cluster.
* @param http_tracer Shared pointer to an http tracer implementation (e.g. Zipkin).
* @param cluster_name Name of the cluster that this benchmark client will use. In conjunction
* with cluster_manager this will allow the this BenchmarkClient to access the target connection
* pool.
* @param request_source Source of request-specifiers. Will be queries every time the
* BenchmarkClient is asked to issue a request.
*
* @return BenchmarkClientPtr pointer to a BenchmarkClient instance.
*/
virtual BenchmarkClientPtr create(Envoy::Api::Api& api, Envoy::Event::Dispatcher& dispatcher,
Envoy::Stats::Scope& scope,
Envoy::Upstream::ClusterManagerPtr& cluster_manager,
Envoy::Tracing::HttpTracerPtr& http_tracer,
Envoy::Tracing::HttpTracerSharedPtr& http_tracer,
absl::string_view cluster_name,
RequestSource& request_generator) const PURE;
RequestSource& request_source) const PURE;
};

class OutputFormatterFactory {
public:
virtual ~OutputFormatterFactory() = default;

/**
* Constructs an OutputFormatter instance according to the requested output format.
*
* @param options Proto configuration object indicating the desired output format.
*
* @return OutputFormatterPtr pointer to an OutputFormatter instance.
*/
virtual OutputFormatterPtr
create(const nighthawk::client::OutputFormat_OutputFormatOptions) const PURE;
create(const nighthawk::client::OutputFormat_OutputFormatOptions options) const PURE;
};

} // namespace Client
Expand Down
13 changes: 13 additions & 0 deletions include/nighthawk/client/output_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ namespace Client {
class OutputCollector {
public:
virtual ~OutputCollector() = default;

/**
* Adds a result to the structured output.
*
* @param name unique name of the result. E.g. worker_1.
* @param statistics Reference to a vector of statistics to add to the output.
* @param counters Reference to a map of counter values, keyed by name, to add to the output.
* @param execution_duration Execution duration associated to the to-be-added result.
*/
virtual void addResult(absl::string_view name, const std::vector<StatisticPtr>& statistics,
const std::map<std::string, uint64_t>& counters,
const std::chrono::nanoseconds execution_duration) PURE;
Expand All @@ -24,6 +33,10 @@ class OutputCollector {
* @param output the output value to set.
*/
virtual void setOutput(const nighthawk::client::Output& output) PURE;

/**
* @return nighthawk::client::Output proto output object.
*/
virtual nighthawk::client::Output toProto() const PURE;
};

Expand Down
5 changes: 5 additions & 0 deletions include/nighthawk/client/output_formatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ namespace Client {
class OutputFormatter {
public:
virtual ~OutputFormatter() = default;

/**
* @return std::string serialized representation of output. The specific format depends
* on the derived class, for example human-readable or json.
*/
virtual std::string formatProto(const nighthawk::client::Output& output) const PURE;
};

Expand Down
4 changes: 4 additions & 0 deletions include/nighthawk/common/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ using HeaderMapPtr = std::shared_ptr<const Envoy::Http::RequestHeaderMap>;
class Request {
public:
virtual ~Request() = default;

/**
* @return HeaderMapPtr shared pointer to a request header specification.
*/
virtual HeaderMapPtr header() const PURE;
// TODO(oschaaf): expectations
};
Expand Down
1 change: 0 additions & 1 deletion lorem_ipsum.txt

This file was deleted.

5 changes: 3 additions & 2 deletions source/client/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ envoy_cc_library(
"@envoy//source/common/config:utility_lib_with_external_headers",
"@envoy//source/common/event:dispatcher_includes_with_external_headers",
"@envoy//source/common/event:real_time_system_lib_with_external_headers",
"@envoy//source/common/grpc:context_lib_with_external_headers",
"@envoy//source/common/http:context_lib_with_external_headers",
"@envoy//source/common/http:header_map_lib_with_external_headers",
"@envoy//source/common/http:headers_lib_with_external_headers",
"@envoy//source/common/http/http1:codec_lib_with_external_headers",
"@envoy//source/common/http/http1:conn_pool_legacy_lib_with_external_headers",
"@envoy//source/common/http/http1:conn_pool_lib_with_external_headers",
"@envoy//source/common/http/http2:conn_pool_lib_with_external_headers",
"@envoy//source/common/init:manager_lib_with_external_headers",
"@envoy//source/common/local_info:local_info_lib_with_external_headers",
Expand All @@ -65,7 +66,6 @@ envoy_cc_library(
"@envoy//source/common/protobuf:message_validator_lib_with_external_headers",
"@envoy//source/common/protobuf:utility_lib_with_external_headers",
"@envoy//source/common/runtime:runtime_lib_with_external_headers",
"@envoy//source/common/runtime:uuid_util_lib_with_external_headers",
"@envoy//source/common/secret:secret_manager_impl_lib_with_external_headers",
"@envoy//source/common/singleton:manager_impl_lib_with_external_headers",
"@envoy//source/common/stats:allocator_lib_with_external_headers",
Expand All @@ -79,6 +79,7 @@ envoy_cc_library(
"@envoy//source/exe:platform_header_lib_with_external_headers",
"@envoy//source/exe:platform_impl_lib",
"@envoy//source/exe:process_wide_lib_with_external_headers",
"@envoy//source/common/http:request_id_extension_lib_with_external_headers",
"@envoy//source/extensions/tracers:well_known_names_with_external_headers",
"@envoy//source/extensions/transport_sockets:well_known_names_with_external_headers",
"@envoy//source/extensions/transport_sockets/tls:context_lib_with_external_headers",
Expand Down
Loading