Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[monitoring] Add slack dashboard url and vmagent env label and dynamictext-panel to Grafna#2210

Open
vnyakas wants to merge 1 commit intocozystack:maincozystack/cozystack:mainfrom
alphacruncher:monitoring/add-slack-dashboard-url-and-vmagent-env-labelalphacruncher/cozystack:monitoring/add-slack-dashboard-url-and-vmagent-env-labelCopy head branch name to clipboard
Open

[monitoring] Add slack dashboard url and vmagent env label and dynamictext-panel to Grafna#2210
vnyakas wants to merge 1 commit intocozystack:maincozystack/cozystack:mainfrom
alphacruncher:monitoring/add-slack-dashboard-url-and-vmagent-env-labelalphacruncher/cozystack:monitoring/add-slack-dashboard-url-and-vmagent-env-labelCopy head branch name to clipboard

Conversation

@vnyakas
Copy link

@vnyakas vnyakas commented Mar 12, 2026

What this PR does

Extends the monitoring system chart with additional optional configuration for the Alerta Slack plugin, a VMAgent environment label, and adds a Grafana plugin to the custom image build.

Alerta — Slack plugin (alerta.alerts.slack)

Value Env var Description
dashboardUrl DASHBOARD_URL Links Slack alert messages back to the Alerta console
summaryFmt SLACK_SUMMARY_FMT Jinja2 template string for customizing Slack message format

All new fields are optional and default to empty, preserving existing behavior when unset.

VMAgent — external labels (vmagent.externalLabels)

  • Added optional environment label that gets attached to all scraped metrics (e.g. Staging, Production)
  • When left empty, no label is added and Alerta falls back to its built-in default of "Production"

Grafana — custom image

Added marcusolsson-dynamictext-panel plugin to the Grafana image build

Release note

[monitoring] Add optional Slack DASHBOARD_URL and SLACK_SUMMARY_FMT configuration for Alerta, optional vmagent environment external label, and marcusolsson-dynamictext-panel Grafana plugin

Summary by CodeRabbit

  • New Features
    • Added an additional Grafana visualization panel to expand dashboard options.
    • Extended Slack alerting with optional dashboard URL and customizable summary format.
    • Added an optional environment label for external metric ingestion to improve context and filtering.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the monitoring system chart by providing greater flexibility and customization options for alert management and metric collection. It allows users to configure richer Slack notifications for Alerta, categorize metrics with environment labels via VMAgent, and extends Grafana's dashboard functionality with a new dynamic text panel. These changes aim to improve operational visibility and alert context within the monitoring stack.

Highlights

  • Alerta Slack Integration: Introduced optional DASHBOARD_URL and SLACK_SUMMARY_FMT environment variables for the Alerta Slack plugin, allowing for more customized alert messages and linking back to the Alerta console.
  • VMAgent Environment Label: Added an optional environment external label to VMAgent, enabling the attachment of environment-specific labels (e.g., "Staging", "Production") to all scraped metrics.
  • Grafana Plugin: Included the marcusolsson-dynamictext-panel plugin in the custom Grafana image build, expanding Grafana's visualization capabilities.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • packages/system/monitoring/images/grafana/Dockerfile
    • Added marcusolsson-dynamictext-panel plugin installation.
  • packages/system/monitoring/templates/alerta/alerta.yaml
    • Introduced conditional DASHBOARD_URL and SLACK_SUMMARY_FMT environment variables for Alerta's Slack plugin.
  • packages/system/monitoring/templates/vm/vmagent.yaml
    • Added a conditional environment field to externalLabels for VMAgent.
  • packages/system/monitoring/values.yaml
    • Added dashboardUrl and summaryFmt fields to alerta.alerts.slack with empty default values.
    • Added environment field to vmagent.externalLabels with an empty default value.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

📝 Walkthrough

Walkthrough

Adds a Grafana panel plugin installation; adds two optional Alerta Slack env vars (DASHBOARD_URL, SLACK_SUMMARY_FMT); and introduces an optional vmagent external label environment with corresponding values.yaml entries.

Changes

Cohort / File(s) Summary
Grafana Plugin Installation
packages/system/monitoring/images/grafana/Dockerfile
Appends grafana-cli plugins install marcusolsson-dynamictext-panel to the Dockerfile plugin installation commands.
Alerta Slack Configuration
packages/system/monitoring/templates/alerta/alerta.yaml, packages/system/monitoring/values.yaml
Adds conditionally rendered DASHBOARD_URL and SLACK_SUMMARY_FMT environment variables in the Alerta template, gated by .Values.alerta.alerts.slack.dashboardUrl and .Values.alerta.alerts.slack.summaryFmt.
vmagent External Label & Values
packages/system/monitoring/templates/vm/vmagent.yaml, packages/system/monitoring/values.yaml
Introduces an optional environment external label in vmagent using a Helm conditional (.Values.vmagent.externalLabels.environment) and adds the key to values.yaml; value is quoted when rendered.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped into builds with a curious twitch,
A panel for Grafana — bright as a stitch,
Two Slack whispers tucked in neat and calm,
An env label added like a tiny charm,
Cheers from my burrow — monitoring bliss!

