cozystack icon indicating copy to clipboard operation
cozystack copied to clipboard

bugfix fix nats monitoring

Open klinch0 opened this issue 4 months ago • 2 comments

What this PR does

Release note

[]

klinch0 avatar Sep 03 '25 12:09 klinch0

Walkthrough

This PR upgrades the NATS Helm chart from version 1.2.1 to 1.3.13 (application version 2.10.17 to 2.11.8), adds new Grafana dashboards for JetStream and server monitoring, enables Prometheus exporter with TLS support, introduces flexible image configuration options, and adds graceful shutdown configuration.

Changes

Cohort / File(s) Summary
Grafana Dashboards
dashboards/nats/nats-jetstream.json, dashboards/nats/nats-server.json
New dashboards added to monitor NATS JetStream metrics (messages/sec, memory, storage, streams, consumers) and NATS Server metrics (CPU, memory, bytes in/out, connections, subscriptions) via Prometheus data source.
Monitoring Configuration
packages/extra/monitoring/dashboards.list, hack/download-dashboards.sh
Registered two new NATS dashboards in the monitoring system and updated download script to include nats-jetstream and nats-server entries.
Helm Chart Metadata
packages/system/nats/charts/nats/Chart.yaml
Updated chart version from 1.2.1 to 1.3.13 and app version from 2.10.17 to 2.11.8.
Image and Container Configuration
packages/system/nats/charts/nats/values.yaml, packages/system/nats/charts/nats/templates/_helpers.tpl
Bumped container image tags (NATS 2.10.17→2.11.8-alpine, reloader 0.15.0→0.19.1, promExporter 0.15.0→0.17.3, natsBox 0.14.3→0.18.0), added digest and fullImageName fields for flexible image specification, added monitorDomain field under promExporter. Enhanced image template logic to support digest-based and full image name overrides.
Prometheus Exporter and Pod Configuration
packages/system/nats/charts/nats/files/stateful-set/prom-exporter-container.yaml, packages/system/nats/charts/nats/files/stateful-set/pod-template.yaml, packages/system/nats/values.yaml
Made Prometheus exporter metrics endpoint URL dynamic with TLS support (http/https based on monitor.tls.enabled), added 60-second terminationGracePeriodSeconds for graceful shutdown, enabled promExporter and podMonitor globally.
Helm Values and Configuration
packages/apps/nats/templates/nats.yaml
Removed promExporter configuration block from JetStream values.
Documentation
packages/system/nats/charts/nats/README.md
Enhanced container resources guidance, expanded image version and override documentation with multiple examples, updated Prometheus operator links, improved consistency and formatting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Areas requiring extra attention:

  • Image template logic changes in _helpers.tpl — verify digest and fullImageName precedence handling
  • TLS-aware Prometheus exporter endpoint construction — confirm monitorProto and monitorDomain are properly templated
  • Prometheus exporter configuration changes across multiple files (enabled globally in one, removed from another) — ensure consistency and no conflicts
  • Helm chart version bump implications — validate backward compatibility with values structure changes
  • New dashboard JSON syntax and PromQL expressions — verify queries are correct for the monitoring setup

Poem

🐰 The NATS chart hops to 1.3, with dashboards shiny and new, Prometheus metrics dancing in TLS-protected hue, Images versioned with digest and name, graceful shutdowns ensue, Monitoring whiskers twitching at metrics both old and true! 📊✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add monitoring for NATs' accurately summarizes the main objective of the changeset—adding comprehensive monitoring capabilities including Grafana dashboards, Prometheus configuration, and pod monitoring for the NATS system.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 features-nats-monitoring

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.

coderabbitai[bot] avatar Sep 03 '25 12:09 coderabbitai[bot]

@klinch0 is it related to this issue?

  • https://github.com/cozystack/cozystack/issues/1354

kvaps avatar Sep 04 '25 16:09 kvaps

PR rebased and ready for review

kvaps avatar Dec 11 '25 10:12 kvaps