Back to godoc.org

Package eventlog

v0.0.0-...-bd98d2d
Latest Go to latest

The highest tagged major version is .

Published: Sep 19, 2020 | License: BSD-3-Clause | Module: chromium.googlesource.com/infra/infra.git

Index

Constants

const (
	// DatasetID is name of BQ dataset.
	DatasetID = "qs_events"
	// TableID is name of BQ table.
	TableID = "task_events"
)

func TaskEvents

func TaskEvents(ctx context.Context, events ...*metrics.TaskEvent) error

TaskEvents logs the given TaskEvents to a bigquery table asynchronously.

func Use

func Use(c context.Context, inserter AsyncBqInserter) context.Context

Use installs inserter into c.

type AsyncBqInserter

type AsyncBqInserter interface {
	Insert(ctx context.Context, rows ...bigquery.ValueSaver) error
}

AsyncBqInserter defines what eventlog package expects from BQ inserting library.

type NullBQInserter

type NullBQInserter struct {
}

NullBQInserter implements AsyncBqInserter and just logs "inserted" events.

func (*NullBQInserter) Insert

func (n *NullBQInserter) Insert(ctx context.Context, rows ...bigquery.ValueSaver) error

Insert implements AsyncBqInserter interface.

type RAMBufferedBQInserter

type RAMBufferedBQInserter struct {
	ProjectID string
	DatasetID string
	TableID   string
	// contains filtered or unexported fields
}

RAMBufferedBQInserter implements AsyncBqInserter via in-RAM buffering of events for later sending to BQ.

func NewRAMBufferedBQInserter

func NewRAMBufferedBQInserter(ctx context.Context, projectID, datasetID, tableID string) (r *RAMBufferedBQInserter, err error)

NewRAMBufferedBQInserter instantiates new RAMBufferedBQInserter.

func (*RAMBufferedBQInserter) CloseAndDrain

func (r *RAMBufferedBQInserter) CloseAndDrain(ctx context.Context)

CloseAndDrain stops accepting new rows and waits until all buffered rows are sent or provided `ctx` times out.

func (*RAMBufferedBQInserter) Insert

func (r *RAMBufferedBQInserter) Insert(ctx context.Context, rows ...bigquery.ValueSaver) error

Insert implements AsyncBqInserter interface.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier