logs

package
v0.0.0-...-e00d976 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: BSD-3-Clause Imports: 12 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// We use a single BigTable table for storing logs.
	BT_TABLE = "task-driver-logs"

	// We use a single BigTable column family.
	BT_COLUMN_FAMILY = "LOGS"

	// We use a single BigTable column which stores gob-encoded log entries.
	BT_COLUMN = "ENTRY"

	INSERT_TIMEOUT = 30 * time.Second
	QUERY_TIMEOUT  = 5 * time.Second
)

Variables

View Source
var (
	// Fully-qualified BigTable column name.
	BT_COLUMN_FULL = fmt.Sprintf("%s:%s", BT_COLUMN_FAMILY, BT_COLUMN)
)

Functions

This section is empty.

Types

type Entry

type Entry struct {
	InsertID         string            `json:"insertId"`
	Labels           map[string]string `json:"labels"`
	LogName          string            `json:"logName"`
	ReceiveTimestamp time.Time         `json:"receiveTimestamp"`
	//Resource
	Severity    string      `json:"severity"`
	JsonPayload *td.Message `json:"jsonPayload"`
	TextPayload string      `json:"textPayload"`
	Timestamp   time.Time   `json:"timestamp"`
}

Entry mimics logging.Entry, which for some reason does not include the jsonPayload field, and is not parsable via json.Unmarshal due to the Severity type.

type LogsManager

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

LogsManager is a struct which provides an interface for inserting and retrieving Task Driver logs in Cloud BigTable.

func NewLogsManager

func NewLogsManager(ctx context.Context, project, instance string, ts oauth2.TokenSource) (*LogsManager, error)

NewLogsManager returns a LogsManager instance.

func (*LogsManager) Close

func (m *LogsManager) Close() error

Close the LogsManager.

func (*LogsManager) Insert

func (m *LogsManager) Insert(ctx context.Context, e *Entry) error

Insert the given log entry.

func (*LogsManager) Search

func (m *LogsManager) Search(ctx context.Context, taskId, stepId, logId string) ([]*Entry, error)

Search returns Entries matching the given search terms.

Jump to

Keyboard shortcuts

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