auditlog

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitWithClient

func InitWithClient(c *logadmin.Client) func(*AuditLog)

func InitWithConfig

func InitWithConfig(cfg Config) func(*AuditLog)

Types

type AuditLog

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

func New

func New(logger log.Logger) *AuditLog

func (*AuditLog) Collect

func (l *AuditLog) Collect(ctx context.Context, tableID string) (tableStats *TableStats, err error)

func (*AuditLog) Init

func (l *AuditLog) Init(ctx context.Context, opts ...InitOption) (err error)

type Config

type Config struct {
	ProjectID           string
	ServiceAccountJSON  string
	IsCollectTableUsage bool
	UsagePeriodInDay    int64
	UsageProjectIDs     []string
}

type InitOption

type InitOption func(*AuditLog)

type JoinDetail

type JoinDetail struct {
	Usage      int64
	Conditions map[string]bool
}

type LogData

type LogData struct {
	*loggingpb.AuditData
}

func (*LogData) GetQuery

func (ld *LogData) GetQuery() (sqlQuery string, err error)

func (*LogData) GetReferencedTablesURN

func (ld *LogData) GetReferencedTablesURN() (refTablesURN []string)

type TableStats

type TableStats struct {
	TableUsage       map[string]int64
	JoinDetail       map[string]map[string]JoinDetail
	FilterConditions map[string]map[string]bool
	// contains filtered or unexported fields
}

func NewTableStats

func NewTableStats() *TableStats

func (*TableStats) Populate

func (b *TableStats) Populate(ld *LogData) (err error)

Jump to

Keyboard shortcuts

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