Documentation
¶
Index ¶
Constants ¶
const ( // MinimumWindowSizeDuration is the minimum window size the aggregation can represent. MinimumWindowSizeDuration = time.Second // MinimumWindowSize is the minimum window size the aggregation can represent. MinimumWindowSize = meter.WindowSizeSecond )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
type Connector interface {
namespace.Handler
CountEvents(ctx context.Context, namespace string, params CountEventsParams) ([]CountEventRow, error)
ListEvents(ctx context.Context, namespace string, params ListEventsParams) ([]RawEvent, error)
ListEventsV2(ctx context.Context, params ListEventsV2Params) ([]RawEvent, error)
QueryMeter(ctx context.Context, namespace string, meter meter.Meter, params QueryParams) ([]meter.MeterQueryRow, error)
ListMeterSubjects(ctx context.Context, namespace string, meter meter.Meter, params ListMeterSubjectsParams) ([]string, error)
BatchInsert(ctx context.Context, events []RawEvent) error
ValidateJSONPath(ctx context.Context, jsonPath string) (bool, error)
}
type CountEventRow ¶
CountEventRow represents a row in the count events response.
type CountEventsParams ¶
type Customer ¶
type Customer interface {
GetUsageAttribution() CustomerUsageAttribution
}
Customer is a customer that can be used in a meter query
type CustomerUsageAttribution ¶
CustomerUsageAttribution holds customer fields that map usage to a customer
type ListEventsParams ¶
type ListEventsParams struct {
// The namespace.
Namespace string
// The client ID.
ClientID *string
// Start date-time. Inclusive.
IngestedAtFrom *time.Time
// End date-time. Inclusive.
IngestedAtTo *time.Time
// The event ID. Accepts partial ID.
ID *string
// The event subject. Accepts partial subject.
Subject *string
// The event customer ID.
Customers *[]Customer
// Start date-time. Inclusive.
From time.Time
// End date-time. Inclusive.
To *time.Time
// Number of events to return.
Limit int
}
ListEventsParams represents the input for ListEvents method.
func (ListEventsParams) Validate ¶
func (i ListEventsParams) Validate() error
Validate validates the input.
type ListEventsV2Params ¶
type ListEventsV2Params struct {
// The namespace.
Namespace string
// The client ID.
ClientID *string
// The cursor.
Cursor *pagination.Cursor
// The limit.
Limit *int
// The ID filter.
ID *filter.FilterString
// The source filter.
Source *filter.FilterString
// The subject filter.
Subject *filter.FilterString
// The event customer ID.
Customers *[]Customer
// The type filter.
Type *filter.FilterString
// The time filter.
Time *filter.FilterTime
// The ingested at filter.
IngestedAt *filter.FilterTime
}
ListEventsV2Params is a parameter object for listing events.
func (ListEventsV2Params) Validate ¶
func (p ListEventsV2Params) Validate() error
Validate validates the list events parameters.
type ListMeterSubjectsParams ¶
ListMeterSubjectsParams is a parameter object for listing subjects.
func (ListMeterSubjectsParams) Validate ¶
func (p ListMeterSubjectsParams) Validate() error
Validate validates the list meters parameters.
type QueryParams ¶
type QueryParams struct {
ClientID *string
From *time.Time
To *time.Time
FilterCustomer []Customer
FilterSubject []string
FilterGroupBy map[string][]string
GroupBy []string
WindowSize *meter.WindowSize
WindowTimeZone *time.Location
}
func (*QueryParams) Validate ¶
func (p *QueryParams) Validate() error
Validate validates query params focusing on `from` and `to` being aligned with query and meter window sizes
type RawEvent ¶
type RawEvent struct {
Namespace string `ch:"namespace" json:"-"`
ID string `ch:"id" json:"id"`
Type string `ch:"type" json:"type"`
Source string `ch:"source" json:"source"`
Subject string `ch:"subject" json:"subject"`
Time time.Time `ch:"time" json:"time"`
Data string `ch:"data" json:"data"`
IngestedAt time.Time `ch:"ingested_at" json:"ingested_at,omitempty,omitzero"`
StoredAt time.Time `ch:"stored_at" json:"stored_at,omitempty,omitzero"`
StoreRowID string `ch:"store_row_id" json:"store_row_id,omitempty,omitzero"`
CustomerID *string `ch:"customer_id" json:"customer_id,omitempty,omitzero"`
}
RawEvent represents a single raw event