tracing

package
v0.158.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 3 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

View Source
var BufferUsage = cdp.Event[EventBufferUsage]{Method: "Tracing.bufferUsage"}

BufferUsage [no description].

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

View Source
var DataCollected = cdp.Event[EventDataCollected]{Method: "Tracing.dataCollected"}

DataCollected 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

End stop trace events collection.

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

GetCategories gets supported tracing categories.

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

GetTrackEventDescriptor return a descriptor for all available tracing categories.

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

RecordClockSyncMarker record a clock sync marker in the trace.

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

RequestMemoryDump request a global memory dump.

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

Start start trace events collection.

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

View Source
var TracingComplete = cdp.Event[EventTracingComplete]{Method: "Tracing.tracingComplete"}

TracingComplete 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

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 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 []jsonv2.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 GetCategoriesResult added in v0.157.3

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

GetCategoriesResult is the result of the command Tracing.getCategories.

type GetTrackEventDescriptorResult added in v0.157.3

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

GetTrackEventDescriptorResult is the result of the command Tracing.getTrackEventDescriptor.

type MemoryDumpConfig

type MemoryDumpConfig map[string]any

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 are the parameters of the command Tracing.recordClockSyncMarker.

type RequestMemoryDumpParams

type RequestMemoryDumpParams struct {
	Deterministic *bool                   `json:"deterministic,omitempty,omitzero"` // 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 are the parameters of the command Tracing.requestMemoryDump.

type RequestMemoryDumpResult added in v0.157.3

type RequestMemoryDumpResult 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.
}

RequestMemoryDumpResult is the result of the command Tracing.requestMemoryDump.

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               []byte            `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 are the parameters of the command Tracing.start.

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