Merge branch 'pratik/otel-phase10-workload-validation' into pratik/otel-sync-diagnostics

This commit is contained in:
Pratik Mankawde
2026-08-19 19:54:52 +01:00
10 changed files with 277 additions and 34 deletions

View File

@@ -108,6 +108,7 @@ inline constexpr auto consensus = makeStr("consensus");
inline constexpr auto peer = makeStr("peer");
inline constexpr auto ledger = makeStr("ledger");
inline constexpr auto network = makeStr("network");
inline constexpr auto node = makeStr("node");
inline constexpr auto link = makeStr("link");
} // namespace seg
@@ -117,6 +118,16 @@ namespace attr {
inline constexpr auto networkId = join(join(seg::xrpl, seg::network), makeStr("id"));
inline constexpr auto networkType = join(join(seg::xrpl, seg::network), makeStr("type"));
/**
* Resource attribute `xrpl.node.id` — the node's base58 public key.
*
* Dotted form, like its siblings above, because it is a process-identity
* value stamped once on the OTel resource rather than a per-span attribute.
* It gives traces and metrics a stable per-node key alongside
* `service.instance.id`.
*/
inline constexpr auto nodeId = join(join(seg::xrpl, seg::node), makeStr("id"));
/**
* Canonical shared attrs (rule 5 — <domain>_<field> underscore form).
*

View File

@@ -83,7 +83,8 @@
*
* @note Thread safety: The Telemetry interface is safe for concurrent reads
* (isEnabled, shouldTrace*, getTracer, startSpan) after start() completes.
* setServiceInstanceId() must be called before start() and is not thread-safe.
* setServiceInstanceId() and setNodeId() must be called before start() and
* are not thread-safe.
* The OTel SDK's TracerProvider and Tracer are internally thread-safe.
*/
@@ -193,6 +194,14 @@ public:
*/
std::string serviceInstanceId;
/**
* OTel resource attribute `xrpl.node.id`: the node's base58-encoded
* public key. Always the node identity, never config-supplied, so it
* stays a stable per-node key even when serviceInstanceId is
* overridden by [telemetry] service_instance_id.
*/
std::string nodeId;
/**
* OTLP/HTTP endpoint URL where spans are sent.
*/
@@ -313,6 +322,24 @@ public:
(void)id;
}
/**
* Update the node ID (OTel resource attribute `xrpl.node.id`).
*
* Must be called before start(). A setter is needed for the same reason
* setServiceInstanceId() needs one: the node public key is not available
* when Telemetry is constructed (during the ApplicationImp member
* initializer list), so Application::setup() injects it once
* nodeIdentity_ is known.
*
* @param id The node's base58-encoded public key.
*/
virtual void
setNodeId(std::string const& id)
{
// Default no-op for NullTelemetry implementations.
(void)id;
}
/**
* Initialize the tracing pipeline (exporter, processor, provider).
* Call after construction.