Documentation ¶
Index ¶
- Constants
- type AccountId
- type Metronome
- func (m *Metronome) AddDefaultPlan(ctx context.Context, accountId AccountId) (bool, error)
- func (m *Metronome) AddPlan(ctx context.Context, accountId AccountId, planId uuid.UUID) (bool, error)
- func (m *Metronome) CreateAccount(ctx context.Context, namespaceId string, name string) (AccountId, error)
- func (m *Metronome) GetAccountId(ctx context.Context, namespaceId string) (AccountId, error)
- func (m *Metronome) GetInvoiceById(ctx context.Context, accountId AccountId, invoiceId string) (*api.ListInvoicesResponse, error)
- func (m *Metronome) GetInvoices(ctx context.Context, accountId AccountId, r *api.ListInvoicesRequest) (*api.ListInvoicesResponse, error)
- func (m *Metronome) GetUsage(ctx context.Context, id AccountId, r *UsageRequest) (*api.GetUsageResponse, error)
- func (m *Metronome) PushStorageEvents(ctx context.Context, events []*StorageEvent) error
- func (m *Metronome) PushUsageEvents(ctx context.Context, events []*UsageEvent) error
- type MetronomeError
- type Provider
- type StorageEvent
- type StorageEventBuilder
- func (sb *StorageEventBuilder) Build() *StorageEvent
- func (sb *StorageEventBuilder) WithDatabaseBytes(value int64) *StorageEventBuilder
- func (sb *StorageEventBuilder) WithIndexBytes(value int64) *StorageEventBuilder
- func (sb *StorageEventBuilder) WithNamespaceId(id string) *StorageEventBuilder
- func (sb *StorageEventBuilder) WithTimestamp(ts time.Time) *StorageEventBuilder
- func (sb *StorageEventBuilder) WithTransactionId(id string) *StorageEventBuilder
- type UsageEvent
- type UsageEventBuilder
- func (ub *UsageEventBuilder) Build() *UsageEvent
- func (ub *UsageEventBuilder) WithDatabaseUnits(value int64) *UsageEventBuilder
- func (ub *UsageEventBuilder) WithNamespaceId(id string) *UsageEventBuilder
- func (ub *UsageEventBuilder) WithSearchUnits(value int64) *UsageEventBuilder
- func (ub *UsageEventBuilder) WithTimestamp(ts time.Time) *UsageEventBuilder
- func (ub *UsageEventBuilder) WithTransactionId(id string) *UsageEventBuilder
- type UsageReporter
- type UsageRequest
- type WindowSize
Constants ¶
View Source
const ( EventTypeUsage string = "usage" EventTypeStorage string = "storage" TimeFormat = time.RFC3339 StorageIndexBytes = "index_bytes" StorageDbBytes = "database_bytes" UsageSearchUnits = "search_units" UsageDbUnits = "database_units" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metronome ¶
func (*Metronome) AddDefaultPlan ¶
func (*Metronome) CreateAccount ¶
func (*Metronome) GetAccountId ¶
func (*Metronome) GetInvoiceById ¶
func (*Metronome) GetInvoices ¶
func (m *Metronome) GetInvoices(ctx context.Context, accountId AccountId, r *api.ListInvoicesRequest) (*api.ListInvoicesResponse, error)
func (*Metronome) GetUsage ¶
func (m *Metronome) GetUsage(ctx context.Context, id AccountId, r *UsageRequest) (*api.GetUsageResponse, error)
func (*Metronome) PushStorageEvents ¶
func (m *Metronome) PushStorageEvents(ctx context.Context, events []*StorageEvent) error
func (*Metronome) PushUsageEvents ¶
func (m *Metronome) PushUsageEvents(ctx context.Context, events []*UsageEvent) error
type MetronomeError ¶
func NewMetronomeError ¶
func NewMetronomeError(code int, message []byte) *MetronomeError
func (*MetronomeError) Error ¶
func (e *MetronomeError) Error() string
type Provider ¶
type Provider interface { CreateAccount(ctx context.Context, namespaceId string, name string) (AccountId, error) AddDefaultPlan(ctx context.Context, accountId AccountId) (bool, error) AddPlan(ctx context.Context, accountId AccountId, planId uuid.UUID) (bool, error) PushUsageEvents(ctx context.Context, events []*UsageEvent) error PushStorageEvents(ctx context.Context, events []*StorageEvent) error GetInvoices(ctx context.Context, accountId AccountId, r *api.ListInvoicesRequest) (*api.ListInvoicesResponse, error) GetInvoiceById(ctx context.Context, accountId AccountId, invoiceId string) (*api.ListInvoicesResponse, error) GetUsage(ctx context.Context, id AccountId, r *UsageRequest) (*api.GetUsageResponse, error) GetAccountId(ctx context.Context, namespaceId string) (AccountId, error) }
func NewProvider ¶
func NewProvider() Provider
type StorageEvent ¶
type StorageEventBuilder ¶
type StorageEventBuilder struct {
// contains filtered or unexported fields
}
func NewStorageEventBuilder ¶
func NewStorageEventBuilder() *StorageEventBuilder
func (*StorageEventBuilder) Build ¶
func (sb *StorageEventBuilder) Build() *StorageEvent
func (*StorageEventBuilder) WithDatabaseBytes ¶
func (sb *StorageEventBuilder) WithDatabaseBytes(value int64) *StorageEventBuilder
func (*StorageEventBuilder) WithIndexBytes ¶
func (sb *StorageEventBuilder) WithIndexBytes(value int64) *StorageEventBuilder
func (*StorageEventBuilder) WithNamespaceId ¶
func (sb *StorageEventBuilder) WithNamespaceId(id string) *StorageEventBuilder
func (*StorageEventBuilder) WithTimestamp ¶
func (sb *StorageEventBuilder) WithTimestamp(ts time.Time) *StorageEventBuilder
func (*StorageEventBuilder) WithTransactionId ¶
func (sb *StorageEventBuilder) WithTransactionId(id string) *StorageEventBuilder
type UsageEvent ¶
type UsageEventBuilder ¶
type UsageEventBuilder struct {
// contains filtered or unexported fields
}
func NewUsageEventBuilder ¶
func NewUsageEventBuilder() *UsageEventBuilder
func (*UsageEventBuilder) Build ¶
func (ub *UsageEventBuilder) Build() *UsageEvent
func (*UsageEventBuilder) WithDatabaseUnits ¶
func (ub *UsageEventBuilder) WithDatabaseUnits(value int64) *UsageEventBuilder
func (*UsageEventBuilder) WithNamespaceId ¶
func (ub *UsageEventBuilder) WithNamespaceId(id string) *UsageEventBuilder
func (*UsageEventBuilder) WithSearchUnits ¶
func (ub *UsageEventBuilder) WithSearchUnits(value int64) *UsageEventBuilder
func (*UsageEventBuilder) WithTimestamp ¶
func (ub *UsageEventBuilder) WithTimestamp(ts time.Time) *UsageEventBuilder
func (*UsageEventBuilder) WithTransactionId ¶
func (ub *UsageEventBuilder) WithTransactionId(id string) *UsageEventBuilder
type UsageReporter ¶
type UsageReporter struct {
// contains filtered or unexported fields
}
func NewUsageReporter ¶
func NewUsageReporter( gs metrics.UsageProvider, tm metadata.NamespaceMetadataMgr, tg metadata.TenantGetter, billing Provider, txMgr *transaction.Manager, ) (*UsageReporter, error)
func (*UsageReporter) Start ¶
func (r *UsageReporter) Start()
type UsageRequest ¶
type WindowSize ¶
type WindowSize int
const ( Hour WindowSize = iota Day )
func (WindowSize) String ¶
func (w WindowSize) String() string
Click to show internal directories.
Click to hide internal directories.