Skip to content

[ntuple] Add ROOT_EXPERIMENTAL_EXPORT_RNTUPLE_METRICS - #23110

Open
albfsg wants to merge 3 commits into
root-project:masterfrom
albfsg:metrics_expansion
Open

[ntuple] Add ROOT_EXPERIMENTAL_EXPORT_RNTUPLE_METRICS#23110
albfsg wants to merge 3 commits into
root-project:masterfrom
albfsg:metrics_expansion

Conversation

@albfsg

@albfsg albfsg commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

This Pull request:

Changes or fixes:

  • Changes ROOT_EXPORT_RNTUPLE_METRICS into ROOT_EXPERIMENTAL_EXPORT_RNTUPLE_METRICS
  • Fixes a bug in the implementation of GetMetricsExportPath
  • Adds a new RNTupleMetrics API in which setting ROOT_EXPERIMENTAL_EXPORT_RNTUPLE_METRICS to a .root file automatically enables the metrics and saves them in the .root file.

Checklist:

  • tested changes locally <- ntuple_metrics unit tests and roottest-root-ntuple-metrics integration tests
  • updated the docs (if necessary) <- header of RNTupleMetrics

This PR fixes #

None

albfsg added 2 commits August 19, 2026 13:04
The export path was memoized in a local static variable, so it was
fixed by the first call and ignored later changes.

I triggered this bug when needed to set ROOT_EXPORT_RNTUPLE_METRICS via
gSystem->Setenv().
Introduce a new environment variable to allow the user to state its
intention to activate metrics and where to store them in a usable way
which doesn't require source code modifications.

If the environment variable `ROOT_EXPORT_RNTUPLE_METRICS` is set,
metrics are automatically:

- Enabled on construction, and any counter added afterwards through
MakeCounter() is enabled as well.
- Stored in the `.root` file path (relative or absolute) set by
`ROOT_EXPORT_RNTUPLE_METRICS` on destruction

The generated .root file will contain one RNTuple for each component
with its metrics enabled. Each RNTuple will have a flat schema
consisting of fully qualified counter names, such as
RPageSinkFile_timeCpuZip. There is one entry per counter, which means if
a counter appears more than once in a given RNTuple, all instances will
be merged.

Comes with a unit test.

Modifies the output of the integration test
roottest-root-ntuple-metrics-metrics_env_enabled, as the implementation
of the automatic metrics storage uses the RNTupleMerger under the hood,
which triggers a warning message.
@albfsg
albfsg force-pushed the metrics_expansion branch from b6c0db4 to da685c9 Compare August 19, 2026 12:10
@albfsg albfsg changed the title Metrics expansion [ntuple] Add functionality to R__EXPERIMENTAL_ROOT_EXPORT_RNTUPLE_METRICS Aug 19, 2026
@albfsg albfsg changed the title [ntuple] Add functionality to R__EXPERIMENTAL_ROOT_EXPORT_RNTUPLE_METRICS [ntuple] Add R__EXPERIMENTAL_ROOT_EXPORT_RNTUPLE_METRICS Aug 19, 2026
@albfsg albfsg changed the title [ntuple] Add R__EXPERIMENTAL_ROOT_EXPORT_RNTUPLE_METRICS [ntuple] Add ROOT_EXPERIMENTAL_ROOT_EXPORT_RNTUPLE_METRICS Aug 19, 2026
@albfsg albfsg changed the title [ntuple] Add ROOT_EXPERIMENTAL_ROOT_EXPORT_RNTUPLE_METRICS [ntuple] Add ROOT_EXPERIMENTAL_EXPORT_RNTUPLE_METRICS Aug 19, 2026
@albfsg
albfsg force-pushed the metrics_expansion branch from da685c9 to 5a22dd7 Compare August 19, 2026 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant