trace

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: BSD-3-Clause Imports: 15 Imported by: 115

README

How to trace AvalancheGo

AvalancheGo can export OpenTelemetry traces with spans covering message routing, consensus, and VM operations. Tracing is disabled by default. This guide visualizes traces locally with Jaeger.

1. Start Jaeger

docker run --rm \
  --name jaeger \
  -p 16686:16686 \
  -p 4317:4317 \
  -p 4318:4318 \
  jaegertracing/jaeger:2.20.0@sha256:46a886260e04002d8f45e213fc39063fa11a50446048fdaa64786fc0840cb9f8

Jaeger stores traces in memory. Traces are lost when the container stops.

2. Run AvalancheGo with tracing enabled

./build/avalanchego --tracing-exporter-type=grpc --tracing-sample-rate=1

The default export endpoint is localhost:4317, which matches the Jaeger container above. The default sample rate is 0.1, which is too sparse for interactive debugging, so this samples everything.

3. View traces

Open http://localhost:16686, select the avalanchego service, and click Find Traces.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ExporterConfig `json:"exporterConfig"`

	// The fraction of traces to sample.
	// If >= 1 always samples.
	// If <= 0 never samples.
	TraceSampleRate float64 `json:"traceSampleRate"`

	AppName string `json:"appName"`
	Version string `json:"version"`
}

type ExporterConfig

type ExporterConfig struct {
	Type ExporterType `json:"type"`

	// Endpoint to send metrics to. If empty, the default endpoint will be used.
	Endpoint string `json:"endpoint"`

	// Headers to send with metrics
	Headers map[string]string `json:"headers"`

	// If true, don't use TLS
	Insecure bool `json:"insecure"`
}

type ExporterType

type ExporterType byte
const (
	Disabled ExporterType = iota
	GRPC
	HTTP
)

func ExporterTypeFromString

func ExporterTypeFromString(exporterTypeStr string) (ExporterType, error)

func (ExporterType) MarshalJSON

func (t ExporterType) MarshalJSON() ([]byte, error)

func (ExporterType) String

func (t ExporterType) String() string

func (*ExporterType) UnmarshalJSON added in v1.13.1

func (t *ExporterType) UnmarshalJSON(b []byte) error

type Tracer

type Tracer interface {
	trace.Tracer
	io.Closer
}
var Noop Tracer = noOpTracer{}

func New

func New(config Config) (Tracer, error)

Jump to

Keyboard shortcuts

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