Skip to content

RFC: Add Flamegraph Support to VRL Command for Performance Debugging #1540

@jlambatl

Description

@jlambatl

A note for the community

Add flamegraph profiling capabilities to the vector vrl command to help users identify performance bottlenecks in their VRL (Vector Remap Language) scripts. This feature would generate interactive flame graphs showing function call hierarchies and execution time distribution, making it easier to optimise VRL transformations.

Motivation

VRL scripts can become complex and performance-critical in production Vector deployments. Currently, users have limited visibility into VRL performance characteristics and must rely on:

  • Manual timing with print statements
  • High-level metrics from Vector's observability
  • Trial-and-error optimisation approaches
  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Use Cases

This proposal addresses the need for detailed, function-level performance profiling to help users:

  1. Identify hot paths in complex VRL scripts
  2. Optimise expensive operations like regex matching, parsing, or nested object manipulation
  3. Debug unexpected performance degradation when modifying existing scripts
  4. Validate performance improvements after optimisation attempts

Attempted Solutions

While flamegraphs are one solution, we could opt for a standardised output format and allow teams to use tools that they prefer, one such example could be pprof, although I am open to suggestion.

Proposal

New CLI Options

Add profiling flags to the existing vector vrl command:

# Generate flamegraph for a VRL script
vector vrl --flamegraph <output> -p script.vrl -i input.json

This could also be

# Generate profiling output for a VRL script
vector vrl --profiler <output> -p script.vrl -i input.json

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featureA value-adding code addition that introduce new functionality.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions