telemetry

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 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 IMetricsRecorder added in v0.9.3

type IMetricsRecorder interface {
	HTTPAttributes(svcName, url, method, code string) []attribute.KeyValue
	HTTPRequestDuration(ctx context.Context, duration time.Duration, attrs []attribute.KeyValue)
	HTTPResponseSize(ctx context.Context, sizeBytes int64, attrs []attribute.KeyValue)
	InFlightRequestStart(ctx context.Context, attrs []attribute.KeyValue)
	InFlightRequestEnd(ctx context.Context, attrs []attribute.KeyValue)
	RecordEvaluation(ctx context.Context, err error, reason, variant, key string)
	Impressions(ctx context.Context, reason, variant, key string)
}

func BuildMetricsRecorder

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

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

type MetricsRecorder

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

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)

type NoopMetricsRecorder added in v0.9.3

type NoopMetricsRecorder struct{}

func (NoopMetricsRecorder) HTTPAttributes added in v0.9.3

func (NoopMetricsRecorder) HTTPAttributes(_, _, _, _ string) []attribute.KeyValue

func (NoopMetricsRecorder) HTTPRequestDuration added in v0.9.3

func (NoopMetricsRecorder) HTTPRequestDuration(_ context.Context, _ time.Duration, _ []attribute.KeyValue)

func (NoopMetricsRecorder) HTTPResponseSize added in v0.9.3

func (NoopMetricsRecorder) HTTPResponseSize(_ context.Context, _ int64, _ []attribute.KeyValue)

func (NoopMetricsRecorder) Impressions added in v0.9.3

func (NoopMetricsRecorder) Impressions(_ context.Context, _, _, _ string)

func (NoopMetricsRecorder) InFlightRequestEnd added in v0.9.3

func (NoopMetricsRecorder) InFlightRequestEnd(_ context.Context, _ []attribute.KeyValue)

func (NoopMetricsRecorder) InFlightRequestStart added in v0.9.3

func (NoopMetricsRecorder) InFlightRequestStart(_ context.Context, _ []attribute.KeyValue)

func (NoopMetricsRecorder) RecordEvaluation added in v0.9.3

func (NoopMetricsRecorder) RecordEvaluation(_ context.Context, _ error, _, _, _ string)

Jump to

Keyboard shortcuts

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