Documentation
¶
Index ¶
- Constants
- func AssignTenantToUser() error
- func GenerateNewAPIKey() error
- func ImportPricing() error
- func MigrateEnvironments() error
- func OnboardNewTenant() error
- func ReprocessEvents() error
- func SeedEventsClickhouse() error
- func SeedEventsFromMeters() error
- func SyncBillingCustomers() error
- func SyncPlanPrices() error
- func TestKafkaConnection(brokers []string, username, password string) error
- type BatchResult
- type EventGenerator
- type MeterType
- type PricingImportSummary
- type PricingRow
- type ReprocessEventsScript
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 AssignTenantToUser ¶
func AssignTenantToUser() error
AssignTenantToUser assigns a tenant to a user
func ImportPricing ¶ added in v1.0.17
func ImportPricing() error
ImportPricing is the main function to import pricing data from a CSV file
func MigrateEnvironments ¶
func MigrateEnvironments() error
MigrateEnvironments is the main function that migrates all entities to use environment_id
func OnboardNewTenant ¶
func OnboardNewTenant() error
func ReprocessEvents ¶ added in v1.0.17
func ReprocessEvents() error
ReprocessEvents triggers reprocessing of events
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
func TestKafkaConnection ¶
Types ¶
type BatchResult ¶
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 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 ReprocessEventsScript ¶ added in v1.0.17
type ReprocessEventsScript struct {
// contains filtered or unexported fields
}
ReprocessEventsScript holds all dependencies for the script