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
331 changes: 124 additions & 207 deletions .github/workflows/slo.yml

Large diffs are not rendered by default.

42 changes: 39 additions & 3 deletions .github/workflows/slo_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,53 @@ on:
- completed

jobs:
ydb-slo-action-report:
publish-slo-report:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
name: Publish YDB SLO Report
permissions:
actions: read
checks: write
contents: read
pull-requests: write
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Publish YDB SLO Report
uses: ydb-platform/ydb-slo-action/report@main
uses: ydb-platform/ydb-slo-action/report@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_run_id: ${{ github.event.workflow_run.id }}

remove-slo-label:
needs: publish-slo-report
if: always() && github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
Comment on lines +26 to +29
name: Remove SLO Label
permissions:
pull-requests: write
steps:
- name: Remove SLO label from PR
uses: actions/github-script@v7
with:
script: |
const pullRequests = context.payload.workflow_run.pull_requests;
if (pullRequests && pullRequests.length > 0) {
for (const pr of pullRequests) {
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
name: 'SLO'
});
console.log(`Removed SLO label from PR #${pr.number}`);
} catch (error) {
if (error.status === 404) {
console.log(`SLO label not found on PR #${pr.number}, skipping`);
} else {
throw error;
}
}
}
} else {
console.log('No pull requests associated with this workflow run');
}
80 changes: 61 additions & 19 deletions tests/slo_workloads/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,65 @@
# syntax=docker/dockerfile:1.7
FROM ubuntu:22.04

ARG PRESET=release-test-clang
ARG REF=unknown

# Install software-properties-common for add-apt-repository
RUN apt-get -y update && apt-get -y install software-properties-common && add-apt-repository ppa:ubuntu-toolchain-r/test
# ccache settings consumed by the configure/build steps below. The cache dir
# is materialised by the BuildKit cache mount on those RUN steps; values
# elsewhere in the image are inert.
ENV CCACHE_DIR=/root/.ccache
ENV CCACHE_MAXSIZE=2G
ENV CCACHE_COMPRESS=true
ENV CCACHE_COMPILERCHECK=content

# Every RUN that hits the network retries on transient failures so one
# flake doesn't throw away 30 min of previous build work. apt gets five
# Acquire retries + 60 s timeouts; wget gets the equivalent via WGET_OPTS.
RUN echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/80-retries && \
echo 'Acquire::http::Timeout "60";' >> /etc/apt/apt.conf.d/80-retries && \
echo 'Acquire::https::Timeout "60";' >> /etc/apt/apt.conf.d/80-retries

ENV WGET_OPTS="--tries=5 --waitretry=15 --timeout=60 --retry-connrefused --retry-on-http-error=500,502,503,504"

# Install software-properties-common and add the gcc-13 PPA.
# Acquire::Retries only retries HTTP errors; TCP connect timeouts to
# ppa.launchpadcontent.net still drop through and kill the step. Wrap the
# whole command in a shell retry loop with exponential backoff so a CDN
# blip doesn't throw away 30 minutes of downstream build work.
RUN for i in 1 2 3 4 5; do \
apt-get -y update && \
apt-get -y install software-properties-common && \
add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
apt-get -y update && \
break; \
echo "add-apt-repository attempt $i failed; sleeping $((i * 15))s"; \
sleep $((i * 15)); \
done && \
apt-cache show gcc-13 > /dev/null # fail fast if PPA never came up

# Install C++ tools and libraries
RUN apt-get -y update && apt-get -y install \
git gdb wget ninja-build libidn11-dev ragel yasm libc-ares-dev libre2-dev \
rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \
libbz2-dev liblz4-dev libdouble-conversion-dev libssl-dev libstdc++-13-dev gcc-13 g++-13 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN for i in 1 2 3 4 5; do \
apt-get -y install \
git gdb wget ninja-build libidn11-dev ragel yasm libc-ares-dev libre2-dev \
rapidjson-dev zlib1g-dev libxxhash-dev libzstd-dev libsnappy-dev libgtest-dev libgmock-dev \
libbz2-dev liblz4-dev libdouble-conversion-dev libssl-dev libstdc++-13-dev gcc-13 g++-13 && \
break; \
echo "apt-get install attempt $i failed; sleeping $((i * 15))s"; \
sleep $((i * 15)); \
apt-get -y update || true; \
done && \
apt-get clean && rm -rf /var/lib/apt/lists/*

# Install CMake
ENV CMAKE_VERSION=3.27.7
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \
RUN wget $WGET_OPTS https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \
-q -O cmake-install.sh \
&& chmod u+x cmake-install.sh \
&& ./cmake-install.sh --skip-license --prefix=/usr/local \
&& rm cmake-install.sh

# Install LLVM
ENV LLVM_VERSION=16
RUN wget https://apt.llvm.org/llvm.sh && \
RUN wget $WGET_OPTS https://apt.llvm.org/llvm.sh && \
chmod u+x llvm.sh && \
./llvm.sh ${LLVM_VERSION} && \
rm llvm.sh
Expand All @@ -40,7 +76,7 @@ RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10000 && \
# Install abseil-cpp
ENV ABSEIL_CPP_VERSION=20230802.0
ENV ABSEIL_CPP_INSTALL_DIR=/root/ydb_deps/absl
RUN wget -O abseil-cpp-${ABSEIL_CPP_VERSION}.tar.gz https://github.com/abseil/abseil-cpp/archive/refs/tags/${ABSEIL_CPP_VERSION}.tar.gz && \
RUN wget $WGET_OPTS -O abseil-cpp-${ABSEIL_CPP_VERSION}.tar.gz https://github.com/abseil/abseil-cpp/archive/refs/tags/${ABSEIL_CPP_VERSION}.tar.gz && \
tar -xvzf abseil-cpp-${ABSEIL_CPP_VERSION}.tar.gz && cd abseil-cpp-${ABSEIL_CPP_VERSION} && \
mkdir build && cd build && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DABSL_PROPAGATE_CXX_STD=ON .. && \
Expand All @@ -51,7 +87,7 @@ RUN wget -O abseil-cpp-${ABSEIL_CPP_VERSION}.tar.gz https://github.com/abseil/ab
# Install protobuf
ENV PROTOBUF_VERSION=3.21.12
ENV PROTOBUF_INSTALL_DIR=/root/ydb_deps/protobuf
RUN wget -O protobuf-${PROTOBUF_VERSION}.tar.gz https://github.com/protocolbuffers/protobuf/archive/refs/tags/v${PROTOBUF_VERSION}.tar.gz && \
RUN wget $WGET_OPTS -O protobuf-${PROTOBUF_VERSION}.tar.gz https://github.com/protocolbuffers/protobuf/archive/refs/tags/v${PROTOBUF_VERSION}.tar.gz && \
tar -xvzf protobuf-${PROTOBUF_VERSION}.tar.gz && cd protobuf-${PROTOBUF_VERSION} && \
mkdir build && cd build && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_INSTALL=ON -Dprotobuf_ABSL_PROVIDER=package .. && \
Expand All @@ -62,7 +98,7 @@ RUN wget -O protobuf-${PROTOBUF_VERSION}.tar.gz https://github.com/protocolbuffe
# Install grpc
ENV GRPC_VERSION=1.54.3
ENV GRPC_INSTALL_DIR=/root/ydb_deps/grpc
RUN wget -O grpc-${GRPC_VERSION}.tar.gz https://github.com/grpc/grpc/archive/refs/tags/v${GRPC_VERSION}.tar.gz && \
RUN wget $WGET_OPTS -O grpc-${GRPC_VERSION}.tar.gz https://github.com/grpc/grpc/archive/refs/tags/v${GRPC_VERSION}.tar.gz && \
tar -xvzf grpc-${GRPC_VERSION}.tar.gz && cd grpc-${GRPC_VERSION} && \
mkdir build && cd build && \
cmake -G Ninja -DCMAKE_PREFIX_PATH="${ABSEIL_CPP_INSTALL_DIR};${PROTOBUF_INSTALL_DIR}" \
Expand All @@ -79,7 +115,7 @@ RUN wget -O grpc-${GRPC_VERSION}.tar.gz https://github.com/grpc/grpc/archive/ref
# Install base64
ENV BASE64_VERSION=0.5.2
ENV BASE64_INSTALL_DIR=/root/ydb_deps/base64
RUN wget -O base64-${BASE64_VERSION}.tar.gz https://github.com/aklomp/base64/archive/refs/tags/v${BASE64_VERSION}.tar.gz && \
RUN wget $WGET_OPTS -O base64-${BASE64_VERSION}.tar.gz https://github.com/aklomp/base64/archive/refs/tags/v${BASE64_VERSION}.tar.gz && \
tar -xvzf base64-${BASE64_VERSION}.tar.gz && cd base64-${BASE64_VERSION} && \
mkdir build && cd build && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. && \
Expand All @@ -90,7 +126,7 @@ RUN wget -O base64-${BASE64_VERSION}.tar.gz https://github.com/aklomp/base64/arc
# Install brotli
ENV BROTLI_VERSION=1.1.0
ENV BROTLI_INSTALL_DIR=/root/ydb_deps/brotli
RUN wget -O brotli-${BROTLI_VERSION}.tar.gz https://github.com/google/brotli/archive/refs/tags/v${BROTLI_VERSION}.tar.gz && \
RUN wget $WGET_OPTS -O brotli-${BROTLI_VERSION}.tar.gz https://github.com/google/brotli/archive/refs/tags/v${BROTLI_VERSION}.tar.gz && \
tar -xvzf brotli-${BROTLI_VERSION}.tar.gz && cd brotli-${BROTLI_VERSION} && \
mkdir build && cd build && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. && \
Expand All @@ -101,7 +137,7 @@ RUN wget -O brotli-${BROTLI_VERSION}.tar.gz https://github.com/google/brotli/arc
# Install jwt-cpp
ENV JWT_CPP_VERSION=0.7.0
ENV JWT_CPP_INSTALL_DIR=/root/ydb_deps/jwt-cpp
RUN wget -O jwt-cpp-${JWT_CPP_VERSION}.tar.gz https://github.com/Thalhammer/jwt-cpp/archive/refs/tags/v${JWT_CPP_VERSION}.tar.gz && \
RUN wget $WGET_OPTS -O jwt-cpp-${JWT_CPP_VERSION}.tar.gz https://github.com/Thalhammer/jwt-cpp/archive/refs/tags/v${JWT_CPP_VERSION}.tar.gz && \
tar -xvzf jwt-cpp-${JWT_CPP_VERSION}.tar.gz && cd jwt-cpp-${JWT_CPP_VERSION} && \
mkdir build && cd build && \
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. && \
Expand All @@ -111,7 +147,7 @@ RUN wget -O jwt-cpp-${JWT_CPP_VERSION}.tar.gz https://github.com/Thalhammer/jwt-

# Install ccache 4.8.1 or above
ENV CCACHE_VERSION=4.8.1
RUN wget https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz \
RUN wget $WGET_OPTS https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz \
&& tar -xf ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz \
&& cp ccache-${CCACHE_VERSION}-linux-x86_64/ccache /usr/local/bin/ \
&& rm -rf ccache-${CCACHE_VERSION}-linux-x86_64 ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz
Expand All @@ -120,7 +156,13 @@ COPY . /ydb-cpp-sdk
WORKDIR /ydb-cpp-sdk
RUN rm -rf build

RUN cmake -DSLO_BRANCH_REF=${REF} --preset ${PRESET}
RUN cmake --build --preset default --target slo-key-value
RUN --mount=type=cache,target=/root/.ccache,sharing=locked \
cmake --preset ${PRESET} \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
RUN --mount=type=cache,target=/root/.ccache,sharing=locked \
ccache --zero-stats >/dev/null \
&& cmake --build --preset default --target slo-key-value \
&& ccache --show-stats

ENTRYPOINT ["./build/tests/slo_workloads/key_value/slo-key-value"]
4 changes: 2 additions & 2 deletions tests/slo_workloads/key_value/create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace NYdb::NTable;

namespace {
void CreateTable(TTableClient& client, const std::string& prefix) {
RetryBackoff(client, 5, [prefix](TSession session) {
NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([prefix](TSession session) {
auto desc = TTableBuilder()
.AddNullableColumn("object_id_key", EPrimitiveType::Uint32)
.AddNullableColumn("object_id", EPrimitiveType::Uint32)
Expand All @@ -27,7 +27,7 @@ namespace {
, std::move(desc)
, std::move(tableSettings)
).ExtractValueSync();
});
}));
}
} //namespace

Expand Down
19 changes: 12 additions & 7 deletions tests/slo_workloads/key_value/drop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ using namespace NLastGetopt;
using namespace NYdb;
using namespace NYdb::NTable;

static void DropTable(TTableClient& client, const std::string& path) {
NYdb::NStatusHelpers::ThrowOnError(client.RetryOperationSync([path](TSession session) {
return session.DropTable(path).ExtractValueSync();
}));
}

int DropTable(TDatabaseOptions& dbOptions) {
TTableClient client(dbOptions.Driver);
DropTable(client, JoinPath(dbOptions.Prefix, TableName));
const std::string path = JoinPath(dbOptions.Prefix, TableName);
TStatus status = client.RetryOperationSync([path](TSession session) {
TStatus dropStatus = session.DropTable(path).ExtractValueSync();
if (dropStatus.GetStatus() == EStatus::NOT_FOUND) {
Comment thread
Shfdis marked this conversation as resolved.
return TStatus(EStatus::SUCCESS, NYdb::NIssue::TIssues());
}
return dropStatus;
});
if (!status.IsSuccess()) {
Cerr << "DropTable failed: " << status << Endl;
return EXIT_FAILURE;
}
Cout << "Table dropped." << Endl;
return EXIT_SUCCESS;
}
2 changes: 2 additions & 0 deletions tests/slo_workloads/key_value/key_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ int DoCreate(TDatabaseOptions& dbOptions, int argc, char** argv) {
jobs->Start();
jobs->Wait();
jobs->ShowProgress();
jobs.reset();

return EXIT_SUCCESS;
}
Expand Down Expand Up @@ -95,6 +96,7 @@ int DoRun(TDatabaseOptions& dbOptions, int argc, char** argv) {
Cout << "All jobs finished: " << TInstant::Now().ToRfc822StringLocal() << Endl;

jobs->ShowProgress();
jobs.reset();

return EXIT_SUCCESS;
}
Expand Down
19 changes: 16 additions & 3 deletions tests/slo_workloads/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
include(FetchContent)

FetchContent_Declare(
hdr_histogram
GIT_REPOSITORY https://github.com/HdrHistogram/HdrHistogram_c.git
GIT_TAG 0.11.8
EXCLUDE_FROM_ALL
)
set(HDR_HISTOGRAM_BUILD_PROGRAMS OFF CACHE BOOL "" FORCE)
set(HDR_HISTOGRAM_BUILD_SHARED OFF CACHE BOOL "" FORCE)
set(HDR_LOG_REQUIRED OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(hdr_histogram)

add_library(slo-utils)

target_link_libraries(slo-utils PUBLIC
Expand All @@ -9,9 +22,9 @@ target_link_libraries(slo-utils PUBLIC
opentelemetry-cpp::otlp_http_metric_exporter
)

if (SLO_BRANCH_REF)
target_compile_definitions(slo-utils PRIVATE REF=${SLO_BRANCH_REF})
endif()
target_link_libraries(slo-utils PRIVATE
hdr_histogram_static
)

target_sources(slo-utils PRIVATE
executor.cpp
Expand Down
Loading
Loading