Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds API monitoring capabilities to the template API service by integrating Prometheus metrics collection via fastify-metrics and optional Loki logging via pino-loki. The metrics endpoint can be optionally protected with a bearer token for security.
Changes:
- Added fastify-metrics and pino-loki dependencies for monitoring and logging
- Implemented configurable Loki transport for centralized logging
- Created /metrics endpoint with optional authentication via PROMETHEUS_KEY
- Updated test helper to support passing custom options for testing different configurations
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Added dependencies for fastify-metrics, pino-loki, prom-client, and related packages |
| package.json | Added fastify-metrics and pino-loki to dependencies |
| src/app.ts | Implemented Loki transport configuration, metrics endpoint with optional authentication |
| test/helper.ts | Modified build function to accept optional AppOptions for flexible testing |
| test/routes/metrics.test.ts | Added comprehensive tests for metrics endpoint with and without authentication |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2d48362 to
9380014
Compare
polyipseity
approved these changes
Feb 18, 2026
Member
polyipseity
left a comment
There was a problem hiding this comment.
Reviewed! Once you address the two minor issues by yourself, you can merge it.
2933a14 to
7727a3c
Compare
c4f55b0 to
67f6bcf
Compare
d44d13a to
5caae19
Compare
FlandiaYingman
pushed a commit
that referenced
this pull request
Mar 5, 2026
--------- Co-authored-by: William So <polyipseity@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
How this monitoring system will work is that each API service will expose a fastify-metrics endpoint at /metrics, which requires a prometheus key to access.
this is a Prometheus scrapable endpoint for our monitoring platform.
Furthermore, if provided, it will fastify will log automatically to a Loki logging server using pino-loki.
The rest of the setup for monitoring will be done on the usthing server.