Documentation
¶
Index ¶
- Constants
- func AddNewUserToTenant() error
- func AssignPlanToCustomers() error
- func AssignTenantToUser() error
- func BulkReprocessEvents(params BulkReprocessEventsParams) error
- func CopyPlanChargesToAddons() error
- func GenerateNewAPIKey() error
- func ImportPricing() error
- func MigrateBillingCycle() error
- func MigrateEnvironments() error
- func MigrateInvoiceSequences() error
- func OnboardNewTenant() error
- func ProcessCSVFeatures() error
- func ReprocessEvents(params ReprocessEventsScriptParams) error
- func ReprocessEventsFromEnv() error
- func SeedEventsClickhouse() error
- func SeedEventsFromMeters() error
- func SyncBillingCustomers() error
- func SyncPlanPrices() error
- func TestKafkaConnection(brokers []string, username, password string) error
- type BatchResult
- type BulkReprocessEventsParams
- type BulkReprocessEventsScript
- type CSVFeatureProcessor
- type CSVFeatureRecord
- type DryRunResult
- type EventGenerator
- type MeterType
- type MigrateBillingCycleParams
- type PricingImportSummary
- type PricingRow
- type ProcessingSummary
- type ReprocessEventsScript
- type ReprocessEventsScriptParams
Constants ¶
const ( NUM_EVENTS = 10000 BATCH_SIZE = 100 // Reduced batch size REQUESTS_PER_SEC = 50 // Rate limit: requests per second MAX_RETRIES = 1 // Maximum number of retries for failed requests INITIAL_BACKOFF = 100 // Initial backoff in milliseconds API_ENDPOINT = "https://api.cloud.flexprice.io/v1/events" TIMEOUT_SECONDS = 5 )
Variables ¶
This section is empty.
Functions ¶
func AddNewUserToTenant ¶ added in v1.0.18
func AddNewUserToTenant() error
func AssignPlanToCustomers ¶ added in v1.0.18
func AssignPlanToCustomers() error
AssignPlanToCustomers assigns a specific plan to customers who don't already have a subscription for it
func AssignTenantToUser ¶
func AssignTenantToUser() error
AssignTenantToUser assigns a tenant to a user
func BulkReprocessEvents ¶ added in v1.0.18
func BulkReprocessEvents(params BulkReprocessEventsParams) error
BulkReprocessEvents pulls all customers and triggers reprocessing for their active subscriptions
func CopyPlanChargesToAddons ¶ added in v1.0.25
func CopyPlanChargesToAddons() error
CopyPlanChargesToAddons copies all charges from plans to addons
func ImportPricing ¶ added in v1.0.17
func ImportPricing() error
ImportPricing is the main function to import pricing data from a CSV file
func MigrateBillingCycle ¶ added in v1.0.27
func MigrateBillingCycle() error
NOTE: It does not handle proration for subscriptions when changing the billing date. MigrateBillingCycle migrates subscriptions from anniversary to calendar billing cycle
func MigrateEnvironments ¶
func MigrateEnvironments() error
MigrateEnvironments is the main function that migrates all entities to use environment_id
func MigrateInvoiceSequences ¶ added in v1.0.21
func MigrateInvoiceSequences() error
func OnboardNewTenant ¶
func OnboardNewTenant() error
func ProcessCSVFeatures ¶ added in v1.0.28
func ProcessCSVFeatures() error
ProcessCSVFeatures is the main function to process CSV data and create features and prices
func ReprocessEvents ¶ added in v1.0.17
func ReprocessEvents(params ReprocessEventsScriptParams) error
ReprocessEvents triggers reprocessing of events with given parameters
func ReprocessEventsFromEnv ¶ added in v1.0.18
func ReprocessEventsFromEnv() error
ReprocessEventsFromEnv triggers reprocessing of events using environment variables (for backwards compatibility)
func SeedEventsClickhouse ¶
func SeedEventsClickhouse() error
SeedEventsClickhouse seeds events data into Clickhouse
func SeedEventsFromMeters ¶
func SeedEventsFromMeters() error
SeedEventsFromMeters seeds events data based on existing meters
func SyncBillingCustomers ¶ added in v1.0.13
func SyncBillingCustomers() error
func SyncPlanPrices ¶ added in v1.0.17
func SyncPlanPrices() error
SyncPlanPrices synchronizes all prices from a plan to subscriptions using the plan service
func TestKafkaConnection ¶
Types ¶
type BatchResult ¶
type BulkReprocessEventsParams ¶ added in v1.0.18
type BulkReprocessEventsParams struct {
TenantID string
EnvironmentID string
EventName string
BatchSize int
}
BulkReprocessEventsParams holds parameters for bulk reprocessing events
type BulkReprocessEventsScript ¶ added in v1.0.18
type BulkReprocessEventsScript struct {
// contains filtered or unexported fields
}
BulkReprocessEventsScript holds all dependencies for the script
type CSVFeatureProcessor ¶ added in v1.0.28
type CSVFeatureProcessor struct {
// contains filtered or unexported fields
}
CSVFeatureProcessor handles the processing of CSV data for features and prices
type CSVFeatureRecord ¶ added in v1.0.28
type CSVFeatureRecord struct {
FeatureName string
EventName string
Aggregation string
PlanName string // serverless or dedicated
Amount string
Currency string
}
CSVFeatureRecord represents a single record from the CSV file
type DryRunResult ¶ added in v1.0.21
type EventGenerator ¶
type EventGenerator struct {
// contains filtered or unexported fields
}
EventGenerator holds the configuration for generating events
func NewEventGenerator ¶
func NewEventGenerator(meters []*meter.Meter, customers []*customer.Customer, logger *logger.Logger) *EventGenerator
NewEventGenerator creates a new event generator with the given meters
type MigrateBillingCycleParams ¶ added in v1.0.27
MigrateBillingCycleParams holds parameters for billing cycle migration
type PricingImportSummary ¶ added in v1.0.17
type PricingImportSummary struct {
TotalRows int
MetersUpdated int
MetersDeleted int
FeaturesUpdated int
FeaturesDeleted int
PricesCreated int
PricesUpdated int
PricesDeleted int
Errors []string
}
PricingImportSummary contains statistics about the import process
type PricingRow ¶ added in v1.0.17
type PricingRow struct {
FeatureName string `json:"feature_name" csv:"feature_name"`
EventName string `json:"event_name" csv:"event_name"`
Aggregation string `json:"aggregation" csv:"aggregation"`
Filters string `json:"filters" csv:"filters"`
PerUnitPrice float64 `json:"per_unit_price" csv:"per_unit_price"`
PlanName string `json:"plan_name" csv:"plan_name"`
FeatureID string `json:"feature_id" csv:"feature_id"`
MeterID string `json:"meter_id" csv:"meter_id"`
PriceID string `json:"price_id" csv:"price_id"`
PlanID string `json:"plan_id" csv:"plan_id"`
Delete string `json:"delete" csv:"delete"`
}
PricingRow represents a row in the pricing CSV file
type ProcessingSummary ¶ added in v1.0.28
type ProcessingSummary struct {
TotalRows int
MetersCreated int
FeaturesCreated int
PricesCreated int
Errors []string
}
ProcessingSummary contains statistics about the processing
type ReprocessEventsScript ¶ added in v1.0.17
type ReprocessEventsScript struct {
// contains filtered or unexported fields
}
ReprocessEventsScript holds all dependencies for the script
type ReprocessEventsScriptParams ¶ added in v1.0.18
type ReprocessEventsScriptParams struct {
TenantID string
EnvironmentID string
ExternalCustomerID string
EventName string
StartTime time.Time
EndTime time.Time
BatchSize int
}
ReprocessEventsScriptParams holds all parameters for the reprocess events script
Source Files
¶
- add_new_user.go
- assign_plan.go
- bulk_reprocess_events.go
- clickhouse.go
- csv_feature_processor.go
- environment_migration.go
- kafka_test_connection.go
- migrate_billing_cycle.go
- migrate_invoice_sequences.go
- migrate_to_addon.go
- onboard_tenents.go
- pricing_import.go
- reprocess_events.go
- rollout_price.go
- scripts.go
- seed_events.go
- tenant_onboarding.go