tracing

package
v0.25.0-rc2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Flags = []cli.Flag{

	&cli.BoolFlag{
		EnvVars: []string{"VELA_OTEL_TRACING_ENABLE"},
		Name:    "tracing.enable",
		Usage:   "enable otel tracing. see Vela installation docs and https://opentelemetry.io/docs/concepts/signals/traces/",
		Value:   false,
	},
	&cli.StringFlag{
		EnvVars: []string{"VELA_OTEL_TRACING_SERVICE_NAME"},
		Name:    "tracing.service.name",
		Usage:   "set otel tracing service name. see: https://opentelemetry.io/docs/languages/sdk-configuration/general/",
		Value:   "vela-server",
	},

	&cli.StringFlag{
		EnvVars: []string{"VELA_OTEL_EXPORTER_OTLP_ENDPOINT"},
		Name:    "tracing.exporter.endpoint",
		Usage:   "set the otel exporter endpoint (ex. scheme://host:port). see: https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/",
	},
	&cli.StringFlag{
		EnvVars: []string{"VELA_OTEL_TRACING_EXPORTER_SSL_CERT_PATH"},
		Name:    "tracing.exporter.cert_path",
		Usage:   "set the filepath to certificates that will be used for communicating with the otel exporter. when no path is provided the server will use insecure communication to export traces. see: https://opentelemetry.io/docs/specs/otel/protocol/exporter/",
	},
	&cli.StringFlag{
		EnvVars: []string{"VELA_OTEL_TRACING_TLS_MIN_VERSION"},
		Name:    "tracing.exporter.tls-min-version",
		Usage:   "optional TLS minimum version requirement to set when communicating with the otel exporter",
		Value:   "1.2",
	},

	&cli.StringSliceFlag{
		EnvVars: []string{"VELA_OTEL_TRACING_RESOURCE_ATTRIBUTES"},
		Name:    "tracing.resource.attributes",
		Usage:   "set otel resource (span) attributes as a list of key=value pairs. each one will be attached to each span as a 'process' attribute. see: https://opentelemetry.io/docs/languages/go/instrumentation/#span-attributes",
		Value:   cli.NewStringSlice("process.runtime.name=go"),
	},
	&cli.StringSliceFlag{
		EnvVars: []string{"VELA_OTEL_TRACING_RESOURCE_ENV_ATTRIBUTES"},
		Name:    "tracing.resource.env_attributes",
		Usage:   "set otel resource (span) attributes as a list of key=env_variable_key pairs. each one will be attached to each span as a 'process' attribute where the value is retrieved from the environment using the pair value. see: https://opentelemetry.io/docs/languages/go/instrumentation/#span-attributes",
	},
	&cli.StringSliceFlag{
		EnvVars: []string{"VELA_OTEL_TRACING_SPAN_ATTRIBUTES"},
		Name:    "tracing.span.attributes",
		Usage:   "set otel span attributes as a list of key=value pairs. each one will be attached to each span as a 'tag' attribute. see: https://opentelemetry.io/docs/languages/go/instrumentation/#span-attributes",
	},
	&cli.StringSliceFlag{
		EnvVars: []string{"VELA_OTEL_TRACING_TRACESTATE_ATTRIBUTES"},
		Name:    "tracing.tracestate.attributes",
		Usage:   "set otel tracestate (span) attributes as a list of key=value pairs. each one will be inserted into the tracestate for each sampled span. see: https://www.w3.org/TR/trace-context",
	},

	&cli.Float64Flag{
		EnvVars: []string{"VELA_OTEL_TRACING_SAMPLER_RATELIMIT_PER_SECOND"},
		Name:    "tracing.sampler.persecond",
		Usage:   "set otel tracing head-sampler rate-limiting to N per second. see: https://opentelemetry.io/docs/concepts/sampling/",
		Value:   100,
	},

	&cli.StringFlag{
		EnvVars: []string{"VELA_OTEL_TRACING_SAMPLER_TASKS_CONFIG_FILEPATH"},
		Name:    "tracing.sampler.tasks",
		Usage:   "set an (optional) filepath to the otel tracing head-sampler configurations json to alter how certain tasks (endpoints, queries, etc) are sampled. when no path is provided all tasks are recorded using default parameters. see: https://opentelemetry.io/docs/concepts/sampling/",
	},
}

Functions

This section is empty.

Types

type Client

type Client struct {
	Config
	TracerProvider *sdktrace.TracerProvider
}

Client represents the tracing client and the configurations that were used to initialize it.

func FromCLIContext

func FromCLIContext(c *cli.Context) (*Client, error)

FromCLIContext takes cli context and returns a tracing config to supply to traceable services.

type Config

type Config struct {
	EnableTracing        bool
	ServiceName          string
	ExporterURL          string
	CertPath             string
	TLSMinVersion        string
	ResourceAttributes   map[string]string
	TraceStateAttributes map[string]string
	SpanAttributes       map[string]string
	Sampler
}

Config represents the configurations for otel tracing.

type RateLimitSampler

type RateLimitSampler struct {
	Config
	// contains filtered or unexported fields
}

RateLimitSampler is a sampler that uses time-based rate limiting.

func NewRateLimitSampler

func NewRateLimitSampler(tc Config) *RateLimitSampler

NewRateLimitSampler returns a new rate limit sampler.

func (*RateLimitSampler) Description

func (s *RateLimitSampler) Description() string

Description returns the description of the rate limit sampler.

func (*RateLimitSampler) ShouldSample

ShouldSample determines if a trace should be sampled.

func (*RateLimitSampler) ShouldSampleTask

func (s *RateLimitSampler) ShouldSampleTask(p sdktrace.SamplingParameters) bool

ShouldSampleTask returns whether a task should be sampled.

type Sampler

type Sampler struct {
	PerSecond float64
	Tasks
}

Sampler represents the configurations for the otel sampler. Used to determine if a trace should be sampled.

type Task

type Task struct {
	Active bool
}

Task represents the sampler configurations on a per-task basis. 'Active' will disable/enable the task. If tracing encounters a task name not present in the map, it is considered Active (true).

type Tasks

type Tasks map[string]Task

Tasks represents a map of task names to per-task configurations. A 'task name' is the endpoint or instrumentation scope, depending on the task. For example, database trace tasks could be 'gorm.query' and HTTP requests could be 'api/v1/:worker' depending on the endpoint.

Jump to

Keyboard shortcuts

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