mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-15 11:10:20 +00:00
Merge branch 'pratik/otel-phase9-metric-gap-fill' into pratik/otel-phase10-workload-validation
This commit is contained in:
@@ -483,8 +483,8 @@ public:
|
||||
* @param name Raw metric name from beast::insight callers.
|
||||
* @return Fully-qualified metric name.
|
||||
*/
|
||||
std::string
|
||||
formatName(std::string const& name) const;
|
||||
static std::string
|
||||
formatName(std::string const& name);
|
||||
|
||||
private:
|
||||
/** Journal for log output. */
|
||||
@@ -808,7 +808,7 @@ OTelCollectorImp::removeGauge(OTelGaugeImpl* gauge)
|
||||
}
|
||||
|
||||
std::string
|
||||
OTelCollectorImp::formatName(std::string const& name) const
|
||||
OTelCollectorImp::formatName(std::string const& name)
|
||||
{
|
||||
// Produce a clean, lowercase, Prometheus-compatible metric name.
|
||||
// No prefix — the OTel resource (service.name) identifies the service.
|
||||
@@ -818,9 +818,13 @@ OTelCollectorImp::formatName(std::string const& name) const
|
||||
for (char const c : name)
|
||||
{
|
||||
if (c == '.' || c == ' ')
|
||||
{
|
||||
result += '_';
|
||||
}
|
||||
else
|
||||
{
|
||||
result += static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <ranges>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
|
||||
@@ -583,8 +583,10 @@ public:
|
||||
getMeter(std::string_view name = kMeterName) override
|
||||
{
|
||||
if (!meterProvider_)
|
||||
{
|
||||
return metrics_api::Provider::GetMeterProvider()->GetMeter(
|
||||
std::string(name), std::string(kMeterVersion));
|
||||
}
|
||||
return meterProvider_->GetMeter(std::string(name), std::string(kMeterVersion));
|
||||
}
|
||||
|
||||
|
||||
@@ -17,18 +17,18 @@
|
||||
|
||||
#ifdef XRPL_ENABLE_TELEMETRY
|
||||
|
||||
#include <xrpl/beast/utility/Journal.h>
|
||||
#include <xrpl/telemetry/Telemetry.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <opentelemetry/metrics/meter.h>
|
||||
#include <opentelemetry/metrics/meter_provider.h>
|
||||
#include <opentelemetry/metrics/provider.h>
|
||||
#include <opentelemetry/metrics/sync_instruments.h>
|
||||
#include <opentelemetry/nostd/shared_ptr.h>
|
||||
#include <opentelemetry/sdk/metrics/meter_provider.h>
|
||||
#include <opentelemetry/sdk/metrics/meter_provider_factory.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
using namespace xrpl;
|
||||
@@ -85,7 +85,7 @@ TEST(GetMeter, global_provider_meter_accepts_updown_counter)
|
||||
// A views-less SDK MeterProvider with no reader is sufficient to prove the
|
||||
// API contract: it hands out a real (non-noop) Meter that creates working
|
||||
// instruments. No exporter/reader means no background threads or network.
|
||||
std::shared_ptr<metrics_sdk::MeterProvider> sdkProvider =
|
||||
std::shared_ptr<metrics_sdk::MeterProvider> const sdkProvider =
|
||||
metrics_sdk::MeterProviderFactory::Create();
|
||||
metrics_api::Provider::SetMeterProvider(
|
||||
opentelemetry::nostd::shared_ptr<metrics_api::MeterProvider>(sdkProvider));
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <ranges>
|
||||
#include <string>
|
||||
|
||||
using namespace xrpl;
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <xrpl/telemetry/SpanGuard.h>
|
||||
#include <xrpl/telemetry/TraceContextValidation.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace xrpl::telemetry {
|
||||
|
||||
/** Create a "tx.receive" span for a transaction received from a peer.
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <mutex>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <mutex>
|
||||
#include <ranges>
|
||||
|
||||
namespace xrpl::telemetry {
|
||||
|
||||
@@ -282,11 +283,11 @@ void
|
||||
ValidationTracker::repairWindowEntry(std::deque<WindowEvent>& window, uint256 const& hash)
|
||||
{
|
||||
// Scan backwards since late repairs target recently added entries.
|
||||
for (auto it = window.rbegin(); it != window.rend(); ++it)
|
||||
for (auto& event : std::views::reverse(window))
|
||||
{
|
||||
if (!it->agreed && it->ledgerHash == hash)
|
||||
if (!event.agreed && event.ledgerHash == hash)
|
||||
{
|
||||
it->agreed = true;
|
||||
event.agreed = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user