Documentation ¶
Index ¶
- Constants
- Variables
- func CrossTypeCompare(a interface{}, b interface{}) (int, error)
- func CrossTypeEqual(a interface{}, b interface{}) bool
- func GetField(obj map[string]interface{}, k string) (interface{}, error)
- func IPToString(ip net.IP) string
- func IPv6Supported() bool
- func IsCaptureAllowed(nodeType string) bool
- func JSONDecode(r io.Reader, i interface{}) error
- func MaxInt64(a, b int64) int64
- func MinInt64(a, b int64) int64
- func Retry(fnc func() error, try int, delay time.Duration) error
- func SetField(obj map[string]interface{}, k string, v interface{}) bool
- func SetupTLSClientConfig(certPEM string, keyPEM string) *tls.Config
- func SetupTLSLoadCertificate(certPEM string) *x509.CertPool
- func SetupTLSServerConfig(certPEM string, keyPEM string) *tls.Config
- func ToFloat64(f interface{}) (float64, error)
- func ToInt64(i interface{}) (int64, error)
- func UnixMillis(t time.Time) int64
- type CaptureType
- type Iterator
- type Metric
- type NetNSContext
- type PortAllocator
- type RawSocket
- type ServiceAddress
- type ServiceType
- type SortOrder
- type TimeSlice
- type TimedMetric
Constants ¶
const ( // StoppedState service stopped StoppedState = iota + 1 // RunningState service running RunningState // StoppingState service stopping StoppingState )
Variables ¶
var ( // ErrInvalidPortRange invalid port range ErrInvalidPortRange = errors.New("Invalid port range") // ErrNoPortLeft no port left in the range ErrNoPortLeft = errors.New("No free port left") )
var ( // ErrCantCompareInterface error can't compare inteface ErrCantCompareInterface = errors.New("Can't compare interface") // ErrFieldNotFound error field not found ErrFieldNotFound = errors.New("Field not found") // ErrFieldWrongType error field has wrong type ErrFieldWrongType = errors.New("Field has wrong type") )
var ( // CaptureTypes contain all registred capture type and associated probes CaptureTypes = map[string]CaptureType{} )
Functions ¶
func CrossTypeCompare ¶
CrossTypeCompare compare 2 differents number types like Float64 vs Float32
func CrossTypeEqual ¶
func CrossTypeEqual(a interface{}, b interface{}) bool
CrossTypeEqual compare 2 differents number types
func IPv6Supported ¶
func IPv6Supported() bool
IPv6Supported returns true if the platform support IPv6
func IsCaptureAllowed ¶
IsCaptureAllowed returns true if the node capture type exist
func JSONDecode ¶
JSONDecode wrapper to UseNumber during JSON decoding
func Retry ¶
Retry tries to execute the given function until a success applying a delay between each try
func SetupTLSClientConfig ¶
SetupTLSClientConfig creates a client X509 certificate from public and private key
func SetupTLSLoadCertificate ¶
SetupTLSLoadCertificate creates a X509 certificate from file
func SetupTLSServerConfig ¶
SetupTLSServerConfig creates a server X509 certificate from public and private key
func UnixMillis ¶
UnixMillis returns the current time in miliseconds
Types ¶
type CaptureType ¶
CaptureType describes a list of allowed and default captures probes
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator describes a int64 iterator
func NewIterator ¶
NewIterator creates a new iterator based on (at, from, to) parameters
type NetNSContext ¶
type NetNSContext struct {
// contains filtered or unexported fields
}
NetNSContext describes a NameSpace Context switch API
func NewNetNsContext ¶
func NewNetNsContext(path string) (*NetNSContext, error)
NewNetNsContext creates a new NameSpace context base on path
func (*NetNSContext) Quit ¶
func (n *NetNSContext) Quit() error
Quit the NameSpace and go back to the original one
type PortAllocator ¶
PortAllocator describes a threads safe port list that can be allocated
func NewPortAllocator ¶
func NewPortAllocator(min, max int) (*PortAllocator, error)
NewPortAllocator creates a new port allocator range
func (*PortAllocator) Allocate ¶
func (p *PortAllocator) Allocate() (int, error)
Allocate returns a new unused port between min and max ports
func (*PortAllocator) Set ¶
func (p *PortAllocator) Set(i int, obj interface{}) error
Set associate an object to the port map
type RawSocket ¶
type RawSocket struct {
// contains filtered or unexported fields
}
RawSocket describes a raw socket C implemenation
func NewRawSocket ¶
NewRawSocket creates a raw socket for the network interface ifName
func NewRawSocketInNs ¶
NewRawSocketInNs create/open a socket in the namespace nsPath for the network interface ifName
type ServiceAddress ¶
ServiceAddress describes the service listening address and port
func ServiceAddressFromString ¶
func ServiceAddressFromString(addressPort string) (ServiceAddress, error)
ServiceAddressFromString returns a service address from a string, could be IPv4 or IPv6
type ServiceType ¶
type ServiceType string
ServiceType describes the service type (analyzer or agent)
const ( // AnalyzerService analyzer AnalyzerService ServiceType = "analyzer" // AgentService agent AgentService ServiceType = "agent" )
func (ServiceType) String ¶
func (st ServiceType) String() string
type TimeSlice ¶
TimeSlice defines a time boudary values
func NewTimeSlice ¶
NewTimeSlice creates a new TimeSlice based on Start and Last
type TimedMetric ¶
TimedMetric defines Metric during a time slice
func (*TimedMetric) GetFieldInt64 ¶
func (tm *TimedMetric) GetFieldInt64(field string) (int64, error)
GetFieldInt64 returns the field value
func (*TimedMetric) MarshalJSON ¶
func (tm *TimedMetric) MarshalJSON() ([]byte, error)
MarshalJSON serialized a TimedMetric in JSON