Skip to content

feat(core-node): Add allocation metrics to flamegraphs#9298

Merged
muXxer merged 21 commits intofeat/flamegraphsfrom
core-node/flamegraph-alloc
Dec 12, 2025
Merged

feat(core-node): Add allocation metrics to flamegraphs#9298
muXxer merged 21 commits intofeat/flamegraphsfrom
core-node/flamegraph-alloc

Conversation

@semenov-vladyslav
Copy link
Contributor

@semenov-vladyslav semenov-vladyslav commented Nov 16, 2025

Description of change

This PR adds global allocator wrapper counting allocation metrics (alloc, dealloc, peak) per thread. It uses unstable feature thread_local (it's the only reasonable way, thread_local! macro can't be used) which is guarded behind feature "flamegraph-alloc". The allocation stats are shown in rendered SVG.

Links to any relevant issues

Part of #8694.

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • Patch-specific tests (correctness, functionality coverage)
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

Release Notes

  • Protocol:
  • Nodes (Validators and Full nodes): Extend telemetry subscribers with allocations per thread metrics.
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

@semenov-vladyslav semenov-vladyslav requested review from a team as code owners November 16, 2025 22:24
@vercel
Copy link

vercel bot commented Nov 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

6 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
apps-backend Ignored Ignored Preview Dec 12, 2025 0:11am
apps-ui-kit Ignored Ignored Preview Dec 12, 2025 0:11am
iota-evm-bridge Ignored Ignored Preview Dec 12, 2025 0:11am
iota-multisig-toolkit Ignored Ignored Preview Dec 12, 2025 0:11am
rebased-explorer Ignored Ignored Preview Dec 12, 2025 0:11am
wallet-dashboard Ignored Ignored Preview Dec 12, 2025 0:11am

@iota-ci iota-ci added core-protocol node Issues related to the Core Node team labels Nov 16, 2025
@semenov-vladyslav semenov-vladyslav requested a review from a team as a code owner November 20, 2025 06:39
@semenov-vladyslav semenov-vladyslav force-pushed the core-node/flamegraph-alloc branch from b57f73d to 94b11f3 Compare November 20, 2025 06:44
@semenov-vladyslav semenov-vladyslav force-pushed the core-node/flamegraph-alloc branch from 94b11f3 to ff496d9 Compare November 20, 2025 16:50
@semenov-vladyslav semenov-vladyslav requested a review from a team as a code owner November 20, 2025 16:50
@semenov-vladyslav semenov-vladyslav force-pushed the core-node/flamegraph-alloc branch from ff496d9 to fa7b808 Compare November 21, 2025 13:24
@semenov-vladyslav semenov-vladyslav requested a review from a team as a code owner November 21, 2025 21:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds allocation tracking to flamegraphs by implementing a global allocator wrapper that counts allocation metrics (alloc, dealloc, peak) per thread. The feature uses the unstable thread_local attribute and is guarded behind the "flamegraph-alloc" feature flag.

Key Changes

  • Implements a CounterAlloc wrapper around the global allocator to track per-thread allocation metrics
  • Refactors the SVG rendering code to support multiple measurement types (time or memory allocations)
  • Integrates allocation tracking into the admin API with a new mem query parameter
  • Adds support for custom Rust toolchains and cargo features in the AWS orchestrator

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/telemetry-subscribers/src/lib.rs Adds feature gate for unstable thread_local feature
crates/telemetry-subscribers/src/flamegraph/alloc.rs Implements allocator wrapper and per-thread metrics tracking
crates/telemetry-subscribers/src/flamegraph/metric.rs Integrates allocation metrics into FlameMetric
crates/telemetry-subscribers/src/flamegraph/svg.rs Refactors rendering to support multiple measure types (time/memory)
crates/telemetry-subscribers/src/flamegraph/callgraph.rs Adds Default derive to Frame
crates/telemetry-subscribers/src/flamegraph.rs Exports allocation types when feature is enabled
crates/telemetry-subscribers/Cargo.toml Defines flamegraph-alloc feature
crates/iota-node/src/main.rs Sets up global allocator when feature is enabled
crates/iota-node/src/admin.rs Adds mem parameter to flamegraph API
crates/iota-node/Cargo.toml Propagates feature flag to telemetry-subscribers
crates/iota-benchmark/src/bin/flamegraph.rs Demonstrates usage of allocation tracking in benchmark
crates/iota-benchmark/Cargo.toml Adds feature and required-features for flamegraph binary
crates/iota/src/iota_commands.rs Adds CLI flag for default admin interface address
crates/iota-swarm-config/src/node_config_builder.rs Supports configurable admin interface address
crates/iota-swarm-config/src/network_config_builder.rs Supports default admin interface address in builder
crates/iota-aws-orchestrator/src/settings.rs Adds rust_toolchain and node_features settings
crates/iota-aws-orchestrator/src/protocol/mod.rs Adds nodes_flamegraph_command method
crates/iota-aws-orchestrator/src/protocol/iota.rs Implements custom cargo commands with features
crates/iota-aws-orchestrator/src/orchestrator.rs Fetches flamegraphs separately for time and memory metrics

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@muXxer muXxer force-pushed the core-node/flamegraph-svg branch from 9d2baf7 to 8ec76c5 Compare December 2, 2025 14:07
@muXxer muXxer force-pushed the core-node/flamegraph-alloc branch from 19432d4 to f00b0b9 Compare December 2, 2025 18:23
@muXxer muXxer requested a review from a team as a code owner December 2, 2025 18:23
muXxer added a commit that referenced this pull request Dec 3, 2025
#9495)

