Skip to content

Conversation

@darklight3it
Copy link
Contributor

@darklight3it darklight3it commented Oct 23, 2025

Enable Configurable Profiler Output Formats

This PR adds support for configurable profiler start/stop commands in the AWS Lambda Java Profiler extension, allowing users to customize the profiling output format and behavior.

Changes

New Constants.java

  • Introduces environment variable support for profiler commands:
    • AWS_LAMBDA_PROFILER_START_COMMAND - customize the async-profiler start command (default: start,event=wall,interval=1us)
    • AWS_LAMBDA_PROFILER_STOP_COMMAND - customize the async-profiler stop command (default: stop,file=%s,include=*AWSLambda.main,include=start_thread)
  • Adds getFilePathFromEnv() to extract the output file path from the start command

Updated PreMain.java

  • Refactored to use the new Constants class for profiler commands
  • Enables users to specify different output formats (HTML, JFR, collapsed stacks, etc.) via environment variables

Usage

Users can now configure the profiler output by setting environment variables:

# Example: Output as JFR format instead of HTML
AWS_LAMBDA_PROFILER_START_COMMAND="start,event=wall,interval=1us,file=/tmp/profile.jfr"
AWS_LAMBDA_PROFILER_STOP_COMMAND="stop,file=%s"

@darklight3it darklight3it self-assigned this Dec 3, 2025
@darklight3it darklight3it changed the title chore: enabling different format outputs Enable Configurable Profiler Output Formats Dec 4, 2025
@darklight3it darklight3it force-pushed the dmelfi/enabling-different-format-outputs-in-profiler branch from 5ca0e1c to f7b22a0 Compare December 4, 2025 11:51
@darklight3it darklight3it marked this pull request as ready for review December 4, 2025 12:14
Copy link
Member

@maxday maxday left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for adding testing too

@darklight3it darklight3it merged commit 2906db3 into main Dec 8, 2025
4 checks passed
@darklight3it darklight3it deleted the dmelfi/enabling-different-format-outputs-in-profiler branch December 8, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants