mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-21 14:20:56 +00:00
The reference docs had drifted from the code in ways that break the reader rather than merely misinform: PromQL examples that return no data, a rollback flag that is a no-op, a sampling knob that does not exist, and two span parents that moved. Code is treated as the truth throughout; where the code is the defective side, the doc now records it as a known issue instead of describing the bug as intent. Renames the docs missed: histogram names gain the exporter's unit suffix (ios_latency_milliseconds_bucket and four siblings), ledger_history_mismatch gains _total, the StatsD-era quantile label gives way to le buckets, rpc.request becomes rpc.http_request, traces_spanmetrics_calls_total becomes span_calls_total, and the nine dotted xrpl.* span attributes are recorded as renamed rather than left as live keys. Re-parenting: consensus.update_positions and consensus.check are children of consensus.establish, not of consensus.round. Units and labels: state_accounting_*_duration is microseconds, not seconds; cache_metrics label values are case-sensitive; object_count carries demangled C++ type names. Nodestore read and write latency stays microseconds -- the nanosecond accumulator change did not move the exported unit. Adds what shipped but was undocumented: the ledger.acquire span, seven consensus.round events, twelve span attributes, node_writes_duration_us, the 7-day validation-agreement window, the TxQ admission and reduce-relay metric families, metrics_endpoint, and the phase-10 validation workflow. Corrects claims that never held: 10% head sampling (it is fixed at 100%), configurable redaction (it is unconditional), -DXRPL_ENABLE_TELEMETRY=OFF (the flag is -Dtelemetry=OFF, default ON), FindOpenTelemetry.cmake and the xrpl_telemetry target (neither exists), Promtail and a StatsD exporter in the pipeline (neither exists), and Loki stream selection on job= (only service_name is a stream label). Phase 9 is marked complete, its provisioned alerting is attributed to the branch that shipped it, and Phase 11 stays at zero except the one prerequisite its code closes. Counts are reconciled repo-wide: 41 emitted span families, 15 dashboards on disk with 14 asserted, 13 alert rules in 5 groups. Hardens the gate that let this drift through: Rule E of the naming check now covers the reference docs, its allow-dotted marker is key-scoped and warns on stale or empty use, a missing checked file is reported instead of silently skipped, the test suite runs in CI, and doc paths trigger the check. C++ and CMake changes are comment-only: three MetricsRegistry instrument names, eight OTelCollector claims of a metric-name prefix that formatName never adds, and the telemetry option's inverted default.
197 lines
5.4 KiB
CMake
197 lines
5.4 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
|
|
if(POLICY CMP0074)
|
|
cmake_policy(SET CMP0074 NEW)
|
|
endif()
|
|
if(POLICY CMP0077)
|
|
cmake_policy(SET CMP0077 NEW)
|
|
endif()
|
|
|
|
# Fix "unrecognized escape" issues when passing CMAKE_MODULE_PATH on Windows.
|
|
if(DEFINED CMAKE_MODULE_PATH)
|
|
file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH)
|
|
endif()
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
|
|
# Must be set before project() because project() consumes it when configuring the compiler and SDK.
|
|
# A user-provided -DCMAKE_OSX_DEPLOYMENT_TARGET still takes precedence.
|
|
#
|
|
# CMAKE_SYSTEM_NAME can't be used before project(), so CMAKE_HOST_SYSTEM_NAME is used instead.
|
|
#
|
|
# When CMAKE_OSX_DEPLOYMENT_TARGET is bumped to >=26.0, FastFloat dependency won't be needed anymore
|
|
if(
|
|
CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin"
|
|
AND NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET
|
|
)
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET
|
|
"15.0"
|
|
CACHE STRING
|
|
"Minimum macOS deployment version"
|
|
)
|
|
endif()
|
|
|
|
project(xrpl)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
include(CompilationEnv)
|
|
|
|
if(is_gcc)
|
|
# GCC-specific fixes
|
|
add_compile_options(-Wno-unknown-pragmas -Wno-subobject-linkage)
|
|
# -Wno-subobject-linkage can be removed when we upgrade GCC version to at least 13.3
|
|
elseif(is_clang)
|
|
# Clang-specific fixes
|
|
add_compile_options(-Wno-unknown-warning-option) # Ignore unknown warning options
|
|
elseif(is_msvc)
|
|
# MSVC-specific fixes
|
|
add_compile_options(/wd4068) # Ignore unknown pragmas
|
|
endif()
|
|
|
|
# Enable ccache to speed up builds.
|
|
include(Ccache)
|
|
|
|
if(thread_safety_analysis)
|
|
add_compile_options(
|
|
-Wthread-safety
|
|
-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
|
-DXRPL_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
|
)
|
|
add_compile_options("-stdlib=libc++")
|
|
add_link_options("-stdlib=libc++")
|
|
endif()
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
include(FetchContent)
|
|
include(ExternalProject)
|
|
include(CMakeFuncs) # must come *after* ExternalProject b/c it overrides one function in EP
|
|
if(target)
|
|
message(
|
|
FATAL_ERROR
|
|
"The target option has been removed - use native cmake options to control build"
|
|
)
|
|
endif()
|
|
|
|
include(PatchNixBinary)
|
|
|
|
include(XrplSanity)
|
|
include(XrplVersion)
|
|
include(XrplSettings)
|
|
# this check has to remain in the top-level cmake because of the early return statement
|
|
if(packages_only)
|
|
if(NOT TARGET rpm)
|
|
message(
|
|
FATAL_ERROR
|
|
"packages_only requested, but targets were not created - is docker installed?"
|
|
)
|
|
endif()
|
|
return()
|
|
endif()
|
|
include(XrplCompiler)
|
|
include(XrplSanitizers)
|
|
include(XrplInterface)
|
|
|
|
option(only_docs "Include only the docs target?" FALSE)
|
|
include(XrplDocs)
|
|
if(only_docs)
|
|
return()
|
|
endif()
|
|
|
|
include(deps/Boost)
|
|
|
|
add_subdirectory(external/antithesis-sdk)
|
|
find_package(date REQUIRED)
|
|
find_package(ed25519 REQUIRED)
|
|
find_package(FastFloat REQUIRED)
|
|
find_package(gRPC REQUIRED)
|
|
find_package(LibArchive REQUIRED)
|
|
find_package(lz4 REQUIRED)
|
|
find_package(mpt-crypto REQUIRED)
|
|
find_package(nudb REQUIRED)
|
|
find_package(OpenSSL REQUIRED)
|
|
find_package(secp256k1 REQUIRED)
|
|
find_package(SOCI REQUIRED)
|
|
find_package(SQLite3 REQUIRED)
|
|
find_package(xxHash REQUIRED)
|
|
|
|
target_link_libraries(
|
|
xrpl_libs
|
|
INTERFACE
|
|
ed25519::ed25519
|
|
FastFloat::fast_float
|
|
lz4::lz4
|
|
mpt-crypto::mpt-crypto
|
|
OpenSSL::Crypto
|
|
OpenSSL::SSL
|
|
secp256k1::secp256k1
|
|
soci::soci
|
|
SQLite::SQLite3
|
|
)
|
|
|
|
option(rocksdb "Enable RocksDB" ON)
|
|
if(rocksdb)
|
|
find_package(RocksDB REQUIRED)
|
|
set_target_properties(
|
|
RocksDB::rocksdb
|
|
PROPERTIES INTERFACE_COMPILE_DEFINITIONS XRPL_ROCKSDB_AVAILABLE=1
|
|
)
|
|
target_link_libraries(xrpl_libs INTERFACE RocksDB::rocksdb)
|
|
endif()
|
|
|
|
# OpenTelemetry distributed tracing (optional).
|
|
# When ON, links against opentelemetry-cpp and defines XRPL_ENABLE_TELEMETRY so
|
|
# that SpanGuard factory methods produce real OTel spans.
|
|
# When OFF, all tracing code compiles to no-ops with zero overhead and
|
|
# opentelemetry-cpp is not needed at all.
|
|
#
|
|
# The value below is temporarily ON so that CI compiles the telemetry code
|
|
# paths while this feature is in review. OFF is the intended shipped default;
|
|
# flipping it back is tracked as a separate change. Do not rely on the current
|
|
# value - select it explicitly with cmake -Dtelemetry=ON|OFF or
|
|
# conan install -o telemetry=True|False.
|
|
#
|
|
# -DXRPL_ENABLE_TELEMETRY=OFF does not turn anything off: that name is only a
|
|
# compile definition added below, not a CMake option, so CMake just lists it as
|
|
# an unused variable at the end of configuration.
|
|
option(telemetry "Enable OpenTelemetry tracing" ON)
|
|
if(telemetry)
|
|
find_package(opentelemetry-cpp CONFIG REQUIRED)
|
|
add_compile_definitions(XRPL_ENABLE_TELEMETRY)
|
|
message(STATUS "OpenTelemetry tracing enabled")
|
|
endif()
|
|
|
|
# Work around changes to Conan recipe for now.
|
|
if(TARGET nudb::core)
|
|
set(nudb nudb::core)
|
|
elseif(TARGET NuDB::nudb)
|
|
set(nudb NuDB::nudb)
|
|
else()
|
|
message(FATAL_ERROR "unknown nudb target")
|
|
endif()
|
|
target_link_libraries(xrpl_libs INTERFACE ${nudb})
|
|
|
|
if(benchmark)
|
|
find_package(benchmark REQUIRED)
|
|
endif()
|
|
|
|
if(coverage)
|
|
include(XrplCov)
|
|
endif()
|
|
|
|
include(XrplCore)
|
|
include(XrplProtocolAutogen)
|
|
include(XrplInstall)
|
|
include(XrplPackaging)
|
|
include(XrplValidatorKeys)
|
|
|
|
if(tests)
|
|
include(CTest)
|
|
add_subdirectory(src/tests/libxrpl)
|
|
endif()
|
|
|
|
if(benchmark)
|
|
add_subdirectory(src/benchmarks/libxrpl)
|
|
endif()
|