Skip to content

feat: add Confluent Cloud billing plugin#79

Open
LZG3530606141 wants to merge 1 commit into
opencost:mainfrom
LZG3530606141:feat/confluent-plugin
Open

feat: add Confluent Cloud billing plugin#79
LZG3530606141 wants to merge 1 commit into
opencost:mainfrom
LZG3530606141:feat/confluent-plugin

Conversation

@LZG3530606141
Copy link
Copy Markdown

Summary

Implements Confluent Cloud billing plugin for OpenCost Plugins, as requested in #47.

What

  • New ConfluentCostSource plugin that ingests Confluent Cloud billing data into OpenCost
  • Follows the OpenCost plugin architecture (hashicorp go-plugin + gRPC)

Features

  • Cost listing: Fetches costs via Confluent Billing v1 API with pagination support
  • Basic Auth: Uses API Key + API Secret with HTTP Basic authentication
  • Rich cost mapping: Maps Confluent cost fields to FOCUS spec including:
    • Product (Kafka, Schema Registry, ksqlDB, Flink, etc.)
    • Line Type, Resource Display Name, Environment
    • Network Access Type, Granularity
    • Amount, Original Amount, Discount Amount
    • Quantity, Unit, Price
  • Rate limiting: Respects Confluent Cloud API rate limits
  • Pagination: Handles paginated API responses via page_token

Implementation Details

  • Plugin directory structure follows OpenCost conventions:
    • cmd/main/main.go - Main plugin implementation
    • cmd/main/main_test.go - Unit tests
    • cmd/validator/main/main.go - Config validator
    • config/confluentconfig.go - Configuration struct
    • confluentplugin/confluentbilling.go - API response types
  • Config: confluent_api_key (required), confluent_api_secret (required), confluent_plugin_log_level (optional)
  • CostSource: "data_streaming", Domain: "confluent"

Testing

Unit tests cover:

  • Confluent Cost JSON unmarshalling with nested resource/environment
  • CostList paginated response parsing
  • Multiple product types (Kafka, Schema Registry)

References

Closes #47

Signed-off-by: LZG3530606141 3530606141@qq.com

- Implement ConfluentCostSource for ingesting Confluent Cloud billing data
- Fetch costs via Confluent Billing v1 API with pagination support
- Support Basic Auth with API key/secret pair
- Map Confluent cost fields to FOCUS spec including product, line_type,
  resource display name, environment, network access type, granularity
- Include rate limiting and proper error handling
- Add unit tests for JSON unmarshalling
- Add config validator
- Follow OpenCost plugin architecture (hashicorp go-plugin)

References:
- Confluent Billing API: https://docs.confluent.io/cloud/current/api.html#tag/Costs-(billingv1)
- Issue: opencost#47

Signed-off-by: LZG3530606141 <3530606141@qq.com>
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.

Confluent Plugin

1 participant