Documentation
¶
Index ¶
- Variables
- func DelParamOrHeader(httpReq *http.Request, keys ...string)
- func GenerateId() string
- func GenerateNameAndId() (string, string)
- func GetParamOrHeader(httpReq *http.Request, keys ...string) string
- func ReadBody(body io.ReadCloser, header http.Header, maxEventSize int64) ([]byte, error)
- type Category
- type Code
- type Component
- func (c *Component) BrokerSubject() string
- func (*Component) Descriptor() ([]byte, []int)deprecated
- func (lhs *Component) Equal(rhs *Component) bool
- func (x *Component) GetBrokerId() string
- func (x *Component) GetCommit() string
- func (x *Component) GetId() string
- func (x *Component) GetName() string
- func (c *Component) GroupKey() string
- func (c *Component) GroupSubject() string
- func (c *Component) IsFull() bool
- func (c *Component) IsNameOnly() bool
- func (c *Component) Key() string
- func (*Component) ProtoMessage()
- func (x *Component) ProtoReflect() protoreflect.Message
- func (x *Component) Reset()
- func (c *Component) ShortCommit() string
- func (x *Component) String() string
- func (c *Component) Subject() string
- type Err
- func ErrBrokerMismatch(cause ...error) *Err
- func ErrBrokerUnavailable(cause ...error) *Err
- func ErrComponentGone(cause ...error) *Err
- func ErrComponentMismatch(cause ...error) *Err
- func ErrContentTooLarge(cause ...error) *Err
- func ErrInvalid(cause ...error) *Err
- func ErrNotFound(cause ...error) *Err
- func ErrPortUnavailable(cause ...error) *Err
- func ErrRouteInvalid(cause ...error) *Err
- func ErrRouteNotFound(cause ...error) *Err
- func ErrTimeout(cause ...error) *Err
- func ErrUnauthorized(cause ...error) *Err
- func ErrUnexpected(cause ...error) *Err
- func ErrUnknownContentType(cause ...error) *Err
- func ErrUnsupportedAdapter(cause ...error) *Err
- func NewKubeFoxErr(msg string, code Code, grpcCode codes.Code, httpCode int, cause ...error) *Err
- func (e *Err) Code() Code
- func (e *Err) Error() string
- func (e *Err) Format(s fmt.State, verb rune)
- func (e *Err) GRPCCode() codes.Code
- func (e *Err) GRPCStatus() *status.Status
- func (e *Err) HTTPCode() int
- func (e *Err) Is(err error) bool
- func (e *Err) MarshalJSON() ([]byte, error)
- func (e *Err) String() string
- func (e *Err) UnmarshalJSON(value []byte) error
- func (e *Err) Unwrap() error
- type Event
- func (evt *Event) AddHeader(key, value string) EventWriter
- func (evt *Event) Bind(v any) error
- func (evt *Event) BindStrict(v any) error
- func (evt *Event) Bytes() []byte
- func (evt *Event) DelHeader(key string) EventWriter
- func (evt *Event) DelQuery(key string) EventWriter
- func (evt *Event) DelValueMapKey(valKey, key string)
- func (*Event) Descriptor() ([]byte, []int)deprecated
- func (evt *Event) Err() error
- func (evt *Event) EventType() api.EventType
- func (x *Event) GetCategory() Category
- func (x *Event) GetContent() []byte
- func (x *Event) GetContentType() string
- func (x *Event) GetContext() *EventContext
- func (x *Event) GetCreateTime() int64
- func (x *Event) GetId() string
- func (x *Event) GetParams() map[string]*structpb.Value
- func (x *Event) GetParentId() string
- func (x *Event) GetSource() *Component
- func (x *Event) GetTarget() *Component
- func (x *Event) GetTtl() int64
- func (x *Event) GetType() string
- func (x *Event) GetValues() map[string]*structpb.Value
- func (evt *Event) HTTPRequest(ctx context.Context) (*http.Request, error)
- func (evt *Event) HTTPResponse() *http.Response
- func (evt *Event) Header(key string) string
- func (evt *Event) HeaderAll(key string) []string
- func (evt *Event) HeaderDef(key string, def string) string
- func (evt *Event) HeaderV(key string) *api.Val
- func (evt *Event) Param(key string) string
- func (evt *Event) ParamDef(key string, def string) string
- func (evt *Event) ParamProto(key string) *structpb.Value
- func (evt *Event) ParamV(key string) *api.Val
- func (*Event) ProtoMessage()
- func (x *Event) ProtoReflect() protoreflect.Message
- func (evt *Event) Query(key string) string
- func (evt *Event) QueryAll(key string) []string
- func (evt *Event) QueryDef(key string, def string) string
- func (evt *Event) QueryV(key string) *api.Val
- func (evt *Event) ReduceTTL(start time.Time) time.Duration
- func (x *Event) Reset()
- func (evt *Event) SetContext(evtCtx *EventContext)
- func (evt *Event) SetHTTPRequest(httpReq *http.Request, maxEventSize int64) error
- func (evt *Event) SetHTTPResponse(httpResp *http.Response, maxEventSize int64) error
- func (evt *Event) SetHeader(key, value string) EventWriter
- func (evt *Event) SetHeaderV(key string, value *api.Val) EventWriter
- func (evt *Event) SetJSON(v any) error
- func (evt *Event) SetParam(key string, val string) EventWriter
- func (evt *Event) SetParamProto(key string, val *structpb.Value) EventWriter
- func (evt *Event) SetParamV(key string, val *api.Val) EventWriter
- func (evt *Event) SetParent(parent *Event)
- func (evt *Event) SetQuery(key, value string) EventWriter
- func (evt *Event) SetQueryV(key string, value *api.Val) EventWriter
- func (evt *Event) SetSpanId(val string)
- func (evt *Event) SetStatus(code int) EventWriter
- func (evt *Event) SetStatusV(val *api.Val) EventWriter
- func (evt *Event) SetTTL(t time.Duration)
- func (evt *Event) SetTraceFlags(val byte)
- func (evt *Event) SetTraceId(val string)
- func (evt *Event) SetURL(u *url.URL) EventWriter
- func (evt *Event) SetValue(key string, val string)
- func (evt *Event) SetValueMap(key string, m map[string][]string)
- func (evt *Event) SetValueMapKey(valKey, key, value string, overwrite bool)
- func (evt *Event) SetValueProto(key string, val *structpb.Value)
- func (evt *Event) SetValueV(key string, val *api.Val)
- func (evt *Event) SpanId() string
- func (evt *Event) Status() int
- func (evt *Event) StatusV() *api.Val
- func (evt *Event) Str() string
- func (x *Event) String() string
- func (evt *Event) TTL() time.Duration
- func (evt *Event) TraceFlags() byte
- func (evt *Event) TraceId() string
- func (evt *Event) TrimPathPrefix(prefix string) EventWriter
- func (evt *Event) URL() (*url.URL, error)
- func (evt *Event) Value(key string) string
- func (evt *Event) ValueMap(key string) map[string][]string
- func (evt *Event) ValueMapKey(valKey, key string) string
- func (evt *Event) ValueMapKeyAll(valKey, key string) []string
- func (evt *Event) ValueProto(key string) *structpb.Value
- func (evt *Event) ValueV(key string) *api.Val
- type EventContext
- func (*EventContext) Descriptor() ([]byte, []int)deprecated
- func (x *EventContext) GetDeployment() string
- func (x *EventContext) GetEnvironment() string
- func (x *EventContext) GetRelease() string
- func (ctx *EventContext) IsDeployment() bool
- func (ctx *EventContext) IsRelease() bool
- func (*EventContext) ProtoMessage()
- func (x *EventContext) ProtoReflect() protoreflect.Message
- func (x *EventContext) Reset()
- func (x *EventContext) String() string
- type EventOpts
- type EventPredicate
- type EventReader
- type EventWriter
- type Frame
- type LimitedReader
- type MatchedEvent
- func (*MatchedEvent) Descriptor() ([]byte, []int)deprecated
- func (x *MatchedEvent) GetEnv() map[string]*structpb.Value
- func (x *MatchedEvent) GetEvent() *Event
- func (x *MatchedEvent) GetRouteId() int64
- func (*MatchedEvent) ProtoMessage()
- func (x *MatchedEvent) ProtoReflect() protoreflect.Message
- func (x *MatchedEvent) Reset()
- func (x *MatchedEvent) String() string
- type Route
- type Stack
- type StackTrace
Constants ¶
This section is empty.
Variables ¶
var ( Category_name = map[int32]string{ 0: "UNKNOWN", 1: "MESSAGE", 2: "REQUEST", 3: "RESPONSE", } Category_value = map[string]int32{ "UNKNOWN": 0, "MESSAGE": 1, "REQUEST": 2, "RESPONSE": 3, } )
Enum value maps for Category.
var File_protobuf_msgs_proto protoreflect.FileDescriptor
var RecordStackTraces bool
Functions ¶
func DelParamOrHeader ¶
DelParamOrHeader deletes all query parameters and headers that match provided keys.
func GenerateId ¶
func GenerateId() string
func GenerateNameAndId ¶
func GetParamOrHeader ¶
GetParamOrHeader looks for query parameters and headers for the provided keys. Keys are checked in order. Query parameters take precedence over headers.
Types ¶
type Category ¶
type Category int32
func (Category) Descriptor ¶
func (Category) Descriptor() protoreflect.EnumDescriptor
func (Category) EnumDescriptor
deprecated
func (Category) Number ¶
func (x Category) Number() protoreflect.EnumNumber
func (Category) Type ¶
func (Category) Type() protoreflect.EnumType
type Component ¶
type Component struct { // TODO add app? Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Commit string `protobuf:"bytes,2,opt,name=commit,proto3" json:"commit,omitempty"` Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` BrokerId string `protobuf:"bytes,4,opt,name=broker_id,json=brokerId,proto3" json:"broker_id,omitempty"` // contains filtered or unexported fields }
func (*Component) BrokerSubject ¶
func (*Component) Descriptor
deprecated
func (*Component) GetBrokerId ¶
func (*Component) GroupSubject ¶
func (*Component) IsNameOnly ¶
func (*Component) ProtoMessage ¶
func (*Component) ProtoMessage()
func (*Component) ProtoReflect ¶
func (x *Component) ProtoReflect() protoreflect.Message
func (*Component) ShortCommit ¶
type Err ¶
type Err struct {
// contains filtered or unexported fields
}
func ErrBrokerMismatch ¶
func ErrBrokerUnavailable ¶
func ErrComponentGone ¶
func ErrComponentMismatch ¶
func ErrContentTooLarge ¶
func ErrInvalid ¶
func ErrNotFound ¶
func ErrPortUnavailable ¶
func ErrRouteInvalid ¶
func ErrRouteNotFound ¶
func ErrTimeout ¶
func ErrUnauthorized ¶
func ErrUnexpected ¶
func ErrUnknownContentType ¶
func ErrUnsupportedAdapter ¶
func NewKubeFoxErr ¶
func (*Err) GRPCStatus ¶
func (*Err) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface.
func (*Err) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface.
type Event ¶
type Event struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ParentId string `protobuf:"bytes,2,opt,name=parent_id,json=parentId,proto3" json:"parent_id,omitempty"` Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` Category Category `protobuf:"varint,4,opt,name=category,proto3,enum=kubefox.proto.v1.Category" json:"category,omitempty"` // Unix time in µs CreateTime int64 `protobuf:"varint,5,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"` // TTL in µs Ttl int64 `protobuf:"varint,6,opt,name=ttl,proto3" json:"ttl,omitempty"` Context *EventContext `protobuf:"bytes,7,opt,name=context,proto3" json:"context,omitempty"` Source *Component `protobuf:"bytes,8,opt,name=source,proto3" json:"source,omitempty"` Target *Component `protobuf:"bytes,9,opt,name=target,proto3" json:"target,omitempty"` Params map[string]*structpb.Value `` /* 154-byte string literal not displayed */ Values map[string]*structpb.Value `` /* 154-byte string literal not displayed */ ContentType string `protobuf:"bytes,14,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` Content []byte `protobuf:"bytes,15,opt,name=content,proto3" json:"content,omitempty"` // contains filtered or unexported fields }
func CloneToReq ¶
func CloneToResp ¶
func (*Event) AddHeader ¶
func (evt *Event) AddHeader(key, value string) EventWriter
func (*Event) BindStrict ¶
func (*Event) DelHeader ¶
func (evt *Event) DelHeader(key string) EventWriter
func (*Event) DelQuery ¶
func (evt *Event) DelQuery(key string) EventWriter
func (*Event) DelValueMapKey ¶
func (*Event) Descriptor
deprecated
func (*Event) GetCategory ¶
func (*Event) GetContent ¶
func (*Event) GetContentType ¶
func (*Event) GetContext ¶
func (x *Event) GetContext() *EventContext
func (*Event) GetCreateTime ¶
func (*Event) GetParentId ¶
func (*Event) HTTPRequest ¶
func (*Event) HTTPResponse ¶
func (*Event) ProtoMessage ¶
func (*Event) ProtoMessage()
func (*Event) ProtoReflect ¶
func (x *Event) ProtoReflect() protoreflect.Message
func (*Event) SetContext ¶
func (evt *Event) SetContext(evtCtx *EventContext)
func (*Event) SetHTTPRequest ¶
func (*Event) SetHTTPResponse ¶
func (*Event) SetHeader ¶
func (evt *Event) SetHeader(key, value string) EventWriter
func (*Event) SetHeaderV ¶
func (evt *Event) SetHeaderV(key string, value *api.Val) EventWriter
func (*Event) SetParamProto ¶
func (evt *Event) SetParamProto(key string, val *structpb.Value) EventWriter
func (*Event) SetQuery ¶
func (evt *Event) SetQuery(key, value string) EventWriter
func (*Event) SetStatus ¶
func (evt *Event) SetStatus(code int) EventWriter
func (*Event) SetStatusV ¶
func (evt *Event) SetStatusV(val *api.Val) EventWriter
func (*Event) SetTraceFlags ¶
func (*Event) SetTraceId ¶
func (*Event) SetValueMapKey ¶
func (*Event) TraceFlags ¶
func (*Event) TrimPathPrefix ¶
func (evt *Event) TrimPathPrefix(prefix string) EventWriter
func (*Event) ValueMapKey ¶
func (*Event) ValueMapKeyAll ¶
type EventContext ¶
type EventContext struct { Deployment string `protobuf:"bytes,1,opt,name=deployment,proto3" json:"deployment,omitempty"` Environment string `protobuf:"bytes,2,opt,name=environment,proto3" json:"environment,omitempty"` Release string `protobuf:"bytes,3,opt,name=release,proto3" json:"release,omitempty"` // TODO add trace and span? // contains filtered or unexported fields }
func (*EventContext) Descriptor
deprecated
func (*EventContext) Descriptor() ([]byte, []int)
Deprecated: Use EventContext.ProtoReflect.Descriptor instead.
func (*EventContext) GetDeployment ¶
func (x *EventContext) GetDeployment() string
func (*EventContext) GetEnvironment ¶
func (x *EventContext) GetEnvironment() string
func (*EventContext) GetRelease ¶
func (x *EventContext) GetRelease() string
func (*EventContext) IsDeployment ¶
func (ctx *EventContext) IsDeployment() bool
func (*EventContext) IsRelease ¶
func (ctx *EventContext) IsRelease() bool
func (*EventContext) ProtoMessage ¶
func (*EventContext) ProtoMessage()
func (*EventContext) ProtoReflect ¶
func (x *EventContext) ProtoReflect() protoreflect.Message
func (*EventContext) Reset ¶
func (x *EventContext) Reset()
func (*EventContext) String ¶
func (x *EventContext) String() string
type EventPredicate ¶
Takes an Event and returns true or false if rule matches.
type EventReader ¶
type EventReader interface { EventType() api.EventType Param(key string) string ParamV(key string) *api.Val ParamDef(key string, def string) string URL() (*url.URL, error) Query(key string) string QueryV(key string) *api.Val QueryDef(key string, def string) string QueryAll(key string) []string Header(key string) string HeaderV(key string) *api.Val HeaderDef(key string, def string) string HeaderAll(key string) []string Status() int StatusV() *api.Val Bind(v any) error Str() string Bytes() []byte }
type EventWriter ¶
type EventWriter interface { EventReader SetParam(key, value string) EventWriter SetParamV(key string, value *api.Val) EventWriter SetURL(u *url.URL) EventWriter TrimPathPrefix(prefix string) EventWriter SetQuery(key, value string) EventWriter SetQueryV(key string, value *api.Val) EventWriter DelQuery(key string) EventWriter SetHeader(key, value string) EventWriter SetHeaderV(key string, value *api.Val) EventWriter AddHeader(key, value string) EventWriter DelHeader(key string) EventWriter SetStatus(code int) EventWriter SetStatusV(val *api.Val) EventWriter }
type Frame ¶
type Frame uintptr
Frame represents a program counter inside a stack frame. For historical reasons if Frame is interpreted as a uintptr its value represents the program counter + 1.
func (Frame) Format ¶
Format formats the frame according to the fmt.Formatter interface.
%s source file %d source line %n function name %v equivalent to %s:%d
Format accepts flags that alter the printing of some verbs, as follows:
%+s function name and path of source file relative to the compile time GOPATH separated by \n\t (<funcname>\n\t<path>) %+v equivalent to %+s:%d
func (Frame) MarshalText ¶
MarshalText formats a stacktrace Frame as a text string. The output is the same as that of fmt.Sprintf("%+v", f), but without newlines or tabs.
type LimitedReader ¶
Copyright 2009 The Go Authors. All rights reserved. https://cs.opensource.google/go/go/+/refs/tags/go1.20:src/io/io.go;l=456 https://cs.opensource.google/go/go/+/refs/tags/go1.20:LICENSE
LimitedReader reads from R but limits the amount of data returned to just N bytes. Each call to Read updates N to reflect the new amount remaining. Read returns ErrContentTooLarge when N <= 0. This is a variation of io.LimitedReader that returns a different err for exceeding limit and EOF.
type MatchedEvent ¶
type MatchedEvent struct { Event *Event `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"` RouteId int64 `protobuf:"varint,2,opt,name=route_id,json=routeId,proto3" json:"route_id,omitempty"` Env map[string]*structpb.Value `` /* 147-byte string literal not displayed */ // contains filtered or unexported fields }
func (*MatchedEvent) Descriptor
deprecated
func (*MatchedEvent) Descriptor() ([]byte, []int)
Deprecated: Use MatchedEvent.ProtoReflect.Descriptor instead.
func (*MatchedEvent) GetEvent ¶
func (x *MatchedEvent) GetEvent() *Event
func (*MatchedEvent) GetRouteId ¶
func (x *MatchedEvent) GetRouteId() int64
func (*MatchedEvent) ProtoMessage ¶
func (*MatchedEvent) ProtoMessage()
func (*MatchedEvent) ProtoReflect ¶
func (x *MatchedEvent) ProtoReflect() protoreflect.Message
func (*MatchedEvent) Reset ¶
func (x *MatchedEvent) Reset()
func (*MatchedEvent) String ¶
func (x *MatchedEvent) String() string
type Route ¶
type Route struct { api.RouteSpec ResolvedRule string Predicate EventPredicate ParseErr error Component *Component EventContext *EventContext // contains filtered or unexported fields }
type Stack ¶
type Stack []uintptr
Stack represents a Stack of program counters.
func (*Stack) StackTrace ¶
func (s *Stack) StackTrace() StackTrace
type StackTrace ¶
type StackTrace []Frame
StackTrace is stack of Frames from innermost (newest) to outermost (oldest).
func (StackTrace) Format ¶
func (st StackTrace) Format(s fmt.State, verb rune)
Format formats the stack of Frames according to the fmt.Formatter interface.
%s lists source files for each Frame in the stack %v lists the source file and line number for each Frame in the stack
Format accepts flags that alter the printing of some verbs, as follows:
%+v Prints filename, function, and line number for each Frame in the stack.