Skip to content

Use the configured Prometheus registry in FastMCP - #459

Open
lesnik512 wants to merge 1 commit into
mainfrom
fix/fastmcp-prometheus-registry
Open

lesnik512 wants to merge 1 commit into
mainfrom
fix/fastmcp-prometheus-registry

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Closes #451.

Changes

  • Use the configured Prometheus registry for FastMCP HTTP metrics, tool metrics, and the scrape endpoint. The global registry remains the default.
  • Keep the optional in-progress gauge in the configured registry and share it across generated HTTP apps with matching gauge settings.
  • Document the custom-registry scrape in the 2.x migration guide.

Verification

  • Reproduced the missing HTTP counts in a failing /metrics test. The passing test scrapes two HTTP requests across generated apps, a registered tool call and its duration count, and an application counter.
  • Verified the in-progress gauge increments during requests, returns to zero, and honors per-app gauge names and labels.
  • 669 tests passed with 100% line coverage. The 22 focused Prometheus tests passed at the dependency floors. Ruff, ty, and the strict docs build passed.

This branch has not been deployed

No deployments
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.

[P2] Scrape FastMCP metrics from the configured Prometheus registry

1 participant