telemetry

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 23 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ProviderName = "flagd"

	FeatureFlagReasonKey = attribute.Key("feature_flag.reason")
	ExceptionTypeKey     = attribute.Key("ExceptionTypeKeyName")
)

Variables

This section is empty.

Functions

func BuildConnectOptions added in v0.5.3

func BuildConnectOptions(cfg Config) ([]connect.HandlerOption, error)

BuildConnectOptions is a helper to build connect options based on telemetry configurations

func BuildTraceProvider added in v0.5.2

func BuildTraceProvider(ctx context.Context, logger *logger.Logger, svc string, svcVersion string, cfg Config) error

BuildTraceProvider build and register the trace provider and propagator for the caller runtime. This method attempt to register a global TracerProvider backed by batch SpanProcessor.Config. CollectorTarget can be used to provide the grpc collector target. Providing empty target results in skipping provider & propagator registration. This results in tracers having NoopTracerProvider and propagator having No-Op TextMapPropagator performing no action

func ExceptionType added in v0.5.2

func ExceptionType(val string) attribute.KeyValue

func FeatureFlagReason added in v0.5.2

func FeatureFlagReason(val string) attribute.KeyValue

func RegisterErrorHandling added in v0.6.1

func RegisterErrorHandling(log *logger.Logger)

func SemConvFeatureFlagAttributes added in v0.5.2

func SemConvFeatureFlagAttributes(ffKey string, ffVariant string) []attribute.KeyValue

SemConvFeatureFlagAttributes is helper to derive semantic convention adhering feature flag attributes refer - https://opentelemetry.io/docs/reference/specification/trace/semantic_conventions/feature-flags/

Types

type Config

type Config struct {
	MetricsExporter string
	CollectorTarget string
}

Config of the telemetry runtime. These are expected to be mapped to start-up arguments

type MetricsRecorder

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

func BuildMetricsRecorder

func BuildMetricsRecorder(
	ctx context.Context, svcName string, svcVersion string, config Config,
) (*MetricsRecorder, error)

BuildMetricsRecorder is a helper to build telemetry.MetricsRecorder based on configurations

func NewOTelRecorder

func NewOTelRecorder(exporter msdk.Reader, resource *resource.Resource, serviceName string) *MetricsRecorder

NewOTelRecorder creates a MetricsRecorder based on the provided metric.Reader. Note that, metric.NewMeterProvider is created here but not registered globally as this is the only place we derive a metric.Meter. Consider global provider registration if we need more meters

func (MetricsRecorder) HTTPAttributes

func (r MetricsRecorder) HTTPAttributes(svcName, url, method, code string) []attribute.KeyValue

func (MetricsRecorder) HTTPRequestDuration

func (r MetricsRecorder) HTTPRequestDuration(ctx context.Context, duration time.Duration, attrs []attribute.KeyValue)

func (MetricsRecorder) HTTPResponseSize

func (r MetricsRecorder) HTTPResponseSize(ctx context.Context, sizeBytes int64, attrs []attribute.KeyValue)

func (MetricsRecorder) Impressions

func (r MetricsRecorder) Impressions(ctx context.Context, reason, variant, key string)

func (MetricsRecorder) InFlightRequestEnd

func (r MetricsRecorder) InFlightRequestEnd(ctx context.Context, attrs []attribute.KeyValue)

func (MetricsRecorder) InFlightRequestStart

func (r MetricsRecorder) InFlightRequestStart(ctx context.Context, attrs []attribute.KeyValue)

func (MetricsRecorder) Reasons added in v0.5.2

func (r MetricsRecorder) Reasons(ctx context.Context, key string, reason string, err error)

func (MetricsRecorder) RecordEvaluation added in v0.5.2

func (r MetricsRecorder) RecordEvaluation(ctx context.Context, err error, reason, variant, key string)

Jump to

Keyboard shortcuts

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