Skip to content

Conversation

@gaby
Copy link
Member

@gaby gaby commented Dec 8, 2025

Summary

  • This pull request introduces a new Prometheus middleware for Fiber v3. The implementation is comprehensive, including a wide range of metrics, configuration options, and thorough tests.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @gaby, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the Prometheus middleware by enabling it to accurately track and report metrics for HTTP HEAD requests. By aliasing HEAD requests to their GET counterparts, the middleware ensures that all relevant metrics, such as request counts, durations, and in-flight requests, are correctly captured. This provides a more robust and complete monitoring solution for applications using Fiber, ensuring no traffic goes unmeasured.

Highlights

  • Prometheus Middleware Enhancement: The Prometheus middleware now correctly handles HTTP HEAD requests, ensuring comprehensive metric collection for all request types.
  • GET-Alias Routing for HEAD Requests: HEAD requests are now aliased to their corresponding GET routes within the middleware's internal route cache, allowing them to be properly instrumented even if no explicit HEAD route is defined.
  • Comprehensive Metric Emission: Counters, histograms, and in-flight gauges are now accurately emitted for HEAD requests, preventing them from being treated as unmatched and providing a more complete view of application traffic.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/test-prometheus.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gaby gaby changed the title Handle HEAD requests in Prometheus middleware 🔥 feat: Prometheus middleware Dec 8, 2025
@ReneWerner87 ReneWerner87 added the ✏️ Feature New feature or request label Dec 8, 2025
@gaby
Copy link
Member Author

gaby commented Dec 8, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Prometheus middleware for Fiber v3 and enhances it to correctly handle HEAD requests by aliasing them to GET routes for instrumentation. The implementation is robust and accompanied by a comprehensive test suite, which is excellent.

My review focuses on improving the usability and maintainability of the new middleware. I've provided two main points of feedback:

  1. A high-severity comment on the README.md to correct the usage example. The current example is misleading and would not instrument application routes as intended. I've suggested a corrected pattern that will help users adopt this middleware correctly.
  2. A medium-severity comment in config.go with a suggestion to refactor the configuration initialization logic to reduce code duplication, improving maintainability.

Overall, this is a great contribution. Once the documentation is updated, this will be a very useful addition to the contrib repository.

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 introduces a new Prometheus middleware for Fiber v3 that provides comprehensive HTTP metrics collection and exposure. The middleware instruments incoming HTTP traffic and exposes metrics via a configurable endpoint.

Key Changes:

  • Implements a Prometheus middleware that records request/response metrics including counters, histograms, and gauges
  • Provides configurable options for custom registries, histogram buckets, OpenMetrics support, and selective metric filtering
  • Includes comprehensive test coverage with 22 test cases covering various configuration scenarios

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
v3/prometheus/prometheus.go Core middleware implementation with metrics collection, route tracking, and OpenTelemetry trace exemplar support
v3/prometheus/config.go Configuration structure with default values and validation for middleware customization
v3/prometheus/prometheus_test.go Comprehensive test suite covering all major features and edge cases
v3/prometheus/README.md User documentation with usage examples and configuration options
v3/prometheus/go.mod Module definition with dependency declarations
v3/prometheus/go.sum Dependency checksums
.github/workflows/test-prometheus.yml CI workflow for automated testing
v3/README.md Updated to list the new prometheus middleware
README.md Updated to list the new prometheus middleware
go.work Added prometheus module to workspace

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

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Prometheus middleware for Fiber v3. The implementation is comprehensive, including a wide range of metrics, configuration options, and thorough tests. My review focuses on a critical issue in the documentation's usage example which would prevent the middleware from working as intended, and a suggestion to modernize the code in the configuration handling by using newer standard library packages for better readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants