eventlog

package
v0.0.0-...-678bb0e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package eventlog provides a client which can be used to to collect and send batches of ChromeInfraEvent logs to the eventlog service.

Index

Constants

View Source
const ProdEndpoint = "https://play.googleapis.com/log"

ProdEndpoint is the server address for production logs.

View Source
const TestEndpoint = "https://jmt17.google.com/log"

TestEndpoint is the server address for test logs.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChromeInfraLogEvent

type ChromeInfraLogEvent struct {
	// LogEvent is the event to be sent to the server. The LogEvent's SourceExtension
	// field will be overwritten with the serialized contents of InfraEvent
	// when the log event is sent to the server.
	LogEvent   *logpb.LogRequestLite_LogEventLite
	InfraEvent *logpb.ChromeInfraEvent
}

ChromeInfraLogEvent stores a pending LogEvent, and the proto used to populate its SourceExtension field.

type Client

type Client struct {

	// EventSource identifies the log producer. It may be configured before sending logs.
	EventSource *logpb.InfraEventSource
	// contains filtered or unexported fields
}

Client may be used to send ChromeInfraEvent logs to the eventlog service.

func NewClient

func NewClient(ctx context.Context, serverAddr string, opts ...ClientOption) *Client

NewClient constructs a Client which can be used to send ChromeInfraEvent logs to the eventlog service. Users must call Close when the Client is no longer needed. ctx is the context to use for batch log uploads.

func (*Client) Close

func (c *Client) Close()

Close flushes any pending logs and releases any resources held by the client. Close should be called when the client is no longer needed.

func (*Client) Log

func (c *Client) Log(events ...*ChromeInfraLogEvent) error

Log stages events to be logged to the eventlog service. Use NewLogEvent to assist with constructing a well-formed log event. Log returns immediately, and batches of events will be sent to the eventlog server periodically. Log takes ownership of events.

func (*Client) LogSync

func (c *Client) LogSync(ctx context.Context, events ...*ChromeInfraLogEvent) error

LogSync synchronously logs events to the eventlog service. Use NewLogEvent to assist with constructing a well-formed log event. LogSync takes ownership of events.

func (*Client) NewLogEvent

func (c *Client) NewLogEvent(ctx context.Context, eventTime TypedTime) *ChromeInfraLogEvent

NewLogEvent constructs a well-formed log event. eventTime is the time that the event occurred, typically obtained by calling one of Point, Begin or End.

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

A ClientOption is an optional argument to NewClient.

func WithHTTPClient

func WithHTTPClient(client *http.Client) ClientOption

WithHTTPClient returns a ClientOption that specifies the HTTP client to use as the basis of communications.

type TypedTime

type TypedTime struct {
	// The time at which an event occurred. Must have been obtained from Time.Now.
	Time time.Time
	Kind logpb.ChromeInfraEvent_TimestampKind
}

TypedTime is a time, accompanied by an indication of what the time represents.

func Begin

func Begin() TypedTime

Begin returns the current time for use when logging the beginning of an event.

func End

func End() TypedTime

End returns the current time for use when logging the end of an event.

func Point

func Point() TypedTime

Point returns the current time for use when logging an event with no temporal extent.

Directories

Path Synopsis
internal
logservice
Package logservice provides loggers which can be used to to collect and send batches of logs to the eventlog service.
Package logservice provides loggers which can be used to to collect and send batches of logs to the eventlog service.
Package eventlog is a generated protocol buffer package.
Package eventlog is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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