mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-21 14:20:56 +00:00
refactor(telemetry): route dashboards, runbook and collector work to phase-9
These changes were developed on the phase-10 branch but belong to content this branch and its upstreams introduced. Carrying them on phase-10 made its PR diff report churn in files phase-10 does not own, and left each PR claiming a scope that did not match its contents. Moved here from phase-10 (identical content, no functional change): - Dashboards: all 14 existing boards plus the new log-derived-insights board. - Docs: telemetry-runbook.md (minus the workload/benchmark sections, which describe phase-10 tooling) and the new telemetry-glossary.md. - Grafana Cloud + Alloy export path: collector config, compose override, the two .env examples and alloy/config.alloy. - Local stack: otel-collector-config.yaml gains sub-millisecond and second-scale spanmetrics buckets, pins unit=ms, and promotes close_time_correct; integration-test.sh and TESTING.md follow. - Node configs: exported_instance -> service_instance_id in comments; the mainnet sample now logs at warning to bound log volume. - Metrics code: Telemetry.cpp builds the metrics pipeline in the constructor via initMetrics() so the global MeterProvider is published before any subsystem creates a beast::insight instrument, and the histogram view keeps each instrument's own name instead of collapsing them under one series. MetricsRegistry gains a last_close_time gauge and skips negative job-queue durations. OTelCollector drops an unused accessor. - Naming CI: xrpl_work_item joins EXTERNAL_INFRA_LABELS and Rule E accepts the dotted perf-iac resource-attribute form. This must travel with the dashboards and runbook that reference those labels, or the rules fail. - Doxygen input glob no longer recurses dot-directories. Sections describing phase-10 tooling stay on phase-10 and keep their "Future Enhancement" / "Planned, not yet implemented" markers here; phase-10 removes those markers when it lands the tooling.
This commit is contained in:
21
.github/scripts/otel-naming/check_otel_naming.py
vendored
21
.github/scripts/otel-naming/check_otel_naming.py
vendored
@@ -19,12 +19,16 @@ Design principles
|
||||
and the `join(seg::..., ...)` dotted resource compositions), and
|
||||
* the keys the code passes to `Resource::Create({ ... })` in Telemetry.cpp
|
||||
(the standard `semconv::service::*` keys -> service.name/version/...).
|
||||
The one narrow, explicit exception is EXTERNAL_INFRA_LABELS (Rule D):
|
||||
The one narrow, explicit exception is EXTERNAL_INFRA_LABELS (Rules D & E):
|
||||
identity labels stamped by infrastructure outside this repo's OTel code
|
||||
(the perf-iac harness), which by definition have no source in-tree to
|
||||
derive from. Kept separate from the generic Prometheus/Grafana builtins
|
||||
set so the exception stays visible rather than blending into "things
|
||||
every OTel setup has".
|
||||
every OTel setup has". perf-iac's alloy pipeline stamps each identity at
|
||||
two layers -- dotted on the OTel resource attribute (xrpl.work.item/
|
||||
.branch/.node.role, checked by Rule E) and underscore on the derived
|
||||
Prometheus metric-datapoint label (xrpl_work_item/_branch/_node_role,
|
||||
checked by Rule D) -- so both forms are exempt from the same constant.
|
||||
|
||||
2. Presence-gated enforcement. Every rule runs ONLY when the source files it
|
||||
needs are present in the tree, and is otherwise skipped (never failed). This
|
||||
@@ -63,7 +67,9 @@ Rules (each FAILS the build, when its inputs are present)
|
||||
native-metric label, or a builtin. TraceQL `span.`/`resource.` scope
|
||||
prefixes are stripped before the L1 lookup.
|
||||
E No dotted `xrpl.<domain>.<field>` attribute key in the runbook (only the
|
||||
L1 resource attrs xrpl.network.* may be dotted). Span names, filenames,
|
||||
L1 resource attrs xrpl.network.* and the EXTERNAL_INFRA_LABELS dotted
|
||||
form -- xrpl.work.item/.branch/.node.role -- may be dotted). Span names,
|
||||
filenames,
|
||||
OTel-standard keys, and metric labels are not flagged.
|
||||
|
||||
Warnings (printed, but do NOT fail the build)
|
||||
@@ -851,6 +857,7 @@ def metric_label_names(root: Path) -> Set[str]:
|
||||
# repo's OTel code (never as a workaround for a dashboard querying a label
|
||||
# that nothing actually emits — that is a real Rule D violation).
|
||||
EXTERNAL_INFRA_LABELS = {
|
||||
"xrpl_work_item", # perf-iac: ticket/work-item id for the perf comparison run
|
||||
"xrpl_branch", # perf-iac: git ref of the xrpld build under test
|
||||
"xrpl_node_role", # perf-iac: validator/peer role in the perf cluster
|
||||
}
|
||||
@@ -934,10 +941,18 @@ def run_rule_e_runbook(root: Path, l1_keys: Set[str], report: Report) -> None:
|
||||
# Legitimate dotted resource attrs (`xrpl.network.id`/`.type`) are in L1 and
|
||||
# are skipped. A dotted `xrpl.` token absent from L1 is a genuine doc/code
|
||||
# mismatch (e.g. `xrpl.tx.hash` where the code emits `tx_hash`).
|
||||
# EXTERNAL_INFRA_LABELS (Rule D) holds the underscore/metric-label form of
|
||||
# the perf-iac identity attrs; the resource-attribute layer stamps the same
|
||||
# identities dotted (xrpl.work.item/.branch/.node.role -- see the alloy
|
||||
# pipeline that owns them), so also skip a token whose dotted-to-underscore
|
||||
# form is in that set.
|
||||
external_infra_dotted = {lbl.replace("_", ".") for lbl in EXTERNAL_INFRA_LABELS}
|
||||
for m in re.finditer(r"`(xrpl\.[a-z][a-z0-9_.]*)`", text):
|
||||
token = m.group(1)
|
||||
if token in l1_keys: # legitimate dotted resource attr (xrpl.network.*)
|
||||
continue
|
||||
if token in external_infra_dotted: # perf-iac resource-attribute layer
|
||||
continue
|
||||
found = True
|
||||
report.violation(
|
||||
"E", str(path.relative_to(root)), token, "underscore, not dotted"
|
||||
|
||||
@@ -121,6 +121,14 @@ class RuleERunbook(unittest.TestCase):
|
||||
def test_legit_dotted_resource_attrs_in_l1(self):
|
||||
self.assertEqual(_run_rule_e("`xrpl.network.id` `xrpl.network.type`"), [])
|
||||
|
||||
def test_external_infra_dotted_resource_attrs_not_flagged(self):
|
||||
# perf-iac stamps these as dotted resource attrs (alloy pipeline);
|
||||
# EXTERNAL_INFRA_LABELS (Rule D) holds their underscore metric-label
|
||||
# form -- Rule E must also exempt the dotted resource-attr form.
|
||||
self.assertEqual(
|
||||
_run_rule_e("`xrpl.work.item` `xrpl.branch` `xrpl.node.role`"), []
|
||||
)
|
||||
|
||||
def test_prose_word(self):
|
||||
self.assertEqual(_run_rule_e("the `command` attribute"), [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user