observability

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// EnableSinkEventErrorReportingKey is the CM key to enable emitting a k8s event when delivery to a sink fails
	EnableSinkEventErrorReportingKey = "sink-event-error-reporting.enable"

	// DefaultEnableSinkEventErrorReporting is used to set the default sink event error reporting value
	DefaultEnableSinkEventErrorReporting = false

	// DefaultMetricsPort is the default port used for prometheus metrics if the prometheus protocol is used
	DefaultMetricsPort = 9092
)
View Source
const (
	KnativeMessagingSystem = "knative"
)

Variables

View Source
var (
	// required attributes for otel messaging span semantics: https://opentelemetry.io/docs/specs/semconv/messaging/messaging-spans/#conventions
	MessagingSystem              = attributekey.String("messaging.system")
	MessagingOperationName       = attributekey.String("messaging.operation.name")
	MessagingDestinationName     = attributekey.String("messaging.destination.name")
	MessagingDestinationTemplate = attributekey.String("messaging.destination.tempate")

	// attributes relating to the source
	SourceName          = attributekey.String("kn.source.name")
	SourceNamespace     = attributekey.String("kn.source.namespace")
	SourceResourceGroup = attributekey.String("kn.source.resourcegroup")

	// attributes relating to the broker
	BrokerName      = attributekey.String("kn.broker.name")
	BrokerNamespace = attributekey.String("kn.broker.namespace")

	// attributes relating to the channel
	ChannelName      = attributekey.String("kn.channel.name")
	ChannelNamespace = attributekey.String("kn.channel.namespace")

	// attributes relating to the broker
	SinkName      = attributekey.String("kn.sink.name")
	SinkNamespace = attributekey.String("kn.sink.namespace")
	SinkKind      = attributekey.String("kn.sink.kind")

	// attributes relating to the cloudevent (not including the ID for cardinality reasons)
	CloudEventType            = attributekey.String(ceo11y.TypeAttr)
	CloudEventSource          = attributekey.String(ceo11y.SourceAttr)
	CloudEventSubject         = attributekey.String(ceo11y.SubjectAttr)
	CloudEventDataContenttype = attributekey.String(ceo11y.DatacontenttypeAttr)
	CloudEventSpecVersion     = attributekey.String(ceo11y.SpecversionAttr)

	// attributes relating to the request
	RequestScheme = attributekey.String("url.scheme")
)

Functions

func K8sAttributes

func K8sAttributes(name, namespace, resource string) []attribute.KeyValue

K8sAttributes generates Kubernetes trace attributes for the object of the given name in the given namespace. resource identifies the object type as <singular>.<group>

func MessagingLabels added in v0.46.0

func MessagingLabels(destination, operation string) []attribute.KeyValue

func WithBrokerLabels added in v0.46.0

func WithBrokerLabels(ctx context.Context, broker types.NamespacedName) context.Context

func WithChannelLabels added in v0.46.0

func WithChannelLabels(ctx context.Context, channel types.NamespacedName) context.Context

func WithConfig added in v0.46.0

func WithConfig(ctx context.Context, cfg *Config) context.Context

func WithEventLabels added in v0.46.0

func WithEventLabels(ctx context.Context, event *cloudevents.Event) context.Context

func WithLabeler added in v0.46.0

func WithLabeler(ctx context.Context) context.Context

func WithLowCardinalityMessagingLabels added in v0.46.0

func WithLowCardinalityMessagingLabels(ctx context.Context, destinationTemplate, operation string) context.Context

func WithMessagingLabels added in v0.46.0

func WithMessagingLabels(ctx context.Context, destination, operation string) context.Context

func WithMinimalEventLabels added in v0.46.0

func WithMinimalEventLabels(ctx context.Context, event *cloudevents.Event) context.Context

WithMinimalEventLabels adds a minimal set of event labels, suitable for metrics (to keep cardinality lower)

func WithRequestLabels added in v0.46.0

func WithRequestLabels(ctx context.Context, r *http.Request) context.Context

func WithSinkLabels added in v0.46.0

func WithSinkLabels(ctx context.Context, sink types.NamespacedName, kind string) context.Context

func WithSpanData

func WithSpanData(ctx context.Context, name string, kind int, attributes []attribute.KeyValue) context.Context

WithSpanData extends the given context with the given span values

Types

type BaseConfig added in v0.46.0

type BaseConfig = pkgo11y.Config

type Config added in v0.46.0

type Config struct {
	BaseConfig

	// EnableSinkEventErrorReporting specifies whether we should emit a k8s
	// event when delivery to a sink fails
	EnableSinkEventErrorReporting bool `json:"enableSinkEventErrorReporting"`
}

+k8s:deepcopy-gen=true

func DefaultConfig added in v0.46.0

func DefaultConfig() *Config

func GetConfig added in v0.46.0

func GetConfig(ctx context.Context) *Config

func MergeWithDefaults added in v0.46.0

func MergeWithDefaults(cfg *Config) *Config

merge the config with the default config, setting defaults wherever config is not set

func NewFromMap added in v0.46.0

func NewFromMap(m map[string]string) (*Config, error)

type MetricsConfig added in v0.46.0

type MetricsConfig = pkgo11y.MetricsConfig

type RuntimeConfig added in v0.46.0

type RuntimeConfig = pkgo11y.RuntimeConfig

type SpanData

type SpanData struct {
	// Name is the span name
	Name string

	// Kind is the span kind
	Kind int

	// Attributes is the additional set of span attributes
	Attributes []attribute.KeyValue
}

SpanData contains values for creating tracing spans.

func SpanDataFromContext

func SpanDataFromContext(ctx context.Context) *SpanData

SpanDataFromContext gets the span values from the context

type TracingConfig added in v0.46.0

type TracingConfig = pkgo11y.TracingConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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