# Description of change

This PR adds a section to the `aws-orchestrator` settings to configure
toolchain and features per binary.
This is needed for the tests with the `flamegraph-alloc` flag that will
be introduced by #9298

## How the change has been tested

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes
@muXxer muXxer force-pushed the core-node/flamegraph-svg branch from 8ec76c5 to 45b9030 Compare December 4, 2025 11:34
@muXxer muXxer force-pushed the core-node/flamegraph-alloc branch from f00b0b9 to fad0265 Compare December 4, 2025 11:53
@muXxer muXxer force-pushed the core-node/flamegraph-svg branch from c9a9901 to 8a2b37e Compare December 9, 2025 17:59
@muXxer muXxer force-pushed the core-node/flamegraph-alloc branch from 46a024c to 226a71b Compare December 11, 2025 19:13
@muXxer muXxer requested review from thibault-martinez and removed request for a team December 11, 2025 19:17
@muXxer muXxer force-pushed the core-node/flamegraph-alloc branch 2 times, most recently from 2115a95 to fa46dff Compare December 12, 2025 12:05
@muXxer muXxer force-pushed the core-node/flamegraph-alloc branch from fa46dff to 5894b06 Compare December 12, 2025 12:10
@muXxer muXxer merged commit ec1b310 into feat/flamegraphs Dec 12, 2025
40 checks passed
@muXxer muXxer deleted the core-node/flamegraph-alloc branch December 12, 2025 13:21
muXxer added a commit that referenced this pull request Dec 12, 2025
# Description of change

This PR adds global allocator wrapper counting allocation metrics
(alloc, dealloc, peak) per thread. It uses unstable feature
`thread_local` (it's the only reasonable way, `thread_local!` macro
can't be used) which is guarded behind feature `"flamegraph-alloc"`. The
allocation stats are shown in rendered SVG.

## Links to any relevant issues

Part of #8694.

## How the change has been tested

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes

### Release Notes

- [ ] Protocol:
- [x] Nodes (Validators and Full nodes): Extend telemetry subscribers
with allocations per thread metrics.
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:

---------

Co-authored-by: muXxer <git@muxxer.de>
muXxer added a commit that referenced this pull request Dec 12, 2025
This PR adds global allocator wrapper counting allocation metrics
(alloc, dealloc, peak) per thread. It uses unstable feature
`thread_local` (it's the only reasonable way, `thread_local!` macro
can't be used) which is guarded behind feature `"flamegraph-alloc"`. The
allocation stats are shown in rendered SVG.

Part of #8694.

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes

- [ ] Protocol:
- [x] Nodes (Validators and Full nodes): Extend telemetry subscribers
with allocations per thread metrics.
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:

---------

Co-authored-by: muXxer <git@muxxer.de>
NaitsabesMue pushed a commit that referenced this pull request Dec 17, 2025
#9495)

# Description of change

This PR adds a section to the `aws-orchestrator` settings to configure
toolchain and features per binary.
This is needed for the tests with the `flamegraph-alloc` flag that will
be introduced by #9298

## How the change has been tested

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes
NaitsabesMue pushed a commit that referenced this pull request Dec 17, 2025
This PR adds global allocator wrapper counting allocation metrics
(alloc, dealloc, peak) per thread. It uses unstable feature
`thread_local` (it's the only reasonable way, `thread_local!` macro
can't be used) which is guarded behind feature `"flamegraph-alloc"`. The
allocation stats are shown in rendered SVG.

Part of #8694.

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes

- [ ] Protocol:
- [x] Nodes (Validators and Full nodes): Extend telemetry subscribers
with allocations per thread metrics.
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:

---------

Co-authored-by: muXxer <git@muxxer.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-protocol node Issues related to the Core Node team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants