Help us shape the future of Go! Take the 2026 Go Developer Survey

flags

package
v0.44.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExporterTypeGRPC  ExporterType = "grpc"
	ExporterTypeHTTP  ExporterType = "http"
	ExporterTypeStdio ExporterType = "stdout"

	SamplerTypeAlways     SamplerType = "always"
	SamplerTypeNever      SamplerType = "never"
	SamplerTypeRatioBased SamplerType = "ratio_based"
)
View Source
const Name = "proto"

Name is the name registered for the proto compressor.

Variables

This section is empty.

Functions

func NewPerRequestBearerToken

func NewPerRequestBearerToken(token string, insecure bool) *perRequestBearerToken

func NewProvider

func NewProvider(ctx context.Context, version string, exporter sdktrace.SpanExporter, opts ...sdktrace.TracerProviderOption) (trace.TracerProvider, error)

NewProvider returns an OTLP exporter based tracer.

Types

type ExitCode

type ExitCode int
const (
	ExitSuccess ExitCode = 0
	ExitFailure ExitCode = 1

	// Go 'flag' package calls os.Exit(2) on flag parse errors, if ExitOnError is set
	ExitParseError ExitCode = 2
)

func Failure

func Failure(msg string, args ...interface{}) ExitCode

func ParseError

func ParseError(msg string, args ...interface{}) ExitCode

type Exporter

type Exporter interface {
	sdktrace.SpanExporter

	Start(ctx context.Context) error
}

func NewConsoleExporter

func NewConsoleExporter(w io.Writer) (Exporter, error)

NewConsoleExporter returns a console exporter.

func NewExporter

func NewExporter(exType, otlpAddress string) (Exporter, error)

func NewGRPCExporter

func NewGRPCExporter(otlpAddress string) (Exporter, error)

NewGRPCExporter returns a gRPC exporter.

func NewHTTPExporter

func NewHTTPExporter(otlpAddress string) (Exporter, error)

NewHTTPExporter returns a HTTP exporter.

type ExporterType

type ExporterType string

type Flags

type Flags struct {
	Log         FlagsLogs `embed:""                         prefix:"log-"`
	HTTPAddress string    `default:"127.0.0.1:7071"         help:"Address to bind HTTP server to."`
	Version     bool      `help:"Show application version."`

	EnvironmentType string   `help:"The type of environment."`
	MachineID       string   `help:"The machine ID."`
	IncludeEnvVar   []string `help:"Environment variables to include in the profile."`

	OtelTags string `default:"" help:"Otel tags to attach to all traces."`
	Tracers  string `default:"all" help:"Tracers to enable."`

	Node          string `` /* 155-byte string literal not displayed */
	ConfigPath    string `default:""                          help:"Path to config file."`
	MemlockRlimit uint64 `` /* 216-byte string literal not displayed */

	// pprof.
	MutexProfileFraction int `default:"0" help:"Fraction of mutex profile samples to collect."`
	BlockProfileRate     int `default:"0" help:"Sample rate for block profile."`

	Profiling      FlagsProfiling      `embed:"" prefix:"profiling-"`
	Metadata       FlagsMetadata       `embed:"" prefix:"metadata-"`
	LocalStore     FlagsLocalStore     `embed:"" prefix:"local-store-"`
	RemoteStore    FlagsRemoteStore    `embed:"" prefix:"remote-store-"`
	Debuginfo      FlagsDebuginfo      `embed:"" prefix:"debuginfo-"`
	Symbolizer     FlagsSymbolizer     `embed:"" prefix:"symbolizer-"`
	OTLP           FlagsOTLP           `embed:"" prefix:"otlp-"`
	ObjectFilePool FlagsObjectFilePool `embed:"" prefix:"object-file-pool-"`

	ClockSyncInterval time.Duration `default:"3m" help:"How frequently to synchronize with the realtime clock."`

	DWARFUnwinding         FlagsDWARFUnwinding `embed:""        prefix:"dwarf-unwinding-"`
	PythonUnwindingDisable bool                `default:"false" help:"[deprecated] Disable Python unwinder."`
	RubyUnwindingDisable   bool                `default:"false" help:"[deprecated] Disable Ruby unwinder."`
	JavaUnwindingDisable   bool                `default:"true"  help:"[deprecated] Disable Java unwinder."`

	InstrumentCudaLaunch bool `default:"false" help:"instrument calls to cudaLaunchKernel."`

	AnalyticsOptOut bool `default:"false" help:"Opt out of sending anonymous usage statistics."`

	Telemetry FlagsTelemetry `embed:"" prefix:"telemetry-"`
	Hidden    FlagsHidden    `embed:"" hidden:""           prefix:""`

	BPF FlagsBPF `embed:"" prefix:"bpf-"`

	OfflineMode     FlagsOfflineMode `embed:"" prefix:"offline-mode-"`
	OffCPUThreshold float64          `default:"0" help:"The probability (0.0-1.0) of off-CPU event being recorded."`

	EnableOOMProf       bool `default:"false" help:"Enable OOMProf profiling integration."`
	EnableOOMProfAllocs bool `default:"false" help:"Enable OOMProf alloc counts."`
}

