Skip to content

Conversation

ns-rboyd
Copy link
Contributor

feat: Add Google Cloud Pub/Sub provider (WIP)

  • Add new provider to publish alerts to Google Cloud Pub/Sub
  • Include example workflow for publishing alerts
  • Add google-cloud-pubsub dependency

Related to #4892

📑 Description

This PR introduces a new provider for Google Cloud Pub/Sub that enables Keep to publish alerts to GCP Pub/Sub topics. This is the first iteration focusing on publishing capabilities only.

What's included:

  • Google Cloud Pub/Sub provider implementation
  • Authentication support via service account credentials
  • Basic message publishing to topics
  • Example workflow demonstrating usage
  • Provider documentation (README)

What's NOT included (future work):

  • Subscription support for receiving messages
  • Message filtering capabilities
  • Advanced Pub/Sub features (ordering keys, batch settings, etc.)

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

Dependencies Added

  • google-cloud-pubsub >= 2.24.0, < 2.26.0

Usage Example

The provider can be configured with service account credentials and used in workflows to publish alerts:

id: pubsub-alert-workflow
description: Publish all incoming alerts to Google Cloud Pub/Sub
triggers:
  - type: alert
actions:
  - name: publish-to-pubsub
    provider:
      type: pubsub
      config: "{{ providers.pubsub }}"
    with:
      topic_id: "keep-alerts"
      project_id: "{{ providers.pubsub.project_id }}"

Note

This is a work in progress. The current implementation only supports publishing messages to Pub/Sub topics. Future iterations will add subscription support to enable Keep to receive and process messages from Pub/Sub, completing the bidirectional integration needed for the use case described in #4892.

- Add new provider to publish alerts to Google Cloud Pub/Sub
- Include example workflow for publishing alerts
- Add google-cloud-pubsub dependency
@vercel
Copy link

vercel bot commented Jul 18, 2025

@ns-rboyd is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

No linked issues found. Please add the corresponding issues in the pull request description.
Use GitHub automation to close the issue when a PR is merged

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 18, 2025
@ns-rboyd ns-rboyd marked this pull request as draft July 18, 2025 17:12
@dosubot dosubot bot added Documentation Improvements or additions to documentation Feature A new feature Provider Providers related issues labels Jul 18, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: PubsubProvider Validation Ignores Environment Variables

The PubsubProvider's validate_config method incorrectly requires project_id to be explicitly provided. This contradicts the provider's design, which defines project_id as optional and includes fallback logic to retrieve it from the GOOGLE_CLOUD_PROJECT environment variable if not set. Consequently, valid configurations relying on the environment variable will fail validation.

keep/providers/pubsub_provider/pubsub_provider.py#L66-L72

)
if not all([
self.authentication_config.project_id,
self.authentication_config.topic_id,
self.authentication_config.service_account_json
]):
raise Exception("All PubSub authentication parameters are required")

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@shahargl
Copy link
Member

shahargl commented Sep 7, 2025

closing as stale. please open again if relevant!

@shahargl shahargl closed this Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Feature A new feature Provider Providers related issues size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants