views

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAssetNotFound = errors.New("asset not found")

Functions

func ToDStorageURL added in v0.7.0

func ToDStorageURL(playbackID string) string

Types

type BigQuery added in v0.7.0

type BigQuery interface {
	QueryViewsEvents(ctx context.Context, spec QuerySpec) ([]ViewershipEventRow, error)
	QueryViewsSummary(ctx context.Context, playbackID string) (*ViewSummaryRow, error)
}

func NewBigQuery added in v0.7.0

func NewBigQuery(opts BigQueryOptions) (BigQuery, error)

type BigQueryOptions added in v0.7.0

type BigQueryOptions struct {
	BigQueryCredentialsJSON   string
	ViewershipEventsTable     string
	ViewershipSummaryTable    string
	MaxBytesBilledPerBigQuery int64
}

type Client

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

func NewClient

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

func (*Client) Deprecated_GetTotalViews added in v0.7.0

func (c *Client) Deprecated_GetTotalViews(ctx context.Context, id string) ([]TotalViews, error)

func (*Client) QueryEvents added in v0.7.2

func (c *Client) QueryEvents(ctx context.Context, spec QuerySpec, assetID, streamID string) ([]Metric, error)

func (*Client) QuerySummary added in v0.7.2

func (c *Client) QuerySummary(ctx context.Context, playbackID string) (*Metric, error)

type ClientOptions

type ClientOptions struct {
	Prometheus promClient.Config
	Livepeer   livepeer.ClientOptions

	BigQueryOptions
}

type Metric added in v0.7.0

type Metric struct {
	PlaybackID  string `json:"playbackId,omitempty"`
	DStorageURL string `json:"dStorageUrl,omitempty"`
	Timestamp   *int64 `json:"timestamp,omitempty"`

	Device     *string `json:"device,omitempty"`
	DeviceType *string `json:"deviceType,omitempty"`
	CPU        *string `json:"cpu,omitempty"`

	OS            *string `json:"os,omitempty"`
	Browser       *string `json:"browser,omitempty"`
	BrowserEngine *string `json:"browserEngine,omitempty"`

	Continent   *string `json:"continent,omitempty"`
	Country     *string `json:"country,omitempty"`
	Subdivision *string `json:"subdivision,omitempty"`
	TimeZone    *string `json:"timezone,omitempty"`

	ViewCount         int64    `json:"viewCount"`
	PlaytimeMins      float64  `json:"playtimeMins"`
	TtffMs            *float64 `json:"ttffMs,omitempty"`
	RebufferRatio     *float64 `json:"rebufferRatio,omitempty"`
	ErrorRate         *float64 `json:"errorRate,omitempty"`
	ExistsBeforeStart *float64 `json:"existsBeforeStart,omitempty"`
	// Present only on the summary queries. These were imported from the
	// prometheus data we had on the first version of this API and are not
	// shown in the detailed metrics queries (non-/total).
	LegacyViewCount *int64 `json:"legacyViewCount,omitempty"`
}

type Prometheus added in v0.7.0

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

func NewPrometheus added in v0.7.0

func NewPrometheus(config promClient.Config) (*Prometheus, error)

func (*Prometheus) QueryStartViews added in v0.7.0

func (c *Prometheus) QueryStartViews(ctx context.Context, asset *livepeer.Asset) (int64, error)

type QueryFilter added in v0.7.0

type QueryFilter struct {
	PlaybackID string
	CreatorID  string
	UserID     string
}

type QuerySpec added in v0.7.0

type QuerySpec struct {
	From, To    *time.Time
	TimeStep    string
	Filter      QueryFilter
	BreakdownBy []string
	Detailed    bool
}

type TotalViews

type TotalViews struct {
	ID         string `json:"id"`
	StartViews int64  `json:"startViews"`
}

type ViewSummaryRow added in v0.7.0

type ViewSummaryRow struct {
	PlaybackID  string `bigquery:"playback_id"`
	DStorageURL string `bigquery:"d_storage_url"`

	ViewCount       int64              `bigquery:"view_count"`
	LegacyViewCount bigquery.NullInt64 `bigquery:"legacy_view_count"`
	PlaytimeMins    float64            `bigquery:"playtime_mins"`
}

type ViewershipEventRow added in v0.7.0

type ViewershipEventRow struct {
	TimeInterval time.Time `bigquery:"time_interval"`
	PlaybackID   string    `bigquery:"playback_id"`
	DStorageURL  string    `bigquery:"d_storage_url"`

	DeviceType bigquery.NullString `bigquery:"device_type"`
	Device     bigquery.NullString `bigquery:"device"`
	CPU        bigquery.NullString `bigquery:"cpu"`

	OS            bigquery.NullString `bigquery:"os"`
	Browser       bigquery.NullString `bigquery:"browser"`
	BrowserEngine bigquery.NullString `bigquery:"browser_engine"`

	Continent   bigquery.NullString `bigquery:"playback_continent_name"`
	Country     bigquery.NullString `bigquery:"playback_country_name"`
	Subdivision bigquery.NullString `bigquery:"playback_subdivision_name"`
	TimeZone    bigquery.NullString `bigquery:"playback_timezone"`

	ViewCount         int64                `bigquery:"view_count"`
	PlaytimeMins      float64              `bigquery:"playtime_mins"`
	TtffMs            bigquery.NullFloat64 `bigquery:"ttff_ms"`
	RebufferRatio     bigquery.NullFloat64 `bigquery:"rebuffer_ratio"`
	ErrorRate         bigquery.NullFloat64 `bigquery:"error_rate"`
	ExistsBeforeStart bigquery.NullFloat64 `bigquery:"exits_before_start"`
}

Jump to

Keyboard shortcuts

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