Skip to content

Comments

export Membrane Version as Prometheus metric#2795

Merged
predic8 merged 1 commit intomasterfrom
prometheus_version
Feb 23, 2026
Merged

export Membrane Version as Prometheus metric#2795
predic8 merged 1 commit intomasterfrom
prometheus_version

Conversation

@rrayst
Copy link
Member

@rrayst rrayst commented Feb 17, 2026

Summary by CodeRabbit

  • New Features
    • Added version metric to Prometheus output, enabling better visibility into the system version through monitoring dashboards.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

A version metric was added to Prometheus output by introducing a buildVersionLine(Context ctx) method in PrometheusInterceptor that appends version information, integrated into the response builder with a static import of VERSION.

Changes

Cohort / File(s) Summary
Prometheus Version Metric
core/src/main/java/com/predic8/membrane/core/interceptor/prometheus/PrometheusInterceptor.java
Added buildVersionLine(Context ctx) private method to output membrane_info metric with version data. Integrated into buildPrometheusStyleResponse to ensure version metric appears in Prometheus-style responses. Static import for VERSION added.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐰 A whisker twitch, a metric new,
Version info, shining through,
Prometheus sees what hops about,
No more guessing—membrane shouts! 📊

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'export Membrane Version as Prometheus metric' directly and clearly describes the main change: adding version information as a Prometheus metric to the output.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch prometheus_version

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@predic8 predic8 merged commit eb88166 into master Feb 23, 2026
5 checks passed
@predic8 predic8 deleted the prometheus_version branch February 23, 2026 13:05
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.

2 participants