usage

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveUsersSummaryRow added in v0.8.0

type ActiveUsersSummaryRow struct {
	UserID string    `bigquery:"user_id" json:"userId"`
	Email  string    `bigquery:"email" json:"email"`
	From   time.Time `bigquery:"interval_start_date" json:"from"`
	To     time.Time `bigquery:"interval_end_date" json:"to"`

	DeliveryUsageMins float64 `bigquery:"delivery_usage_mins" json:"deliveryUsageMins"`
	TotalUsageMins    float64 `bigquery:"transcode_total_usage_mins" json:"totalUsageMins"`
	StorageUsageMins  float64 `bigquery:"storage_usage_mins" json:"storageUsageMins"`
}

type BigQuery

type BigQuery interface {
	QueryUsageSummary(ctx context.Context, userID string, creatorID string, spec QuerySpec) (*UsageSummaryRow, error)
	QueryUsageSummaryWithTimestep(ctx context.Context, userID string, creatorID string, spec QuerySpec) (*[]UsageSummaryRow, error)
	QueryTotalUsageSummary(ctx context.Context, spec FromToQuerySpec) (*[]TotalUsageSummaryRow, error)
	QueryActiveUsersUsageSummary(ctx context.Context, spec FromToQuerySpec) (*[]ActiveUsersSummaryRow, error)
}

func NewBigQuery

func NewBigQuery(opts BigQueryOptions) (BigQuery, error)

type BigQueryOptions

type BigQueryOptions struct {
	BigQueryCredentialsJSON   string
	HourlyUsageTable          string
	DailyUsageTable           string
	UsersTable                string
	MaxBytesBilledPerBigQuery int64
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ClientOptions) (*Client, error)

func (*Client) QueryActiveUsageSummary added in v0.8.0

func (c *Client) QueryActiveUsageSummary(ctx context.Context, spec FromToQuerySpec) (*[]ActiveUsersSummaryRow, error)

func (*Client) QuerySummary

func (c *Client) QuerySummary(ctx context.Context, userID string, creatorID string, spec QuerySpec) (*UsageSummaryRow, error)

func (*Client) QuerySummaryWithTimestep

func (c *Client) QuerySummaryWithTimestep(ctx context.Context, userID string, creatorID string, spec QuerySpec) (*[]UsageSummaryRow, error)

func (*Client) QueryTotalSummary added in v0.8.0

func (c *Client) QueryTotalSummary(ctx context.Context, spec FromToQuerySpec) (*[]TotalUsageSummaryRow, error)

type ClientOptions

type ClientOptions struct {
	Livepeer livepeer.ClientOptions
	BigQueryOptions
}

type FromToQuerySpec added in v0.8.0

type FromToQuerySpec struct {
	From, To *time.Time
}

type QueryFilter

type QueryFilter struct {
	CreatorID string
	UserID    string
}

type QuerySpec

type QuerySpec struct {
	TimeStep string
	From, To *time.Time
	Filter   QueryFilter
}

type TotalUsageSummaryRow added in v0.8.0

type TotalUsageSummaryRow struct {
	DateTs                time.Time `bigquery:"date_ts" json:"dateTs"`
	DateS                 int64     `bigquery:"date_s" json:"dateS"`
	WeekTs                time.Time `bigquery:"week_ts" json:"weekTs"`
	WeekS                 int64     `bigquery:"week_s" json:"weekS"`
	VolumeEth             float64   `bigquery:"volume_eth" json:"volumeEth"`
	VolumeUsd             float64   `bigquery:"volume_usd" json:"volumeUsd"`
	FeeDerivedMinutes     float64   `bigquery:"fee_derived_minutes" json:"feeDerivedMinutes"`
	ParticipationRate     float64   `bigquery:"participation_rate" json:"participationRate"`
	Inflation             float64   `bigquery:"inflation" json:"inflation"`
	ActiveTranscoderCount int64     `bigquery:"active_transcoder_count" json:"activeTranscoderCount"`
	DelegatorsCount       int64     `bigquery:"delegators_count" json:"delegatorsCount"`
	AveragePricePerPixel  float64   `bigquery:"average_price_per_pixel" json:"averagePricePerPixel"`
	AveragePixelPerMinute float64   `bigquery:"average_pixel_per_minute" json:"averagePixelPerMinute"`
}

type UsageSummaryRow

type UsageSummaryRow struct {
	UserID    string `bigquery:"user_id"`
	CreatorID string `bigquery:"creator_id"`

	DeliveryUsageMins float64 `bigquery:"delivery_usage_mins"`
	TotalUsageMins    float64 `bigquery:"transcode_total_usage_mins"`
	StorageUsageMins  float64 `bigquery:"storage_usage_mins"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL