traces

package
v0.24.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package perfetto contains libraries for displaying trace information in the Perfetto UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB is a trace database that stores traces on the local file system.

func OpenDB

func OpenDB(ctx context.Context, fname string) (*DB, error)

OpenDB opens the trace database persisted in the provided file. If the file doesn't exist, this call creates it.

func (*DB) Close

func (d *DB) Close() error

Close closes the trace database.

func (*DB) FetchSpans

func (d *DB) FetchSpans(ctx context.Context, traceID string) ([]*protos.Span, error)

FetchSpans returns all of the spans that have a given trace id.

func (*DB) QueryTraces

func (d *DB) QueryTraces(ctx context.Context, app, version string, startTime, endTime time.Time, durationLower, durationUpper time.Duration, onlyErrors bool, limit int64) ([]TraceSummary, error)

QueryTraces returns the summaries of the traces that match the given query arguments, namely:

  • That have been generated by the given application version.
  • That fit entirely in the given [startTime, endTime] time interval.
  • Whose duration is in the given [durationLower, durationUpper) range.
  • Who have an error status.
  • Who are in the most recent limit of trace spans.

Any query argument that has a zero value (e.g., empty app or version, zero endTime) is ignored, i.e., it matches all spans.

func (*DB) Store

func (d *DB) Store(ctx context.Context, app, version string, spans *protos.TraceSpans) error

Store stores the given trace spans in the database.

type ReadSpan

type ReadSpan struct {
	sdk.ReadOnlySpan
	Span *protos.Span
}

ReadSpan is a wrapper around *protos.Span that implements the Open Telemetry ReadOnlySpan interface.

func (*ReadSpan) Attributes

func (s *ReadSpan) Attributes() []attribute.KeyValue

Attributes implements the ReadOnlySpan interface.

func (*ReadSpan) ChildSpanCount

func (s *ReadSpan) ChildSpanCount() int

ChildSpanCount implements the ReadOnlySpan interface.

func (*ReadSpan) DroppedAttributes

func (s *ReadSpan) DroppedAttributes() int

DroppedAttributes implements the ReadOnlySpan interface.

func (*ReadSpan) DroppedEvents

func (s *ReadSpan) DroppedEvents() int

DroppedEvents implements the ReadOnlySpan interface.

func (s *ReadSpan) DroppedLinks() int

DroppedLinks implements the ReadOnlySpan interface.

func (*ReadSpan) EndTime

func (s *ReadSpan) EndTime() time.Time

EndTime implements the ReadOnlySpan interface.

func (*ReadSpan) Events

func (s *ReadSpan) Events() []sdk.Event

Events implements the ReadOnlySpan interface.

func (*ReadSpan) InstrumentationLibrary

func (s *ReadSpan) InstrumentationLibrary() instrumentation.Scope

InstrumentationLibrary implements the ReadOnlySpan interface.

func (*ReadSpan) InstrumentationScope

func (s *ReadSpan) InstrumentationScope() instrumentation.Scope

InstrumentationScope implements the ReadOnlySpan interface.

func (s *ReadSpan) Links() []sdk.Link

Links implements the ReadOnlySpan interface.

func (*ReadSpan) Name

func (s *ReadSpan) Name() string

Name implements the ReadOnlySpan interface.

func (*ReadSpan) Parent

func (s *ReadSpan) Parent() trace.SpanContext

Parent implements the ReadOnlySpan interface.

func (*ReadSpan) Resource

func (s *ReadSpan) Resource() *resource.Resource

Resource implements the ReadOnlySpan interface.

func (*ReadSpan) SpanContext

func (s *ReadSpan) SpanContext() trace.SpanContext

SpanContext implements the ReadOnlySpan interface.

func (*ReadSpan) SpanKind

func (s *ReadSpan) SpanKind() trace.SpanKind

SpanKind implements the ReadOnlySpan interface.

func (*ReadSpan) StartTime

func (s *ReadSpan) StartTime() time.Time

StartTime implements the ReadOnlySpan interface.

func (*ReadSpan) Status

func (s *ReadSpan) Status() sdk.Status

Status implements the ReadOnlySpan interface.

type TraceSummary

type TraceSummary struct {
	TraceID            string    // Unique trace identifier, in hex format.
	StartTime, EndTime time.Time // Start and end times for the trace.
	Status             string    // Trace status string.
}

TraceSummary stores summary information about a trace.

Jump to

Keyboard shortcuts

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