tracing

package
v0.157.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 5 Imported by: 5

Documentation

Overview

Package tracing provides the Chrome DevTools Protocol commands, types, and events for the Tracing domain.

Generated by the pdlgen command.

Index

Constants

View Source
const (
	CommandEnd                     = "Tracing.end"
	CommandGetCategories           = "Tracing.getCategories"
	CommandGetTrackEventDescriptor = "Tracing.getTrackEventDescriptor"
	CommandRecordClockSyncMarker   = "Tracing.recordClockSyncMarker"
	CommandRequestMemoryDump       = "Tracing.requestMemoryDump"
	CommandStart                   = "Tracing.start"
)

Command names.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend string

Backend backend type to use for tracing. chrome uses the Chrome-integrated tracing service and is supported on all platforms. system is only supported on Chrome OS and uses the Perfetto system tracing service. auto chooses system when the perfettoConfig provided to Tracing.start specifies at least one non-Chrome data source; otherwise uses chrome.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#type-TracingBackend

const (
	BackendAuto   Backend = "auto"
	BackendChrome Backend = "chrome"
	BackendSystem Backend = "system"
)

Backend values.

func (Backend) String

func (t Backend) String() string

String returns the Backend as string value.

type EndParams

type EndParams struct{}

EndParams stop trace events collection.

func End

func End() *EndParams

End stop trace events collection.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#method-end

func (*EndParams) Do

func (p *EndParams) Do(ctx context.Context) (err error)

Do executes Tracing.end against the provided context.

type EventBufferUsage

type EventBufferUsage struct {
	PercentFull float64 `json:"percentFull,omitempty,omitzero"` // A number in range [0..1] that indicates the used size of event buffer as a fraction of its total size.
	EventCount  float64 `json:"eventCount,omitempty,omitzero"`  // An approximate number of events in the trace log.
	Value       float64 `json:"value,omitempty,omitzero"`       // A number in range [0..1] that indicates the used size of event buffer as a fraction of its total size.
}

EventBufferUsage [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#event-bufferUsage

type EventDataCollected

type EventDataCollected struct {
	Value []jsontext.Value `json:"value"`
}

EventDataCollected contains a bucket of collected trace events. When tracing is stopped collected events will be sent as a sequence of dataCollected events followed by tracingComplete event.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#event-dataCollected

type EventTracingComplete

type EventTracingComplete struct {
	DataLossOccurred  bool              `json:"dataLossOccurred"`                     // Indicates whether some trace data is known to have been lost, e.g. because the trace ring buffer wrapped around.
	Stream            io.StreamHandle   `json:"stream,omitempty,omitzero"`            // A handle of the stream that holds resulting trace data.
	TraceFormat       StreamFormat      `json:"traceFormat,omitempty,omitzero"`       // Trace data format of returned stream.
	StreamCompression StreamCompression `json:"streamCompression,omitempty,omitzero"` // Compression format of returned stream.
}

EventTracingComplete signals that tracing is stopped and there is no trace buffers pending flush, all data were delivered via dataCollected events.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#event-tracingComplete

type GetCategoriesParams

type GetCategoriesParams struct{}

GetCategoriesParams gets supported tracing categories.

func GetCategories

func GetCategories() *GetCategoriesParams

GetCategories gets supported tracing categories.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#method-getCategories

func (*GetCategoriesParams) Do

func (p *GetCategoriesParams) Do(ctx context.Context) (categories []string, err error)

Do executes Tracing.getCategories against the provided context.

returns:

categories - A list of supported tracing categories.

type GetCategoriesReturns

type GetCategoriesReturns struct {
	Categories []string `json:"categories,omitempty,omitzero"` // A list of supported tracing categories.
}

GetCategoriesReturns return values.

type GetTrackEventDescriptorParams

type GetTrackEventDescriptorParams struct{}

GetTrackEventDescriptorParams return a descriptor for all available tracing categories.

func GetTrackEventDescriptor

func GetTrackEventDescriptor() *GetTrackEventDescriptorParams

GetTrackEventDescriptor return a descriptor for all available tracing categories.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#method-getTrackEventDescriptor

func (*GetTrackEventDescriptorParams) Do

func (p *GetTrackEventDescriptorParams) Do(ctx context.Context) (descriptor []byte, err error)

Do executes Tracing.getTrackEventDescriptor against the provided context.

returns:

descriptor - Base64-encoded serialized perfetto.protos.TrackEventDescriptor protobuf message.

type GetTrackEventDescriptorReturns

type GetTrackEventDescriptorReturns struct {
	Descriptor string `json:"descriptor,omitempty,omitzero"` // Base64-encoded serialized perfetto.protos.TrackEventDescriptor protobuf message.
}

GetTrackEventDescriptorReturns return values.

type MemoryDumpConfig

type MemoryDumpConfig struct{}

MemoryDumpConfig configuration for memory dump. Used only when "memory-infra" category is enabled.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#type-MemoryDumpConfig

type MemoryDumpLevelOfDetail

type MemoryDumpLevelOfDetail string

MemoryDumpLevelOfDetail details exposed when memory request explicitly declared. Keep consistent with memory_dump_request_args.h and memory_instrumentation.mojom.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#type-MemoryDumpLevelOfDetail

const (
	MemoryDumpLevelOfDetailBackground MemoryDumpLevelOfDetail = "background"
	MemoryDumpLevelOfDetailLight      MemoryDumpLevelOfDetail = "light"
	MemoryDumpLevelOfDetailDetailed   MemoryDumpLevelOfDetail = "detailed"
)

MemoryDumpLevelOfDetail values.

func (MemoryDumpLevelOfDetail) String

func (t MemoryDumpLevelOfDetail) String() string

String returns the MemoryDumpLevelOfDetail as string value.

type RecordClockSyncMarkerParams

type RecordClockSyncMarkerParams struct {
	SyncID string `json:"syncId"` // The ID of this clock sync marker
}

RecordClockSyncMarkerParams record a clock sync marker in the trace.

func RecordClockSyncMarker

func RecordClockSyncMarker(syncID string) *RecordClockSyncMarkerParams

RecordClockSyncMarker record a clock sync marker in the trace.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#method-recordClockSyncMarker

parameters:

syncID - The ID of this clock sync marker

func (*RecordClockSyncMarkerParams) Do

Do executes Tracing.recordClockSyncMarker against the provided context.

type RequestMemoryDumpParams

type RequestMemoryDumpParams struct {
	Deterministic bool                    `json:"deterministic"`                    // Enables more deterministic results by forcing garbage collection
	LevelOfDetail MemoryDumpLevelOfDetail `json:"levelOfDetail,omitempty,omitzero"` // Specifies level of details in memory dump. Defaults to "detailed".
}

RequestMemoryDumpParams request a global memory dump.

func RequestMemoryDump

func RequestMemoryDump() *RequestMemoryDumpParams

RequestMemoryDump request a global memory dump.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#method-requestMemoryDump

parameters:

func (*RequestMemoryDumpParams) Do

func (p *RequestMemoryDumpParams) Do(ctx context.Context) (dumpGUID string, success bool, err error)

Do executes Tracing.requestMemoryDump against the provided context.

returns:

dumpGUID - GUID of the resulting global memory dump.
success - True iff the global memory dump succeeded.

func (RequestMemoryDumpParams) WithDeterministic

func (p RequestMemoryDumpParams) WithDeterministic(deterministic bool) *RequestMemoryDumpParams

WithDeterministic enables more deterministic results by forcing garbage collection.

func (RequestMemoryDumpParams) WithLevelOfDetail

func (p RequestMemoryDumpParams) WithLevelOfDetail(levelOfDetail MemoryDumpLevelOfDetail) *RequestMemoryDumpParams

WithLevelOfDetail specifies level of details in memory dump. Defaults to "detailed".

type RequestMemoryDumpReturns

type RequestMemoryDumpReturns struct {
	DumpGUID string `json:"dumpGuid,omitempty,omitzero"` // GUID of the resulting global memory dump.
	Success  bool   `json:"success"`                     // True iff the global memory dump succeeded.
}

RequestMemoryDumpReturns return values.

type StartParams

type StartParams struct {
	BufferUsageReportingInterval float64           `json:"bufferUsageReportingInterval,omitempty,omitzero"` // If set, the agent will issue bufferUsage events at this interval, specified in milliseconds
	TransferMode                 StartTransferMode `json:"transferMode,omitempty,omitzero"`                 // Whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to ReportEvents).
	StreamFormat                 StreamFormat      `json:"streamFormat,omitempty,omitzero"`                 // Trace data format to use. This only applies when using ReturnAsStream transfer mode (defaults to json).
	StreamCompression            StreamCompression `json:"streamCompression,omitempty,omitzero"`            // Compression format to use. This only applies when using ReturnAsStream transfer mode (defaults to none)
	TraceConfig                  *TraceConfig      `json:"traceConfig,omitempty,omitzero"`
	PerfettoConfig               string            `json:"perfettoConfig,omitempty,omitzero"`     // Base64-encoded serialized perfetto.protos.TraceConfig protobuf message When specified, the parameters categories, options, traceConfig are ignored.
	TracingBackend               Backend           `json:"tracingBackend,omitempty,omitzero"`     // Backend type (defaults to auto)
	ScreenshotMaxSize            int64             `json:"screenshotMaxSize,omitempty,omitzero"`  // Maximum width and height (in pixels) of each captured screenshot. Only used when the disabled-by-default-devtools.screenshot category is enabled. Defaults to 500. The combined memory footprint of screenshots (screenshotMaxSize * screenshotMaxSize * 4 * screenshotMaxCount) is clamped to the existing per-session budget.
	ScreenshotMaxCount           int64             `json:"screenshotMaxCount,omitempty,omitzero"` // Maximum number of screenshots captured during a single tracing session. Only used when the disabled-by-default-devtools.screenshot category is enabled. Defaults to 450. Clamped together with screenshotMaxSize to stay within the per-session screenshot memory budget.
}

StartParams start trace events collection.

func Start

func Start() *StartParams

Start start trace events collection.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#method-start

parameters:

func (*StartParams) Do

func (p *StartParams) Do(ctx context.Context) (err error)

Do executes Tracing.start against the provided context.

func (StartParams) WithBufferUsageReportingInterval

func (p StartParams) WithBufferUsageReportingInterval(bufferUsageReportingInterval float64) *StartParams

WithBufferUsageReportingInterval if set, the agent will issue bufferUsage events at this interval, specified in milliseconds.

func (StartParams) WithPerfettoConfig

func (p StartParams) WithPerfettoConfig(perfettoConfig string) *StartParams

WithPerfettoConfig base64-encoded serialized perfetto.protos.TraceConfig protobuf message When specified, the parameters categories, options, traceConfig are ignored.

func (StartParams) WithScreenshotMaxCount

func (p StartParams) WithScreenshotMaxCount(screenshotMaxCount int64) *StartParams

WithScreenshotMaxCount maximum number of screenshots captured during a single tracing session. Only used when the disabled-by-default-devtools.screenshot category is enabled. Defaults to 450. Clamped together with screenshotMaxSize to stay within the per-session screenshot memory budget.

func (StartParams) WithScreenshotMaxSize

func (p StartParams) WithScreenshotMaxSize(screenshotMaxSize int64) *StartParams

WithScreenshotMaxSize maximum width and height (in pixels) of each captured screenshot. Only used when the disabled-by-default-devtools.screenshot category is enabled. Defaults to 500. The combined memory footprint of screenshots (screenshotMaxSize * screenshotMaxSize * 4 * screenshotMaxCount) is clamped to the existing per-session budget.

func (StartParams) WithStreamCompression

func (p StartParams) WithStreamCompression(streamCompression StreamCompression) *StartParams

WithStreamCompression compression format to use. This only applies when using ReturnAsStream transfer mode (defaults to none).

func (StartParams) WithStreamFormat

func (p StartParams) WithStreamFormat(streamFormat StreamFormat) *StartParams

WithStreamFormat trace data format to use. This only applies when using ReturnAsStream transfer mode (defaults to json).

func (StartParams) WithTraceConfig

func (p StartParams) WithTraceConfig(traceConfig *TraceConfig) *StartParams

WithTraceConfig [no description].

func (StartParams) WithTracingBackend

func (p StartParams) WithTracingBackend(tracingBackend Backend) *StartParams

WithTracingBackend backend type (defaults to auto).

func (StartParams) WithTransferMode

func (p StartParams) WithTransferMode(transferMode StartTransferMode) *StartParams

WithTransferMode whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to ReportEvents).

type StartTransferMode added in v0.157.1

type StartTransferMode string

StartTransferMode whether to report trace events as series of dataCollected events or to save trace to a stream (defaults to ReportEvents).

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#method-start

const (
	StartTransferModeReportEvents   StartTransferMode = "ReportEvents"
	StartTransferModeReturnAsStream StartTransferMode = "ReturnAsStream"
)

StartTransferMode values.

func (StartTransferMode) String added in v0.157.1

func (t StartTransferMode) String() string

String returns the StartTransferMode as string value.

type StreamCompression

type StreamCompression string

StreamCompression compression type to use for traces returned via streams.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#type-StreamCompression

const (
	StreamCompressionNone StreamCompression = "none"
	StreamCompressionGzip StreamCompression = "gzip"
)

StreamCompression values.

func (StreamCompression) String

func (t StreamCompression) String() string

String returns the StreamCompression as string value.

type StreamFormat

type StreamFormat string

StreamFormat data format of a trace. Can be either the legacy JSON format or the protocol buffer format. Note that the JSON format will be deprecated soon.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#type-StreamFormat

const (
	StreamFormatJSON  StreamFormat = "json"
	StreamFormatProto StreamFormat = "proto"
)

StreamFormat values.

func (StreamFormat) String

func (t StreamFormat) String() string

