localtrace

package
v0.0.0-...-90deddd Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Pid  int                    `json:"pid"`
	Tid  int                    `json:"tid"`
	Ts   int64                  `json:"ts"`
	Ph   string                 `json:"ph"`
	Dur  int64                  `json:"dur,omitempty"`
	Name string                 `json:"name"`
	Cat  string                 `json:"cat,omitempty"`
	Args map[string]interface{} `json:"args"`
}

Event is an event in the Chrome tracing format. The fields are mirrored exactly from: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview Copied from: github.com/grailbio/bigslice/internal/trace/trace.go

type LocalTracer

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

func New

func New(path string) (*LocalTracer, error)

New returns a new LocalTracer instance. This function is intended for cases where Reflow is used as a library and the user would like to specify the path of the output trace file.

func (*LocalTracer) CopyTraceContext

func (lt *LocalTracer) CopyTraceContext(src context.Context, dst context.Context) context.Context

CopyTraceContext copies the trace context from src to dst and implements the trace.Tracer interface. Do not use directly, instead use trace.CopyTraceContext.

func (*LocalTracer) Emit

func (lt *LocalTracer) Emit(ctx context.Context, e trace.Event) (context.Context, error)

Emit emits a trace event and implements the trace.Tracer interface. This should never be used directly, instead use trace.Start and trace.Note.

func (*LocalTracer) Flush

func (lt *LocalTracer) Flush()

Flush writes the completed trace events to a file at lt.tracefilepath and can be called concurrently.

func (*LocalTracer) Help

func (lt *LocalTracer) Help() string

Help implements infra.Provider

func (*LocalTracer) Init

func (lt *LocalTracer) Init(runID *taskdb.RunID) error

Init implements infra.Provider and gets called when an instance of LocalTracer is created with infra.Config.Instance(...)

func (*LocalTracer) ReadHTTPContext

func (lt *LocalTracer) ReadHTTPContext(ctx context.Context, header http.Header) context.Context

ReadHTTPContext is not implemented for LocalTracer, this stub implements the trace.Tracer interface.

func (*LocalTracer) URL

func (lt *LocalTracer) URL(_ context.Context) string

URL returns the location of the output trace file and implements the trace.Tracer interface. Do not use directly, instead use trace.URL.

func (*LocalTracer) WriteHTTPContext

func (lt *LocalTracer) WriteHTTPContext(ctx context.Context, header *http.Header)

WriteHTTPContext is not implemented for LocalTracer, this stub implements the trace.Tracer interface.

type T

type T struct {
	Events []Event `json:"traceEvents"`
}

T represents the JSON object format in the Chrome tracing format. For more details, see: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview Copied from: github.com/grailbio/bigslice/internal/trace/trace.go

func (*T) Decode

func (t *T) Decode(r io.Reader) error

Decode decodes the JSON object format read from r into t. Call this with a t zero value.

func (*T) Encode

func (t *T) Encode(w io.Writer) error

Encode JSON encodes t into outfile.

Jump to

Keyboard shortcuts

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