🚥 Pre-merge checks | ✅ 3
✅ 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 accurately reflects all three main changes: adding Slack dashboard URL, vmagent environment label, and the Grafana plugin.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can use TruffleHog to scan for secrets in your code with verification capabilities.

Add a TruffleHog config file (e.g. trufflehog-config.yml, trufflehog.yml) to your project to customize detectors and scanning behavior. The tool runs only when a config file is present.

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels Mar 12, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces a new Grafana plugin (marcusolsson-dynamictext-panel), adds configurable DASHBOARD_URL and SLACK_SUMMARY_FMT environment variables for Alerta's Slack integration, and includes an optional environment external label for vmagent. Review feedback suggests improving the robustness of Helm templates by quoting the environment label and Alerta Slack configuration values to prevent YAML parsing issues, and optimizing the Grafana Dockerfile by combining multiple grafana-cli plugins install commands into a single RUN instruction to reduce image layers.

cluster: {{ .Values.vmagent.externalLabels.cluster }}
tenant: {{ .Release.Namespace }}
{{- if .Values.vmagent.externalLabels.environment }}
environment: {{ .Values.vmagent.externalLabels.environment }}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The value for the environment label should be quoted to ensure it's always treated as a string, regardless of its content. Without quotes, values like true, false, 123, or null would be interpreted as booleans, numbers, or nulls by the YAML parser, which is likely not the intended behavior for a label. Please use the quote function.

    environment: {{ .Values.vmagent.externalLabels.environment | quote }}

Comment on lines 14 to +16
RUN grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install natel-discrete-panel
RUN grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install grafana-worldmap-panel
RUN grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install marcusolsson-dynamictext-panel
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To reduce the number of layers in the Docker image and improve build efficiency, you can combine the grafana-cli plugins install commands into a single RUN instruction. The grafana-cli supports installing multiple plugins at once.

RUN grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install natel-discrete-panel grafana-worldmap-panel marcusolsson-dynamictext-panel

Comment on lines +143 to +150
{{- if .Values.alerta.alerts.slack.dashboardUrl }}
- name: DASHBOARD_URL
value: "{{ .Values.alerta.alerts.slack.dashboardUrl }}"
{{- end }}
{{- if .Values.alerta.alerts.slack.summaryFmt }}
- name: SLACK_SUMMARY_FMT
value: "{{ .Values.alerta.alerts.slack.summaryFmt }}"
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

It's a best practice in Helm templates to use the quote function to wrap string values. This prevents issues if the values for dashboardUrl or summaryFmt contain special characters that could break the YAML structure. Please apply the quote function to both values for safety and consistency.

            {{- if .Values.alerta.alerts.slack.dashboardUrl }}
            - name: DASHBOARD_URL
              value: {{ .Values.alerta.alerts.slack.dashboardUrl | quote }}
            {{- end }}
            {{- if .Values.alerta.alerts.slack.summaryFmt }}
            - name: SLACK_SUMMARY_FMT
              value: {{ .Values.alerta.alerts.slack.summaryFmt | quote }}
            {{- end }}

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

🧹 Nitpick comments (1)
packages/system/monitoring/images/grafana/Dockerfile (1)

16-16: Pin the Grafana plugin to a specific version.

Line 16 installs the latest release of marcusolsson-dynamictext-panel at build time, which makes the image non-reproducible and exposes future rebuilds to upstream incompatibilities. Use grafana-cli plugins install marcusolsson-dynamictext-panel <version> with an explicit version compatible with Grafana 11.4.0 (e.g., 6.2.0 or later 6.x release).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/system/monitoring/images/grafana/Dockerfile` at line 16, The
Dockerfile currently installs marcusolsson-dynamictext-panel without a version;
update the RUN command that invokes grafana-cli (the `grafana-cli --pluginsDir
/var/lib/grafana-plugins plugins install marcusolsson-dynamictext-panel` line)
to pin an explicit, tested release (for Grafana 11.4.0 use e.g. `6.2.0` or
another 6.x tag) so the image is reproducible and resilient to upstream changes;
replace the install call with `plugins install marcusolsson-dynamictext-panel
<version>` and ensure the chosen version is compatible with Grafana 11.4.0.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/system/monitoring/templates/alerta/alerta.yaml`:
- Around line 143-149: Apply Helm's quote filter to both
.Values.alerta.alerts.slack.dashboardUrl and
.Values.alerta.alerts.slack.summaryFmt in the alerta.yaml template so the
environment values are properly escaped (matching the existing use of quote for
disabledSeverity); replace the manual double-quote wrapping with the quote
filter for the DASHBOARD_URL and SLACK_SUMMARY_FMT value fields.

---

Nitpick comments:
In `@packages/system/monitoring/images/grafana/Dockerfile`:
- Line 16: The Dockerfile currently installs marcusolsson-dynamictext-panel
without a version; update the RUN command that invokes grafana-cli (the
`grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install
marcusolsson-dynamictext-panel` line) to pin an explicit, tested release (for
Grafana 11.4.0 use e.g. `6.2.0` or another 6.x tag) so the image is reproducible
and resilient to upstream changes; replace the install call with `plugins
install marcusolsson-dynamictext-panel <version>` and ensure the chosen version
is compatible with Grafana 11.4.0.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c94d8c5e-b4f7-4da8-9454-7e7f4704de52

📥 Commits

Reviewing files that changed from the base of the PR and between bf472fb and 567e053.

📒 Files selected for processing (4)
  • packages/system/monitoring/images/grafana/Dockerfile
  • packages/system/monitoring/templates/alerta/alerta.yaml
  • packages/system/monitoring/templates/vm/vmagent.yaml
  • packages/system/monitoring/values.yaml

packages/system/monitoring/templates/alerta/alerta.yaml Outdated Show resolved Hide resolved
Copy link
Member

@kvaps kvaps left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 12, 2026
@kvaps
Copy link
Member

kvaps commented Mar 12, 2026

@vnyakas please fix DCO:

git commit --amend -S
git push --force

that should be included on all commits in this PR, please consider squashing them

@vnyakas vnyakas force-pushed the monitoring/add-slack-dashboard-url-and-vmagent-env-label branch from 48578c0 to 073e171 Compare March 12, 2026 12:57
@vnyakas
Copy link
Author

vnyakas commented Mar 12, 2026

@kvaps Fixed DCO

@kvaps
Copy link
Member

kvaps commented Mar 18, 2026

Hey! Could you please rebase your branch onto the latest main? There's a conflict in packages/system/monitoring/values.yaml.

git fetch upstream main
git rebase upstream/main

The conflict is straightforward — just accept the upstream version (keep the 6-space indentation for URLs and the new inlineScrapeConfig comment block):

      - http://vminsert-shortterm:8480/insert/0/prometheus
      - http://vminsert-longterm:8480/insert/0/prometheus
  ## inlineScrapeConfig: |
  ##   - job_name: "custom"
  ##     static_configs:
  ##       - targets: ["my-service:9090"]

Then force-push:

git push --force-with-lease origin monitoring/add-slack-dashboard-url-and-vmagent-env-label

Thanks!

…nt environment label, and dynamictext Grafana plugin

Signed-off-by: Viktor Nyakas <viktor.nyakas@alphacruncher.com>
@vnyakas vnyakas force-pushed the monitoring/add-slack-dashboard-url-and-vmagent-env-label branch from 073e171 to 83c0271 Compare March 18, 2026 18:07
@vnyakas
Copy link
Author

vnyakas commented Mar 18, 2026

Done

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.

🧹 Nitpick comments (1)
packages/system/monitoring/images/grafana/Dockerfile (1)

16-16: Pin marcusolsson-dynamictext-panel to an explicit version.

Unpinned plugin installs make container builds non-deterministic and can introduce unexpected breakage when upstream publishes updates. Use the grafana-cli plugins install <plugin-id> <version> syntax (space-separated) to specify an explicit version.

Proposed change
+ARG DYNAMICTEXT_PANEL_VERSION=1.3.0
-RUN grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install marcusolsson-dynamictext-panel
+RUN grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install marcusolsson-dynamictext-panel ${DYNAMICTEXT_PANEL_VERSION}

Choose an appropriate version compatible with Grafana 11.4.0 and replace 1.3.0 above. Consider also pinning natel-discrete-panel and grafana-worldmap-panel on lines 14–15 using the same pattern.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/system/monitoring/images/grafana/Dockerfile` at line 16, The RUN
that installs marcusolsson-dynamictext-panel is unpinned, making builds
non-deterministic; change the command to use the grafana-cli plugins install
<plugin-id> <version> syntax and specify an explicit version compatible with
Grafana 11.4.0 for "marcusolsson-dynamictext-panel" (replace the current
unpinned invocation with the same plugin-id plus the chosen version), and apply
the same pinning pattern to the other plugin installs "natel-discrete-panel" and
"grafana-worldmap-panel" so all three use explicit versions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/system/monitoring/images/grafana/Dockerfile`:
- Line 16: The RUN that installs marcusolsson-dynamictext-panel is unpinned,
making builds non-deterministic; change the command to use the grafana-cli
plugins install <plugin-id> <version> syntax and specify an explicit version
compatible with Grafana 11.4.0 for "marcusolsson-dynamictext-panel" (replace the
current unpinned invocation with the same plugin-id plus the chosen version),
and apply the same pinning pattern to the other plugin installs
"natel-discrete-panel" and "grafana-worldmap-panel" so all three use explicit
versions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d74353f5-6cd7-4fe9-9cca-4f3af2e53cc6

📥 Commits

Reviewing files that changed from the base of the PR and between 073e171 and 83c0271.

📒 Files selected for processing (4)
  • packages/system/monitoring/images/grafana/Dockerfile
  • packages/system/monitoring/templates/alerta/alerta.yaml
  • packages/system/monitoring/templates/vm/vmagent.yaml
  • packages/system/monitoring/values.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/system/monitoring/templates/vm/vmagent.yaml
  • packages/system/monitoring/templates/alerta/alerta.yaml
  • packages/system/monitoring/values.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.