mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-26 00:20:41 +00:00
handle gTlDiscardCurrentSpan change
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
This commit is contained in:
@@ -209,7 +209,7 @@ target_link_libraries(xrpl.libxrpl.tx PUBLIC xrpl.libxrpl.ledger)
|
||||
add_module(xrpl telemetry)
|
||||
target_link_libraries(
|
||||
xrpl.libxrpl.telemetry
|
||||
PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.beast
|
||||
PUBLIC xrpl.libxrpl.basics xrpl.libxrpl.beast xrpl.libxrpl.config
|
||||
)
|
||||
if(telemetry)
|
||||
target_link_libraries(
|
||||
|
||||
@@ -135,11 +135,11 @@ public:
|
||||
std::string serviceName = "xrpld";
|
||||
|
||||
/** OTel resource attribute `service.version` (set from BuildInfo). */
|
||||
std::string serviceVersion{};
|
||||
std::string serviceVersion;
|
||||
|
||||
/** OTel resource attribute `service.instance.id` (defaults to node
|
||||
public key). */
|
||||
std::string serviceInstanceId{};
|
||||
std::string serviceInstanceId;
|
||||
|
||||
/** OTLP/HTTP endpoint URL where spans are sent. */
|
||||
std::string exporterEndpoint = "http://localhost:4318/v1/traces";
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
bool useTls = false;
|
||||
|
||||
/** Path to a CA certificate bundle for TLS verification. */
|
||||
std::string tlsCertPath{};
|
||||
std::string tlsCertPath;
|
||||
|
||||
/** Head-based sampling ratio. Intentionally fixed at 1.0 (sample
|
||||
everything) and NOT read from config. A per-node ratio would let
|
||||
|
||||
@@ -344,6 +344,14 @@ SpanGuard::discard()
|
||||
{
|
||||
gTlDiscardCurrentSpan = true;
|
||||
impl_->span->End();
|
||||
// Clear here so discard() owns the flag's whole lifetime
|
||||
// (set -> End -> clear) in one scope, rather than relying on
|
||||
// FilteringSpanProcessor::OnEnd() to clear it. Today every valid guard
|
||||
// wraps a recording span (head sampling is 1.0), so OnEnd() always runs
|
||||
// and clearing here is equivalent — but colocating set and clear keeps
|
||||
// the flag leak-proof if a later phase can hand back a non-recording
|
||||
// span (e.g. honoring a non-sampled remote parent during propagation).
|
||||
gTlDiscardCurrentSpan = false;
|
||||
impl_->span = nullptr; // prevent ~Impl from calling End() again
|
||||
impl_.reset();
|
||||
}
|
||||
|
||||
@@ -122,8 +122,7 @@ public:
|
||||
{
|
||||
// SpanGuard::discard() set the flag on this thread just before
|
||||
// calling Span::End(), which invokes OnEnd() synchronously.
|
||||
// Clear the flag and drop the span.
|
||||
gTlDiscardCurrentSpan = false;
|
||||
// Drop the span.
|
||||
return;
|
||||
}
|
||||
delegate_->OnEnd(std::move(span));
|
||||
|
||||
Reference in New Issue
Block a user