Documentation ¶
Index ¶
- Constants
- func FmtPartitionSpec(partitionColumns []hive.Column, partSpec hive.PartitionSpec) string
- func IsInvalidDependencyError(err error) bool
- func IsUninitializedDependencyError(err error) bool
- func NewReportGenerator(logger log.FieldLogger, reportResultsRepo prestostore.ReportResultsRepo) *reportGenerator
- func PrestoTimestamp(input interface{}) (string, error)
- func PrometheusMetricPartitionFormat(input interface{}) (string, error)
- func RenderQuery(ctx *ReportQueryTemplateContext, tmplCtx TemplateContext) (string, error)
- func TimestampFormat(input interface{}, format string) (string, error)
- func ValidateQueryDependencies(deps *ReportQueryDependencies, handler *UninitialiedDependendenciesHandler) error
- type DependencyResolutionResult
- type DependencyResolver
- type HiveDatabaseManager
- type HiveManager
- func (m *HiveManager) AddPartition(dbName, tableName string, partitionColumns []hive.Column, ...) error
- func (m *HiveManager) CreateDatabase(params hive.DatabaseParameters) error
- func (m *HiveManager) CreateTable(params hive.TableParameters, ignoreExists bool) error
- func (m *HiveManager) DropDatabase(dbName string, ignoreNotExists, cascade bool) error
- func (m *HiveManager) DropPartition(dbName, tableName string, partitionColumns []hive.Column, ...) error
- func (m *HiveManager) DropTable(dbName, tableName string, ignoreNotExists bool) error
- type HivePartitionManager
- type HiveTableManager
- type PrestoHealthChecker
- type PrestoTableManager
- type PrestoTableManagerImpl
- func (c *PrestoTableManagerImpl) CreateTable(catalog, schema, tableName string, columns []presto.Column, comment string, ...) error
- func (c *PrestoTableManagerImpl) CreateTableAs(catalog, schema, tableName string, columns []presto.Column, comment string, ...) error
- func (c *PrestoTableManagerImpl) CreateView(catalog, schema, viewName, query string) error
- func (c *PrestoTableManagerImpl) DropTable(catalog, schema, tableName string, ignoreNotExists bool) error
- func (c *PrestoTableManagerImpl) DropView(catalog, schema, viewName string, ignoreNotExists bool) error
- func (c *PrestoTableManagerImpl) QueryMetadata(catalog, schema, tableName string) ([]presto.Column, error)
- type ReportDataSourceGetter
- type ReportDataSourceGetterFunc
- type ReportGenerator
- type ReportGetter
- type ReportGetterFunc
- type ReportQueryDependencies
- type ReportQueryGetter
- type ReportQueryGetterFunc
- type ReportQueryTemplateContext
- type ReportTemplateInfo
- type TemplateContext
- type UninitialiedDependendenciesHandler
Constants ¶
const ( ReportingStartInputName = "ReportingStart" ReportingEndInputName = "ReportingEnd" )
Variables ¶
This section is empty.
Functions ¶
func FmtPartitionSpec ¶
func FmtPartitionSpec(partitionColumns []hive.Column, partSpec hive.PartitionSpec) string
func NewReportGenerator ¶
func NewReportGenerator(logger log.FieldLogger, reportResultsRepo prestostore.ReportResultsRepo) *reportGenerator
func PrestoTimestamp ¶
PrestoTimestamp is a helper function that returns the Presto timestamp format
func PrometheusMetricPartitionFormat ¶
PrometheusMetricPartitionFormat is a helper function that returns the Prometheus timestamp partition format
func RenderQuery ¶
func RenderQuery(ctx *ReportQueryTemplateContext, tmplCtx TemplateContext) (string, error)
RenderQuery creates a new query template by calling the ctx parameter's method, newQueryTemplate, and checks if the returned error is nil. If nil, return an empty string and the error, else return the function call to renderTemplate, passing in the new query template and tmplCtx parameter.
func TimestampFormat ¶
TimestampFormat checks the type of the input interface parameter and returns that parameter in the form specified by the format string parameter, or an error if it's not able to be converted.
func ValidateQueryDependencies ¶
func ValidateQueryDependencies(deps *ReportQueryDependencies, handler *UninitialiedDependendenciesHandler) error
Types ¶
type DependencyResolutionResult ¶
type DependencyResolutionResult struct { Dependencies *ReportQueryDependencies InputValues map[string]interface{} }
type DependencyResolver ¶
type DependencyResolver struct {
// contains filtered or unexported fields
}
func NewDependencyResolver ¶
func NewDependencyResolver( queryGetter ReportQueryGetter, dataSourceGetter ReportDataSourceGetter, reportGetter ReportGetter) *DependencyResolver
func (*DependencyResolver) ResolveDependencies ¶
func (resolver *DependencyResolver) ResolveDependencies(namespace string, inputDefs []metering.ReportQueryInputDefinition, inputVals []metering.ReportQueryInputValue) (*DependencyResolutionResult, error)
type HiveDatabaseManager ¶
type HiveManager ¶
type HiveManager struct {
// contains filtered or unexported fields
}
func NewHiveManager ¶
func NewHiveManager(execer db.Execer) *HiveManager
func (*HiveManager) AddPartition ¶
func (m *HiveManager) AddPartition(dbName, tableName string, partitionColumns []hive.Column, partition hive.TablePartition) error
func (*HiveManager) CreateDatabase ¶
func (m *HiveManager) CreateDatabase(params hive.DatabaseParameters) error
func (*HiveManager) CreateTable ¶
func (m *HiveManager) CreateTable(params hive.TableParameters, ignoreExists bool) error
func (*HiveManager) DropDatabase ¶
func (m *HiveManager) DropDatabase(dbName string, ignoreNotExists, cascade bool) error
func (*HiveManager) DropPartition ¶
func (m *HiveManager) DropPartition(dbName, tableName string, partitionColumns []hive.Column, partition hive.TablePartition) error
type HivePartitionManager ¶
type HiveTableManager ¶
type PrestoHealthChecker ¶
type PrestoHealthChecker struct {
// contains filtered or unexported fields
}
func NewPrestoHealthChecker ¶
func NewPrestoHealthChecker(logger logrus.FieldLogger, queryer db.Queryer, tableManager HiveTableManager, databaseName, tableName string) *PrestoHealthChecker
func (*PrestoHealthChecker) TestReadFromPresto ¶
func (checker *PrestoHealthChecker) TestReadFromPresto() bool
func (*PrestoHealthChecker) TestReadFromPrestoSingleFlight ¶
func (checker *PrestoHealthChecker) TestReadFromPrestoSingleFlight() bool
func (*PrestoHealthChecker) TestWriteToPresto ¶
func (checker *PrestoHealthChecker) TestWriteToPresto() bool
func (*PrestoHealthChecker) TestWriteToPrestoSingleFlight ¶
func (checker *PrestoHealthChecker) TestWriteToPrestoSingleFlight() bool
type PrestoTableManager ¶
type PrestoTableManager interface { CreateTable(catalog, schema, tableName string, columns []presto.Column, comment string, properties map[string]string, ignoreExists bool) error CreateTableAs(catalog, schema, tableName string, columns []presto.Column, comment string, properties map[string]string, ignoreExists bool, query string) error DropTable(catalog, schema, tableName string, ignoreNotExists bool) error QueryMetadata(catalog, schema, tableName string) ([]presto.Column, error) CreateView(catalog, schema, viewName, query string) error DropView(catalog, schema, viewName string, ignoreNotExists bool) error }
type PrestoTableManagerImpl ¶
type PrestoTableManagerImpl struct {
// contains filtered or unexported fields
}
func NewPrestoTableManager ¶
func NewPrestoTableManager(queryer db.Queryer) *PrestoTableManagerImpl
func (*PrestoTableManagerImpl) CreateTable ¶
func (*PrestoTableManagerImpl) CreateTableAs ¶
func (*PrestoTableManagerImpl) CreateView ¶
func (c *PrestoTableManagerImpl) CreateView(catalog, schema, viewName, query string) error
func (*PrestoTableManagerImpl) DropTable ¶
func (c *PrestoTableManagerImpl) DropTable(catalog, schema, tableName string, ignoreNotExists bool) error
func (*PrestoTableManagerImpl) DropView ¶
func (c *PrestoTableManagerImpl) DropView(catalog, schema, viewName string, ignoreNotExists bool) error
func (*PrestoTableManagerImpl) QueryMetadata ¶
func (c *PrestoTableManagerImpl) QueryMetadata(catalog, schema, tableName string) ([]presto.Column, error)
type ReportDataSourceGetter ¶
type ReportDataSourceGetter interface {
GetReportDataSource(namespace, name string) (*metering.ReportDataSource, error)
}
func NewReportDataSourceClientGetter ¶
func NewReportDataSourceClientGetter(getter meteringClient.ReportDataSourcesGetter) ReportDataSourceGetter
func NewReportDataSourceListerGetter ¶
func NewReportDataSourceListerGetter(lister meteringListers.ReportDataSourceLister) ReportDataSourceGetter
type ReportDataSourceGetterFunc ¶
type ReportDataSourceGetterFunc func(string, string) (*metering.ReportDataSource, error)
func (ReportDataSourceGetterFunc) GetReportDataSource ¶
func (f ReportDataSourceGetterFunc) GetReportDataSource(namespace, name string) (*metering.ReportDataSource, error)
type ReportGenerator ¶
type ReportGetter ¶
func NewReportClientGetter ¶
func NewReportClientGetter(getter meteringClient.ReportsGetter) ReportGetter
func NewReportListerGetter ¶
func NewReportListerGetter(lister meteringListers.ReportLister) ReportGetter
type ReportGetterFunc ¶
type ReportQueryDependencies ¶
type ReportQueryDependencies struct { ReportQueries []*metering.ReportQuery ReportDataSources []*metering.ReportDataSource Reports []*metering.Report }
func GetAndValidateQueryDependencies ¶
func GetAndValidateQueryDependencies( queryGetter ReportQueryGetter, dataSourceGetter ReportDataSourceGetter, reportGetter ReportGetter, query *metering.ReportQuery, inputVals []metering.ReportQueryInputValue, handler *UninitialiedDependendenciesHandler, ) (*ReportQueryDependencies, error)
func GetQueryDependencies ¶
func GetQueryDependencies( queryGetter ReportQueryGetter, dataSourceGetter ReportDataSourceGetter, reportGetter ReportGetter, query *metering.ReportQuery, inputVals []metering.ReportQueryInputValue, ) (*ReportQueryDependencies, error)
type ReportQueryGetter ¶
type ReportQueryGetter interface {
GetReportQuery(namespace, name string) (*metering.ReportQuery, error)
}
func NewReportQueryClientGetter ¶
func NewReportQueryClientGetter(getter meteringClient.ReportQueriesGetter) ReportQueryGetter
func NewReportQueryListerGetter ¶
func NewReportQueryListerGetter(lister meteringListers.ReportQueryLister) ReportQueryGetter
type ReportQueryGetterFunc ¶
type ReportQueryGetterFunc func(string, string) (*metering.ReportQuery, error)
func (ReportQueryGetterFunc) GetReportQuery ¶
func (f ReportQueryGetterFunc) GetReportQuery(namespace, name string) (*metering.ReportQuery, error)
type ReportQueryTemplateContext ¶
type ReportQueryTemplateContext struct { Namespace string Query string RequiredInputs []string Reports []*metering.Report ReportQueries []*metering.ReportQuery ReportDataSources []*metering.ReportDataSource PrestoTables []*metering.PrestoTable }
ReportQueryTemplateContext is used to hold all information about a ReportQuery that will be needed when rendering the templating inside of a ReportQuery's query field.
type ReportTemplateInfo ¶
type ReportTemplateInfo struct { ReportingStart *time.Time ReportingEnd *time.Time Inputs map[string]interface{} }
ReportTemplateInfo contains the variables for the Reprot being executed with this template.
type TemplateContext ¶
type TemplateContext struct {
Report ReportTemplateInfo
}
TemplateContext is the context passed to each template and contains variables related to the Report and ReportQuery such as inputs and dependencies on other resources.
type UninitialiedDependendenciesHandler ¶
type UninitialiedDependendenciesHandler struct {
HandleUninitializedReportDataSource func(*metering.ReportDataSource)
}