|
1 | 1 | # astro-prometheus-node-integration |
2 | 2 |
|
| 3 | +## 1.3.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#179](https://github.com/dvelasquez/astro-prometheus-integration/pull/179) [`a3e2896`](https://github.com/dvelasquez/astro-prometheus-integration/commit/a3e28963a54fe20e97a880144bc9566c8be92f21) Thanks [@dvelasquez](https://github.com/dvelasquez)! - Add configurable histogram buckets for inbound and outbound metrics |
| 8 | + |
| 9 | + Users can now customize histogram bucket boundaries for better performance and query optimization. The new `histogramBuckets` configuration option allows separate bucket configuration for inbound (`http_request_duration_seconds`, `http_server_duration_seconds`) and outbound (`http_response_duration_seconds`) metrics. |
| 10 | + |
| 11 | + When not configured, the integration uses prom-client's default buckets `[0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10]` seconds. |
| 12 | + |
| 13 | + **Example:** |
| 14 | + |
| 15 | + ```js |
| 16 | + prometheusNodeIntegration({ |
| 17 | + histogramBuckets: { |
| 18 | + inbound: [0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10], |
| 19 | + outbound: [0.1, 0.5, 1, 2, 5, 10, 20, 50], |
| 20 | + }, |
| 21 | + }); |
| 22 | + ``` |
| 23 | + |
| 24 | + This change removes the hardcoded buckets from outbound metrics and makes all histogram buckets configurable, allowing users to optimize for their application's typical latency ranges. |
| 25 | + |
3 | 26 | ## 1.2.1 |
4 | 27 |
|
5 | 28 | ### Patch Changes |
|
25 | 48 | This release introduces an experimental feature that allows users to choose between two different methods for measuring Time To Last Byte (TTLB) in streaming responses: |
26 | 49 |
|
27 | 50 | ## ✨ New Features |
28 | | - |
29 | 51 | - **Experimental flag**: `experimental.useOptimizedTTLBMeasurement` in integration config |
30 | 52 | - **Two TTLB measurement methods**: |
31 | 53 | - **Legacy (default)**: Stream wrapping for maximum accuracy but higher CPU usage |
|
49 | 71 | | **Optimized** | Millisecond | Minimal | Minimal | High-concurrency apps | |
50 | 72 |
|
51 | 73 | ## 🎯 Use Cases |
52 | | - |
53 | 74 | - **Set to `true`**: High-concurrency applications, microservices, resource-constrained environments |
54 | 75 | - **Set to `false`**: When maximum timing accuracy is critical |
55 | 76 |
|
56 | 77 | ## ⚠️ Important Notes |
57 | | - |
58 | 78 | - **Experimental feature**: May change in future releases |
59 | 79 | - **Backward compatible**: Defaults to legacy method |
60 | 80 | - **Production ready**: Both methods thoroughly tested |
61 | 81 |
|
62 | 82 | ## 🔍 Technical Improvements |
63 | | - |
64 | 83 | - Extracted TTLB measurement logic to `timing-utils.ts` |
65 | 84 | - Added robust path fallback logic for undefined routePattern |
66 | 85 | - Fixed operator precedence issues with `??` and `||` |
|
79 | 98 | This is a **major breaking change** that optimizes the creation of metrics to avoid performance problems. The current implementation was calling expensive operations on every HTTP request, causing significant performance bottlenecks. |
80 | 99 |
|
81 | 100 | ### ⚠️ Breaking Changes |
82 | | - |
83 | 101 | - **Replaced `findMetrics()` function** with `initializeMetricsCache()` function |
84 | 102 | - **Changed middleware initialization pattern** - metrics are now cached per registry |
85 | 103 | - **Updated `createPrometheusMiddleware` function** signature and behavior |
86 | 104 | - **Modified `onRequest` middleware** to use cached metrics instead of computing on each request |
87 | 105 |
|
88 | 106 | ## 🔧 Performance Improvements |
89 | | - |
90 | 107 | - **94.8% faster request processing** in high-traffic scenarios |
91 | 108 | - **Constant performance** regardless of request volume |
92 | 109 | - **Reduced resource usage** and lower response times |
93 | 110 | - **Eliminated per-request metric computation** overhead |
94 | 111 |
|
95 | 112 | ## 🧪 New Features |
96 | | - |
97 | 113 | - **Comprehensive E2E testing suite** with Playwright |
98 | 114 | - **Automated CI/CD pipeline** with linting, building, and testing |
99 | 115 | - **Cross-browser testing** support |
|
115 | 131 | ``` |
116 | 132 |
|
117 | 133 | ## 🎉 Benefits |
118 | | - |
119 | 134 | 1. **Immediate Performance Gains** - Significant improvement in request processing |
120 | 135 | 2. **Scalability** - Performance remains constant under high load |
121 | 136 | 3. **Reliability** - Comprehensive E2E testing ensures functionality |
|
140 | 155 | ### Patch Changes |
141 | 156 |
|
142 | 157 | - [#22](https://github.com/dvelasquez/astro-prometheus-integration/pull/22) [`a088f4d`](https://github.com/dvelasquez/astro-prometheus-integration/commit/a088f4dba80bdd34f0055f027840f7b8cbae0e56) Thanks [@dvelasquez](https://github.com/dvelasquez)! - Fix Prometheus metrics not recording 500 server errors |
143 | | - |
144 | 158 | - The middleware now properly records metrics for requests that result in unhandled exceptions (HTTP 500 errors). |
145 | 159 | - Added a try/catch around the request handler to ensure that error responses increment the appropriate counters and histograms. |
146 | 160 | - Improved the streaming response handler to also record 500 errors if a streaming failure occurs. |
|
177 | 191 | ### Minor Changes |
178 | 192 |
|
179 | 193 | - [`55fc2aa`](https://github.com/dvelasquez/astro-prometheus-integration/commit/55fc2aabe871363258040f1c469e37df8a2f1897) - Added standalone metrics server option that allows running the Prometheus metrics endpoint on a separate server instance. This feature enables better separation of concerns and more flexible deployment options. |
180 | | - |
181 | 194 | - Added standalone metrics server configuration option |
182 | 195 | - Added integration tests for standalone metrics functionality |
183 | 196 | - Added default metrics test coverage |
|
188 | 201 | ### Patch Changes |
189 | 202 |
|
190 | 203 | - [`d54c8d9`](https://github.com/dvelasquez/astro-prometheus-integration/commit/d54c8d9309bf4a8a33569be2e34672465a75f081) - This release includes several improvements to the codebase: |
191 | | - |
192 | 204 | - Refactored middleware to accept a provided register for better testability |
193 | 205 | - Added unit tests for the middleware and metrics initialization |
194 | 206 | - Updated Biome configuration for better developer experience |
|
200 | 212 | ### Minor Changes |
201 | 213 |
|
202 | 214 | - [`aa29376`](https://github.com/dvelasquez/astro-prometheus-integration/commit/aa29376ec1448b9a526664c784e4142480be6ea1) - feat: Add Prometheus metrics integration |
203 | | - |
204 | 215 | - Added prom-client as a dependency for metrics collection |
205 | 216 | - Implemented middleware for tracking HTTP request metrics |
206 | 217 | - Added /metrics endpoint for Prometheus scraping |
|
0 commit comments