func Parse

func Parse() (Flags, error)

func (Flags) Validate

func (f Flags) Validate() ExitCode

type FlagsBPF

type FlagsBPF struct {
	VerboseLogging   bool   `help:"Enable verbose BPF logging."`
	EventsBufferSize uint32 `default:"8192"                     help:"Size in pages of the events buffer."`
	MapScaleFactor   int    `` /* 284-byte string literal not displayed */
	VerifierLogLevel uint32 `default:"0" help:"Log level of the eBPF verifier output (0,1,2). Default is 0."`
	VerifierLogSize  int    `default:"0" help:"[deprecated] Unused."`
}

type FlagsDWARFUnwinding

type FlagsDWARFUnwinding struct {
	Disable bool `help:"[deprecated] Do not unwind using .eh_frame information."`
	Mixed   bool `default:"true"                                    help:"[deprecated] Unwind using .eh_frame information and frame pointers."`
}

FlagsDWARFUnwinding contains flags to configure DWARF unwinding.

type FlagsDebuginfo

type FlagsDebuginfo struct {
	Directories           []string      `default:"/usr/lib/debug" help:"Ordered list of local directories to search for debuginfo files."`
	TempDir               string        `default:"/tmp"           help:"The local directory path to store the interim debuginfo files."`
	Strip                 bool          `` /* 151-byte string literal not displayed */
	Compress              bool          `default:"false"          help:"Compress debuginfo files' DWARF sections before uploading."`
	UploadDisable         bool          `default:"false"          help:"Disable debuginfo collection and upload."`
	UploadMaxParallel     int           `default:"25"             help:"The maximum number of debuginfo upload requests to make in parallel."`
	UploadTimeoutDuration time.Duration `default:"2m"             help:"The timeout duration to cancel upload requests."`
	UploadCacheDuration   time.Duration `default:"5m"             help:"The duration to cache debuginfo upload responses for."`
	DisableCaching        bool          `default:"false"          help:"Disable caching of debuginfo."`
	UploadQueueSize       uint32        `` /* 141-byte string literal not displayed */
}

FlagsDebuginfo contains flags to configure debuginfo.

type FlagsHidden

type FlagsHidden struct {
	AllowRunningAsNonRoot             bool `` /* 152-byte string literal not displayed */
	AllowRunningInNonRootPIDNamespace bool `` /* 152-byte string literal not displayed */

	ForcePanic bool `default:"false" help:"Panics the agent in a goroutine to test that telemetry works." hidden:""`

	IgnoreUnsafeKernelVersion bool `` /* 127-byte string literal not displayed */

	RateLimitUnwindInfo         uint32 `default:"50" hidden:""`
	RateLimitProcessMappings    uint32 `default:"50" hidden:""`
	RateLimitRefreshProcessInfo uint32 `default:"50" hidden:""`
	RateLimitRead               uint32 `default:"50" hidden:""`
}

FlagsHidden contains hidden flags used for debugging or running with untested configurations.

type FlagsLocalStore

type FlagsLocalStore struct {
	Directory string `help:"The local directory to store the profiling data."`
}

FlagsLocalStore provides local store configuration flags.

type FlagsLogs

type FlagsLogs struct {
	Level  string `default:"info"   enum:"error,warn,info,debug" help:"Log level."`
	Format string `default:"logfmt" enum:"logfmt,json"           help:"Configure if structured logging as JSON or as logfmt"`
}

FlagsLocalStore provides local store configuration flags.

func (FlagsLogs) ConfigureLogger

func (f FlagsLogs) ConfigureLogger()

type FlagsMetadata

type FlagsMetadata struct {
	ExternalLabels             map[string]string `help:"Label(s) to attach to all profiles."`
	ContainerRuntimeSocketPath string            `help:"The filesystem path to the container runtimes socket. Leave this empty to use the defaults."`

	DisableCaching       bool `default:"false" help:"[deprecated] Disable caching of metadata."`
	EnableProcessCmdline bool `` /* 142-byte string literal not displayed */
}

FlagsMetadata provides metadadata configuration flags.

type FlagsOTLP

