utils

package
v0.0.0-...-7df81f9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeAttributeHashPrefix    = "sh_" // sh stands for scope hash
	ResourceAttributeHashPrefix = "rh_" // rh stands for resource hash
)

Variables

View Source
var DetectSpanProtocolMap = map[AttributeID]model.ProtocolType{
	HTTPIdentifierAttrId: model.ProtocolTypeHTTP,
	DBIdentifierAttrId:   model.ProtocolTypeDB,
	GRPCIdentifierAttrId: model.ProtocolTypeGRPC,
}

DetectSpanProtocolMap Mapping of span attributes to protocol type.

View Source
var NET_HOST_IP = "net.host.ip"
View Source
var NET_PEER_IP = "net.peer.ip"
View Source
var NET_PEER_NAME = "net.peer.name"
View Source
var NET_SOCK_HOST_ADDR = "net.sock.host.addr"
View Source
var NET_SOCK_PEER_ADDR = "net.sock.peer.addr"
View Source
var SERVER_SOCKET_ADDRESS = "server.socket.address"

Functions

func ConvertKVListToMap

func ConvertKVListToMap(attr []*commonv1.KeyValue) map[string]interface{}

func ConvertToIpv4

func ConvertToIpv4(ipStr string) string

func GenerateAttribStoreKey

func GenerateAttribStoreKey(spanDetailsMap map[string]interface{}, protocol ExecutorModel.ProtocolName) cache.AttribStoreKey

func GetExecutorProtocolFromSpanProtocol

func GetExecutorProtocolFromSpanProtocol(spanProtocol model.ProtocolType) zkmodel.ProtocolName

func GetK8sClient

func GetK8sClient() (*kubernetes.Clientset, error)

func GetMD5OfMap

func GetMD5OfMap(m map[string]interface{}) string

func GetPodIP

func GetPodIP(podName string, namespace string) (string, error)

func GetResourceIp

func GetResourceIp(spanKind model.SpanKind, sourceIp string, destIp string) string

func GetSchemaVersion

func GetSchemaVersion(schemaUrl string) string

func GetSchemaVersionFromSpanDetailsMap

func GetSchemaVersionFromSpanDetailsMap(spanDetailsMap map[string]interface{}) string

func GetServiceName

func GetServiceName(resourceAttributesMap map[string]interface{}) string

func GetSourceDestIPPair

func GetSourceDestIPPair(spanKind model.SpanKind, attributes map[string]interface{}, resourceAttrMap map[string]interface{}) (string, string)

func GetSpanAttributeValue

func GetSpanAttributeValue[T string | float64](attrId AttributeID, spanDetailsMap *map[string]interface{}, executorAttrStore *stores.ExecutorAttrStore, functionFactory *functions.FunctionFactory, attribStoreKey *cache.AttribStoreKey) *T

func GetSpanKind

func GetSpanKind(kind tracev1.Span_SpanKind) model.SpanKind

func ObjectToInterfaceMap

func ObjectToInterfaceMap(spanDetails any) map[string]interface{}

Types

type AttributeID

type AttributeID string
const (
	DBIdentifierAttrId AttributeID = "db_identifier"

	DBSystemAttrId   AttributeID = "db_system"
	DBMethodAttrId   AttributeID = ""
	DBRouteAttrId    AttributeID = ""
	DBSchemeAttrId   AttributeID = ""
	DBPathAttrId     AttributeID = ""
	DBQueryAttrId    AttributeID = ""
	DBStatusAttrId   AttributeID = ""
	DBUsernameAttrId AttributeID = ""
)

Ref: https://docs.google.com/spreadsheets/d/1E_MoV1mRL96hdTv2Q0o3pIAQ1hRF3-RQyF56kLagF04/edit#gid=1422911777

const (
	GRPCIdentifierAttrId AttributeID = "rpc_identifier"

	GRPCSystemAttrId   AttributeID = "rpc_system"
	GRPCMethodAttrId   AttributeID = "rpc_method"
	GRPCRouteAttrId    AttributeID = "rpc_service"
	GRPCSchemeAttrId   AttributeID = "rpc_system"
	GRPCPathAttrId     AttributeID = "rpc_service"
	GRPCQueryAttrId    AttributeID = ""
	GRPCStatusAttrId   AttributeID = "rpc_grpc_status_code"
	GRPCUsernameAttrId AttributeID = ""
)

Ref: https://docs.google.com/spreadsheets/d/1E_MoV1mRL96hdTv2Q0o3pIAQ1hRF3-RQyF56kLagF04/edit#gid=1422911777

const (
	HTTPIdentifierAttrId AttributeID = "http_identifier"

	HTTPMethodAttrId   AttributeID = "http_request_method"
	HTTPRouteAttrId    AttributeID = "http_route"
	HTTPSchemeAttrId   AttributeID = "url_scheme"
	HTTPPathAttrId     AttributeID = "url_full"
	HTTPQueryAttrId    AttributeID = ""
	HTTPStatusAttrId   AttributeID = "http_response_status_code"
	HTTPUsernameAttrId AttributeID = ""
)

Ref: https://docs.google.com/spreadsheets/d/1E_MoV1mRL96hdTv2Q0o3pIAQ1hRF3-RQyF56kLagF04/edit#gid=1422911777

type SpanProtocolUtil

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

func NewSpanProtocolUtil

func NewSpanProtocolUtil(spanDetails *model.OTelSpanDetails, spanDetailsMap *map[string]interface{}, executorAttrStore *stores.ExecutorAttrStore, podDetailsStore *stores.LocalCacheHSetStore, attrStoreKey *cache.AttribStoreKey) SpanProtocolUtil

func (SpanProtocolUtil) AddDBSpanProperties

func (s SpanProtocolUtil) AddDBSpanProperties()

func (SpanProtocolUtil) AddGRPCSpanProperties

func (s SpanProtocolUtil) AddGRPCSpanProperties()

func (SpanProtocolUtil) AddHTTPSpanProperties

func (s SpanProtocolUtil) AddHTTPSpanProperties()

func (SpanProtocolUtil) AddSpanProtocolProperties

func (s SpanProtocolUtil) AddSpanProtocolProperties()

func (SpanProtocolUtil) DetectSpanProtocol

func (s SpanProtocolUtil) DetectSpanProtocol() model.ProtocolType

Jump to

Keyboard shortcuts

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