String returns the StreamFormat as string value.

type TraceConfig

type TraceConfig struct {
	RecordMode           TraceConfigRecordMode `json:"recordMode,omitempty,omitzero"`          // Controls how the trace buffer stores data. The default is recordUntilFull.
	TraceBufferSizeInKb  float64               `json:"traceBufferSizeInKb,omitempty,omitzero"` // Size of the trace buffer in kilobytes. If not specified or zero is passed, a default value of 200 MB would be used.
	EnableSampling       bool                  `json:"enableSampling"`                         // Turns on JavaScript stack sampling.
	EnableSystrace       bool                  `json:"enableSystrace"`                         // Turns on system tracing.
	EnableArgumentFilter bool                  `json:"enableArgumentFilter"`                   // Turns on argument filter.
	IncludedCategories   []string              `json:"includedCategories,omitempty,omitzero"`  // Included category filters.
	ExcludedCategories   []string              `json:"excludedCategories,omitempty,omitzero"`  // Excluded category filters.
	SyntheticDelays      []string              `json:"syntheticDelays,omitempty,omitzero"`     // Configuration to synthesize the delays in tracing.
	MemoryDumpConfig     *MemoryDumpConfig     `json:"memoryDumpConfig,omitempty,omitzero"`    // Configuration for memory dump triggers. Used only when "memory-infra" category is enabled.
}

TraceConfig [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#type-TraceConfig

type TraceConfigRecordMode added in v0.157.1

type TraceConfigRecordMode string

TraceConfigRecordMode controls how the trace buffer stores data. The default is recordUntilFull.

See: https://chromedevtools.github.io/devtools-protocol/tot/Tracing#type-TraceConfig

const (
	TraceConfigRecordModeRecordUntilFull        TraceConfigRecordMode = "recordUntilFull"
	TraceConfigRecordModeRecordContinuously     TraceConfigRecordMode = "recordContinuously"
	TraceConfigRecordModeRecordAsMuchAsPossible TraceConfigRecordMode = "recordAsMuchAsPossible"
	TraceConfigRecordModeEchoToConsole          TraceConfigRecordMode = "echoToConsole"
)

TraceConfigRecordMode values.

func (TraceConfigRecordMode) String added in v0.157.1

func (t TraceConfigRecordMode) String() string

String returns the TraceConfigRecordMode as string value.

Jump to

Keyboard shortcuts

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