type FlagsOTLP struct {
	Address  string `help:"The endpoint to send OTLP traces to."`
	Exporter string `default:"grpc"                              enum:"grpc,http,stdout" help:"The OTLP exporter to use."`
}

FlagsOTLP provides OTLP configuration flags.

type FlagsObjectFilePool

type FlagsObjectFilePool struct {
	EvictionPolicy string `` /* 286-byte string literal not displayed */
	Size           int    `` /* 226-byte string literal not displayed */
}

type FlagsOfflineMode added in v0.36.0

type FlagsOfflineMode struct {
	StoragePath      string        `help:"Enables offline mode, with the data stored at the given path."`
	RotationInterval time.Duration `default:"10m" help:"How often to rotate and compress the offline mode log."`
	Upload           bool          `help:"Run the uploader for data written in offline mode."`
}

type FlagsProfiling

type FlagsProfiling struct {
	Duration             time.Duration `default:"5s"                                help:"The agent profiling duration to use. Leave this empty to use the defaults."`
	LabelTTL             time.Duration `default:"10m"                               help:"The interval at which the agent will refresh the labels of a tid."`
	CPUSamplingFrequency int           `` /* 131-byte string literal not displayed */

	PerfEventBufferPollInterval       time.Duration `default:"250ms" help:"[deprecated] The interval at which the perf event buffer is polled for new events."`
	PerfEventBufferProcessingInterval time.Duration `default:"100ms" help:"[deprecated] The interval at which the perf event buffer is processed."`
	PerfEventBufferWorkerCount        int           `default:"4"     help:"[deprecated] The number of workers that process the perf event buffer."`

	ProbabilisticInterval  time.Duration `default:"1m" help:"Time interval for which probabilistic profiling will be enabled or disabled."`
	ProbabilisticThreshold uint          `` /* 321-byte string literal not displayed */

	EnableErrorFrames bool `default:"false" help:"Enable collection of error frames."`
}

FlagsProfiling provides profiling configuration flags.

type FlagsRemoteStore

type FlagsRemoteStore struct {
	Address            string `help:"gRPC address to send profiles and symbols to."`
	BearerToken        string `kong:"help='Bearer token to authenticate with store.',env='PARCA_BEARER_TOKEN'"`
	BearerTokenFile    string `help:"File to read bearer token from to authenticate with store."`
	Insecure           bool   `help:"Send gRPC requests via plaintext instead of TLS."`
	InsecureSkipVerify bool   `help:"Skip TLS certificate verification."`

	BatchWriteInterval time.Duration `` /* 130-byte string literal not displayed */
	RPCLoggingEnable   bool          `default:"false" help:"[deprecated] Enable gRPC logging."`
	RPCUnaryTimeout    time.Duration `default:"5m"    help:"[deprecated] Maximum timeout window for unary gRPC requests including retries."`

	GRPCMaxCallRecvMsgSize   int               `default:"33554432" help:"The maximum message size the client can receive."`
	GRPCMaxCallSendMsgSize   int               `default:"33554432" help:"The maximum message size the client can send."`
	GRPCStartupBackoffTime   time.Duration     `default:"1m" help:"The time between failed gRPC requests during startup phase."`
	GRPCConnectionTimeout    time.Duration     `default:"3s" help:"The timeout duration for gRPC connection establishment."`
	GRPCMaxConnectionRetries uint32            `default:"5" help:"The maximum number of retries to establish a gRPC connection."`
	GRPCHeaders              map[string]string `help:"Additional gRPC headers to send with each request (key=value pairs)."`
}

FlagsRemoteStore provides remote store configuration flags.

func (FlagsRemoteStore) WaitGrpcEndpoint

WaitGrpcEndpoint waits until the gRPC connection is established.

type FlagsSymbolizer

type FlagsSymbolizer struct {
	JITDisable bool `help:"[deprecated] Disable JIT symbolization."`
}

FlagsSymbolizer contains flags to configure symbolization.

type FlagsTelemetry

type FlagsTelemetry struct {
	DisablePanicReporting bool  `default:"false"`
	StderrBufferSizeKb    int64 `default:"4096"`
}

type NoopExporter

type NoopExporter struct{}

func NewNoopExporter

func NewNoopExporter() *NoopExporter

func (NoopExporter) ExportSpans

func (n NoopExporter) ExportSpans(_ context.Context, _ []sdktrace.ReadOnlySpan) error

func (NoopExporter) MarshalLog

func (n NoopExporter) MarshalLog() interface{}

func (NoopExporter) Shutdown

func (n NoopExporter) Shutdown(_ context.Context) error

func (NoopExporter) Start

func (n NoopExporter) Start(_ context.Context) error

type SamplerType

type SamplerType string

Jump to

Keyboard shortcuts

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