Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix too many values to unpack on Prometheus simulation #1702

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

igorhrcek
Copy link
Contributor

Changes

This PR fixes the following error:

2025-01-21 14:28:47.573 ERROR    Failed to execute action prometheus_alert cluster_name: mai***dev, account_id: 6ff***da1, alertmanager_public_url: htt***.io, alertmanager_url: htt***093, check_prometheus_flags: Tru***, custom_annotations: [], custom_severity_map: {}, grafana_api_key: , grafana_dashboard_uid: , grafana_url: htt***.io, prometheus_url: htt***eus, signing_key: 63d***95b, alert_name: Inc***ing, severity: cri***cal, labels: rob***jor, promql_query: 0.7***>50, annotations: das***.io, runbook_url: htt***com
Traceback (most recent call last):
  File "/app/src/robusta/core/playbooks/playbooks_event_handler_impl.py", line 242, in __run_playbook_actions
    registered_action.func(execution_event, params)
  File "/venv/lib/python3.11/site-packages/robusta_playbooks/prometheus_simulation.py", line 126, in prometheus_alert
    annotations.update(parse_by_operator(prometheus_event_data.annotations, ":"))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.11/site-packages/robusta_playbooks/prometheus_simulation.py", line 23, in parse_by_operator
    key, val = pairs.split(operator)
    ^^^^^^^^
ValueError: too many values to unpack (expected 2)

when trying to simulate an alert using the following command:

./robusta playbooks trigger prometheus_alert --namespace=monitoring alert_name="IncidentIoSeverityTesting" severity=critical labels="robusta_incidentio_severity:major" annotations="dashboard_url=https://grafana.com,runbook_url=https://google.com"

Additionally, I've changed the operator for annotations to be the same as for labels.

Risks

None

Performance impact

None

Security impact

None

How to QA

  1. Send a request
./robusta playbooks trigger prometheus_alert --namespace=monitoring alert_name="IncidentIoSeverityTesting" severity=critical labels="robusta_incidentio_severity:major" annotations="dashboard_url:https://grafana.com,runbook_url:https://google.com"
  1. Check Finding information

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.

1 participant