Add Plivo SMS sink#2121
Conversation
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.
|
|
WalkthroughAdds 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. ChangesPlivo SMS Sink
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
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (8)
docs/configuration/sinks/index.rstdocs/configuration/sinks/plivo.rstsrc/robusta/core/model/runner_config.pysrc/robusta/core/sinks/plivo/__init__.pysrc/robusta/core/sinks/plivo/plivo_client.pysrc/robusta/core/sinks/plivo/plivo_sink.pysrc/robusta/core/sinks/plivo/plivo_sink_params.pysrc/robusta/core/sinks/sink_factory.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/robusta/core/sinks/plivo/plivo_client.py (1)
25-26: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winCatch only request failures here.
except Exceptionalso hides programming and configuration errors, making delivery failures appear handled while masking bugs. Narrow this torequests.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
📒 Files selected for processing (1)
src/robusta/core/sinks/plivo/plivo_client.py
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_sinkblock insinksConfigtakes an Auth ID, Auth Token, a sendernumber 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.