stat

package
v1.38.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectDistinctSourceSeries added in v1.33.0

func CollectDistinctSourceSeries(seriesList ...[]*pb.SourceSeries) []*pb.SourceSeries

CollectDistinctSourceSeries merges lists of SourceSeries. For same source series, the one with more data points is used. In most cases, this is the series with the latest data as well.

func FilterAndRank

func FilterAndRank(in *model.ObsTimeSeries, prop *model.StatObsProp)

FilterAndRank filters and ranks ObsTimeSeries in place.

func FilterSeries added in v1.34.0

func FilterSeries(in []*model.SourceSeries, prop *model.StatObsProp) []*model.SourceSeries

FilterSeries filters a list of source series given the observation properties.

func GetBestSeries

func GetBestSeries(
	in *pb.ObsTimeSeries,
	importName string,
	useLatest bool,
) (*pb.Series, *string)

GetBestSeries gets the best series for a collection of series with different metadata.

  • If "importName" is set, pick the series with the import name.
  • If "useLatest" is true, pick the series with latest date and set the second return value to be the latest date.

Note "importName" is preferred over "useLatest".

func GetMetadata added in v1.35.0

func GetMetadata(s *pb.SourceSeries) *pb.StatMetadata

GetMetadata derives the stat metadata from a source series.

func GetStatAll

func GetStatAll(ctx context.Context, in *pb.GetStatAllRequest, store *store.Store) (
	*pb.GetStatAllResponse, error)

GetStatAll implements API for Mixer.GetStatAll.

func GetStatDateWithinPlace added in v1.34.0

func GetStatDateWithinPlace(
	ctx context.Context, in *pb.GetStatDateWithinPlaceRequest, store *store.Store) (
	*pb.GetStatDateWithinPlaceResponse, error)

GetStatDateWithinPlace implements API for Mixer.GetStatDateWithinPlace.

func GetStatSeries

func GetStatSeries(
	ctx context.Context, in *pb.GetStatSeriesRequest, store *store.Store) (
	*pb.GetStatSeriesResponse, error)

GetStatSeries implements API for Mixer.GetStatSeries. TODO(shifucun): consilidate and dedup the logic among these similar APIs.

func GetStatSetSeries

func GetStatSetSeries(ctx context.Context, in *pb.GetStatSetSeriesRequest, store *store.Store) (
	*pb.GetStatSetSeriesResponse, error)

GetStatSetSeries implements API for Mixer.GetStatSetSeries.

func GetStatSetSeriesWithinPlace

func GetStatSetSeriesWithinPlace(
	ctx context.Context, in *pb.GetStatSetSeriesWithinPlaceRequest, store *store.Store) (
	*pb.GetStatSetSeriesResponse, error,
)

GetStatSetSeriesWithinPlace implements API for Mixer.GetStatSetSeriesWithinPlace.

func GetStats

func GetStats(ctx context.Context, in *pb.GetStatsRequest, store *store.Store) (
	*pb.GetStatsResponse, error)

GetStats implements API for Mixer.GetStats.

func GetValueFromBestSource added in v1.34.0

func GetValueFromBestSource(in *model.ObsTimeSeries, date string) (float64, error)

GetValueFromBestSource get the stat value from top ranked source series.

When date is given, it get the value from the highest ranked source series that has the date.

When date is not given, it get the latest value from the highest ranked source series.

func GetValueFromBestSourcePb added in v1.34.0

func GetValueFromBestSourcePb(
	in *pb.ObsTimeSeries, date string) (*pb.PointStat, *pb.StatMetadata)

GetValueFromBestSourcePb get the stat value from ObsTimeSeries (protobuf version)

When date is given, it get the value from the highest ranked source series that has the date.

When date is not given, it get the latest value from all the source series. If two sources has the same latest date, the highest ranked source is preferred.

func IsInferiorFacet added in v1.35.0

func IsInferiorFacet(ss *model.SourceSeries) bool

IsInferiorFacet checks if a facet is from an inferior source. This works for the Go version of "SourceSeries"

func IsInferiorFacetMetadata added in v1.35.0

func IsInferiorFacetMetadata(m *pb.StatMetadata) bool

IsInferiorFacetMetadata checks if a facet is from an inferior source. This works for StatMetadata

func IsInferiorFacetPb added in v1.35.0

func IsInferiorFacetPb(ss *pb.SourceSeries) bool

IsInferiorFacetPb checks if a facet is from an inferior source. This works for the proto version of "SourceSeries"

func ReadStatCollection added in v1.33.0

func ReadStatCollection(
	ctx context.Context,
	btGroup *bigtable.Group,
	prefix string,
	ancestorPlace string,
	childPlaceType string,
	statVars []string,
	date string,
) (map[string]*pb.ObsCollection, error)

ReadStatCollection reads and process ObsCollection cache from BigTable in parallel.

func ReadStats added in v1.33.0

func ReadStats(
	ctx context.Context,
	btGroup *bigtable.Group,
	places []string,
	statVars []string,
) (map[string]map[string]*model.ObsTimeSeries, error)

ReadStats reads and process BigTable rows in parallel. Consider consolidate this function and bigTableReadRowsParallel.

func ReadStatsPb added in v1.33.0

func ReadStatsPb(
	ctx context.Context,
	btGroup *bigtable.Group,
	places []string,
	statVars []string,
) (map[string]map[string]*pb.ObsTimeSeries, error)

ReadStatsPb reads and process BigTable rows in parallel. Consider consolidate this function and bigTableReadRowsParallel.

func TokenFn added in v1.33.0

func TokenFn(keyTokens map[string]*util.PlaceStatVar) func(rowKey string) (string, error)

TokenFn generates a function that convert row key to token string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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