Skip to content

Add Plivo SMS sink#2121

Open
sarveshpatil-plivo wants to merge 2 commits into
robusta-dev:masterfrom
sarveshpatil-plivo:plivo-sms-sink
Open

Add Plivo SMS sink#2121
sarveshpatil-plivo wants to merge 2 commits into
robusta-dev:masterfrom
sarveshpatil-plivo:plivo-sms-sink

Conversation

@sarveshpatil-plivo

Copy link
Copy Markdown

Closes #2118

What this does

Adds a new sink that sends Robusta notifications as SMS to a phone number
using Plivo. It follows the existing sink pattern and is registered in the
sink factory, so it is picked up the same way as the other sinks.

Why

Teams that already use Plivo can now receive cluster alerts and playbook
results over SMS, which is useful for on-call escalation where a chat or
email notification may be missed.

How it works

A plivo_sink block in sinksConfig takes an Auth ID, Auth Token, a sender
number and a destination number. On each notification the sink posts to the
Plivo Messages API over Basic auth. Numbers use E.164 format, and several
recipients can be reached by joining them with <.

Testing

Verified live against a real Plivo account. A notification through the sink
delivered an SMS to the destination number successfully. The Auth Token is
held as a SecretStr so it is not logged.

Adds a Plivo notification sink that sends alert findings as SMS via the
Plivo Messages API, registered in sink_factory and runner_config, with
a docs page. Mirrors the pushover sink.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds a Plivo SMS notification sink with validated configuration, sink-factory registration, finding-to-SMS delivery through Plivo’s API, and documentation for setup and deployment.

Changes

Plivo SMS Sink

Layer / File(s) Summary
Sink contract and factory wiring
src/robusta/core/sinks/plivo/..., src/robusta/core/model/runner_config.py, src/robusta/core/sinks/sink_factory.py
Defines Plivo credentials and phone-number parameters, adds the configuration to RunnerConfig, exposes package types, and registers sink creation.
Finding-to-SMS delivery
src/robusta/core/sinks/plivo/plivo_client.py, src/robusta/core/sinks/plivo/plivo_sink.py
Builds bounded finding messages and submits them as SMS requests to the Plivo Messages API.
Plivo configuration documentation
docs/configuration/sinks/index.rst, docs/configuration/sinks/plivo.rst
Adds the Plivo sink card and documents credentials, phone-number formatting, configuration, and deployment.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RunnerConfig
  participant SinkFactory
  participant PlivoSink
  participant PlivoClient
  participant PlivoAPI
  RunnerConfig->>SinkFactory: provide Plivo configuration
  SinkFactory->>PlivoSink: create sink
  PlivoSink->>PlivoSink: build finding SMS
  PlivoSink->>PlivoClient: send_message
  PlivoClient->>PlivoAPI: POST SMS request
Loading

Suggested reviewers: naomi-robusta

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the main change: adding a Plivo SMS sink.
Description check ✅ Passed The description matches the implemented Plivo SMS sink and its configuration details.
Linked Issues check ✅ Passed The PR satisfies #2118 by adding a native Plivo sink, registering it, and supporting the required config.
Out of Scope Changes check ✅ Passed The documentation and code additions all support the Plivo sink feature and do not appear unrelated.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/robusta/core/sinks/plivo/plivo_client.py`:
- Around line 17-23: Wrap the requests.post call in the Plivo client send flow
with a try/except for requests.exceptions.RequestException, logging the
exception safely instead of allowing it to propagate. Preserve the existing
response status/error logging for completed non-OK responses.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3921bd77-783b-4f4d-af2a-e00c58e22ebc

📥 Commits

Reviewing files that changed from the base of the PR and between 05f75e8 and 924ac5c.

📒 Files selected for processing (8)
  • docs/configuration/sinks/index.rst
  • docs/configuration/sinks/plivo.rst
  • src/robusta/core/model/runner_config.py
  • src/robusta/core/sinks/plivo/__init__.py
  • src/robusta/core/sinks/plivo/plivo_client.py
  • src/robusta/core/sinks/plivo/plivo_sink.py
  • src/robusta/core/sinks/plivo/plivo_sink_params.py
  • src/robusta/core/sinks/sink_factory.py

Comment thread src/robusta/core/sinks/plivo/plivo_client.py Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/robusta/core/sinks/plivo/plivo_client.py (1)

25-26: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Catch only request failures here.

except Exception also hides programming and configuration errors, making delivery failures appear handled while masking bugs. Narrow this to requests.exceptions.RequestException; let unexpected exceptions reach the sink-level error handling.

-        except Exception as e:
+        except requests.exceptions.RequestException as e:
             logging.error(f"Error sending Plivo SMS to {dst}: {e}", exc_info=True)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/robusta/core/sinks/plivo/plivo_client.py` around lines 25 - 26, In the
Plivo SMS request handling around the existing exception block, replace the
broad Exception catch with requests.exceptions.RequestException so only request
failures are logged with exc_info=True; allow programming and configuration
errors to propagate to the sink-level error handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/robusta/core/sinks/plivo/plivo_client.py`:
- Around line 25-26: In the Plivo SMS request handling around the existing
exception block, replace the broad Exception catch with
requests.exceptions.RequestException so only request failures are logged with
exc_info=True; allow programming and configuration errors to propagate to the
sink-level error handling.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3154bd82-13bf-42ed-b8e0-4844197a1b6a

📥 Commits

Reviewing files that changed from the base of the PR and between 924ac5c and 97707e4.

📒 Files selected for processing (1)
  • src/robusta/core/sinks/plivo/plivo_client.py

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.

New Sink: Plivo

2 participants