otelutils

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 22 Imported by: 13

Documentation

Index

Constants

View Source
const (
	AdminClientTracer       = "admin-client"
	AdminGormTracer         = "admin-gorm"
	AdminServerTracer       = "admin-server"
	BlobstoreClientTracer   = "blobstore-client"
	DataCatalogClientTracer = "datacatalog-client"
	DataCatalogGormTracer   = "datacatalog-gorm"
	DataCatalogServerTracer = "datacatalog-server"
	FlytePropellerTracer    = "flytepropeller"
	K8sClientTracer         = "k8s-client"
)

Variables

View Source
var (
	ConfigSection = config.MustRegisterSection(configSectionKey, defaultConfig)
)

Functions

func GetTracerProvider

func GetTracerProvider(serviceName string) rawtrace.TracerProvider

GetTracerProvider returns the tracer provider for the given service name.

func NewSpan

func NewSpan(ctx context.Context, serviceName string, spanName string) (context.Context, rawtrace.Span)

NewSpan creates a new span with the given service name and span name.

func RegisterTracerProvider deprecated

func RegisterTracerProvider(serviceName string, config *Config) error

Deprecated: RegisterTracerProvider registers a tracer provider for the given service name. It uses a default context if necessary. Instead, use RegisterTracerProviderWithContext.

func RegisterTracerProviderWithContext added in v1.13.0

func RegisterTracerProviderWithContext(ctx context.Context, serviceName string, config *Config) error

RegisterTracerProviderWithContext registers a tracer provider for the given service name.

func WrapK8sCache

func WrapK8sCache(c cache.Cache) cache.Cache

func WrapK8sClient

func WrapK8sClient(c client.Client) client.Client

Types

type Config

type Config struct {
	ExporterType   ExporterType   `json:"type" pflag:",Sets the type of exporter to configure [noop/file/jaeger/otlpgrpc/otlphttp]."`
	FileConfig     FileConfig     `json:"file" pflag:",Configuration for exporting telemetry traces to a file"`
	JaegerConfig   JaegerConfig   `json:"jaeger" pflag:",Configuration for exporting telemetry traces to a jaeger"`
	OtlpGrpcConfig OtlpGrpcConfig `json:"otlpgrpc" pflag:",Configuration for exporting telemetry traces to an OTLP gRPC collector"`
	OtlpHttpConfig OtlpHttpConfig `json:"otlphttp" pflag:",Configuration for exporting telemetry traces to an OTLP HTTP collector"` // nolint:golint
	SamplerConfig  SamplerConfig  `json:"sampler" pflag:",Configuration for the sampler to use for the tracer"`
}

func GetConfig

func GetConfig() *Config

func (Config) GetPFlagSet

func (cfg Config) GetPFlagSet(prefix string) *pflag.FlagSet

GetPFlagSet will return strongly types pflags for all fields in Config and its nested types. The format of the flags is json-name.json-sub-name... etc.

type ExporterType

type ExporterType = string
const (
	NoopExporter     ExporterType = "noop"
	FileExporter     ExporterType = "file"
	JaegerExporter   ExporterType = "jaeger"
	OtlpGrpcExporter ExporterType = "otlpgrpc"
	OtlpHttpExporter ExporterType = "otlphttp" // nolint:golint
)

type FileConfig

type FileConfig struct {
	Filename string `json:"filename" pflag:",Filename to store exported telemetry traces"`
}

type JaegerConfig

type JaegerConfig struct {
	Endpoint string `json:"endpoint" pflag:",Endpoint for the jaeger telemetry trace ingestor"`
}

type K8sCacheWrapper

type K8sCacheWrapper struct {
	cache.Cache
}

func (*K8sCacheWrapper) Get

func (*K8sCacheWrapper) List

func (c *K8sCacheWrapper) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

type K8sClientWrapper

type K8sClientWrapper struct {
	client.Client
	// contains filtered or unexported fields
}

func (*K8sClientWrapper) Create

func (c *K8sClientWrapper) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error

func (*K8sClientWrapper) Delete

func (c *K8sClientWrapper) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error

func (*K8sClientWrapper) DeleteAllOf

func (c *K8sClientWrapper) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error

func (*K8sClientWrapper) Get

func (*K8sClientWrapper) List

func (*K8sClientWrapper) Patch

func (c *K8sClientWrapper) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error

func (*K8sClientWrapper) Status

func (c *K8sClientWrapper) Status() client.StatusWriter

func (*K8sClientWrapper) Update

func (c *K8sClientWrapper) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error

type K8sStatusWriterWrapper

type K8sStatusWriterWrapper struct {
	client.StatusWriter
}

func (*K8sStatusWriterWrapper) Patch

func (*K8sStatusWriterWrapper) Update

type OtlpGrpcConfig added in v1.13.0

type OtlpGrpcConfig struct {
	Endpoint string `json:"endpoint" pflag:",Endpoint for the OTLP telemetry trace collector"`
}

type OtlpHttpConfig added in v1.13.0

type OtlpHttpConfig struct {
	Endpoint string `json:"endpoint" pflag:",Endpoint for the OTLP telemetry trace collector"`
}

type SamplerConfig added in v1.13.0

type SamplerConfig struct {
	ParentSampler SamplerType `json:"parentSampler" pflag:",Sets the parent sampler to use for the tracer"`
	TraceIDRatio  float64     `json:"traceIdRatio" pflag:"-,Sets the trace id ratio for the TraceIdRatioBased sampler"`
}

type SamplerType added in v1.13.0

type SamplerType = string
const (
	AlwaysSample      SamplerType = "always"
	TraceIDRatioBased SamplerType = "traceid"
)

Jump to

Keyboard shortcuts

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