Skip to content

Conversation

@monwolf
Copy link
Contributor

@monwolf monwolf commented Nov 6, 2025

  • Implemented Fastify middleware for heap and wall profiling.
  • Renamed tests for Express middleware
  • Added tests for Fastify middleware to verify CPU and heap profiling responses.

- Implemented Express middleware for heap and wall profiling.
- Implemented Fastify middleware for heap and wall profiling.
- Added tests for Express middleware to verify CPU and heap profiling responses.
- Added tests for Fastify middleware to verify CPU and heap profiling responses.
- Both middlewares support simultaneous requests and can be used concurrently in different applications.
@monwolf monwolf requested review from a team as code owners November 6, 2025 12:49
@CLAassistant
Copy link

CLAassistant commented Nov 6, 2025

CLA assistant check
All committers have signed the CLA.

@monwolf
Copy link
Contributor Author

monwolf commented Nov 6, 2025

This PR closes #124 (comment)

@monwolf
Copy link
Contributor Author

monwolf commented Nov 6, 2025

@jake-kramer could you review it?

@jake-kramer
Copy link
Contributor

@monwolf Thanks for your contribution! I can take a look at this next week

@jake-kramer
Copy link
Contributor

I'd like fastify and express to both be peer dependencies so clients aren't forced to install either. I can take a crack at this next week as well.

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 Fastify middleware support to the Pyroscope Node.js profiler alongside the existing Express middleware. The implementation follows a similar pattern to Express but is adapted for Fastify's plugin system.

Key Changes:

  • Added Fastify middleware implementation for heap and wall profiling endpoints
  • Refactored middleware loading to use dynamic imports with optional peer dependencies
  • Added comprehensive test coverage for Fastify middleware
  • Renamed/moved Express middleware files and tests for better organization

Reviewed Changes

Copilot reviewed 4 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/middleware/fastify.ts New Fastify plugin implementation providing /debug/pprof/heap and /debug/pprof/profile routes
src/middleware/express.ts Express middleware relocated to middleware directory
src/index.ts Refactored to dynamically load middleware implementations with error handling for missing peer dependencies
test/fastify.test.ts New comprehensive test suite for Fastify middleware functionality
test/express.test.ts Express tests relocated to match new structure
package.json Added Fastify as optional peer dependency with proper metadata
yarn.lock Updated dependencies including Fastify and related packages

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

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

Copilot reviewed 4 out of 7 changed files in this pull request and generated 3 comments.


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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@bryanhuhta bryanhuhta left a comment

Choose a reason for hiding this comment

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

This is a great new add. LGTM!

@jake-kramer jake-kramer merged commit 33ab97f into grafana:main Nov 13, 2025
10 checks passed
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.

4 participants