export Membrane Version as Prometheus metric#2795
Conversation
📝 WalkthroughWalkthroughA version metric was added to Prometheus output by introducing a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@core/src/main/java/com/predic8/membrane/core/interceptor/prometheus/PrometheusInterceptor.java`:
- Around line 164-166: buildVersionLine currently appends a mangled version
metric into ctx.count which mixes it with membrane_count TYPE header; change
buildVersionLine to write directly to ctx.sb (not ctx.count), emit a "# TYPE
membrane_info gauge" line before the metric, and use the raw VERSION as the
label value instead of prometheusCompatibleName (but make sure to escape any
backslashes and double-quotes in VERSION) so the metric becomes e.g. "# TYPE
membrane_info gauge\nmembrane_info{version=\"<escaped VERSION>\"} 1\n". Ensure
you only reference prometheusCompatibleName for metric/label names elsewhere and
avoid altering label values here.
Summary by CodeRabbit