feat: add optional prometheus metrics endpoint.#186
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #186 +/- ##
==========================================
- Coverage 89.49% 89.42% -0.08%
==========================================
Files 29 30 +1
Lines 1276 1314 +38
Branches 171 176 +5
==========================================
+ Hits 1142 1175 +33
- Misses 92 96 +4
- Partials 42 43 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Left some thoughts.
As stated in developmentseed/eoapi-k8s#541 (comment), I'm generally in favor of this idea.
Before we merge this, we will want to ensure that the PR includes an update to our documentation. At the very least, we should update the config docs. We may also want to include something long-form within /tips.
One thing that stands out to me is how I don't really understand how this works in various deployment scenarios. Based on the fact that we're not configuring any datastore with this plugin, I assume these metrics are held within memory. So how would that work in a multi-node environment? Or what about a serverless environment where an AWS Lambda may or may not be warmed?
6358351 to
78e2486
Compare
78e2486 to
83d234a
Compare
|
Can you have a look again, please? If you agree with this approach (enabled by default, dependency added in main bulk) I am happy to add the documentation. |
b3ec14c to
511be54
Compare
alukach
left a comment
There was a problem hiding this comment.
@pantierra sorry for the back-and-forth.
- serving metrics from
/_mgmt/metrics: 👍 - having
/_mgmt/metricsin defaultpublic_endpoints: 👍
However, I do still think this should be an optional dependency
|
I wasn't sure how you want to do the conditional. Inspired from stac-fastapi-elasticsearch-opensearch I made it to add the metrics endpoint if the dependency extra I gave it a try. Feel free to add over this branch if you prefer to change it. Or just let me know, I am fine to change it to you think is best. |
Yes, metrics are held in memory. In a multi-node setup, Prometheus scrapes each pod separately with possible aggregation when querying them. Serverless is trickier as the metrics need to be pushed. Afaik there are several approaches, but i don't have experience with any. |
|
Based on input developmentseed/eoAPI#193 (comment), adjusted the structure of the metrics to be more STACish. |
12d86c2 to
dca2c8b
Compare
|
Claude finished @pantierra's task in 4m 16s —— View job Reviewing PR #186
✅ No blocking issues — safe to merge. Reviewed the diff of Two non-blocking observations worth being aware of (not asking for changes, since both reflect the tradeoffs already discussed and approved in this thread):
Simplify (ponytail)
💰 Estimated review cost: $1.09 · 4m16s · 27 turns |
🤖 I have created a release *beep* *boop* --- ## [1.2.0](v1.1.1...v1.2.0) (2026-07-23) ### Features * add optional prometheus metrics endpoint. ([#186](#186)) ([6825f23](6825f23)) ### Bug Fixes * add ROOT_PATH_SKIP_PREFIXES to exempt sibling-service links from root_path rewriting 2 ([#198](#198)) ([349986b](349986b)) * allow , delimited string in configuration ([#191](#191)) ([df530a2](df530a2)) * allow Any type for classInput ([#182](#182)) ([56aa3f5](56aa3f5)) * configurable upstream timeout. ([#174](#174)) ([533bac6](533bac6)) * **helm:** make health path take root path into account. ([#189](#189)) ([5236a0e](5236a0e)) * publish helm chart only on release ([#178](#178)) ([c89f650](c89f650)) * **tests:** fix flaky health-check retry test caused by global asyncio.sleep patch ([#193](#193)) ([fec33b6](fec33b6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: ds-release-bot[bot] <116609932+ds-release-bot[bot]@users.noreply.github.com>
Adds opt-in Prometheus metrics support via
prometheus-fastapi-instrumentator, controlled byENABLE_METRICS/enable_metrics. Metrics remain disabled by default and the dependency is available through themetricsextra.