metloapi

package
v0.0.0-...-5ad1c36 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MaxConnectTries int = 10
View Source
const MetloDefaultRPS int = 5
View Source
const MetloDefaultRPSLocalProcess int = 20

Variables

This section is empty.

Functions

func ConnectLocalProcessAgent

func ConnectLocalProcessAgent() (pb.MetloIngest_ProcessTraceAsyncClient, error)

func GetHost

func GetHost(req *http.Request) string

func GetPath

func GetPath(req *http.Request) string

func MapMetloTraceToMetloIngestRPC

func MapMetloTraceToMetloIngestRPC(trace MetloTrace) mi.ApiTrace

func ReconnectLocalProcessAgent

func ReconnectLocalProcessAgent() (pb.MetloIngest_ProcessTraceAsyncClient, error)

Types

type Metlo

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

func InitMetlo

func InitMetlo(metloHost string, metloKey string, rps int, localProcess bool) *Metlo

func (*Metlo) Allow

func (m *Metlo) Allow() bool

func (*Metlo) Send

func (m *Metlo) Send(data MetloTrace)

func (*Metlo) SendLocalProcess

func (m *Metlo) SendLocalProcess(data MetloTrace)

type MetloTrace

type MetloTrace struct {
	Request  TraceReq  `json:"request"`
	Response TraceRes  `json:"response"`
	Meta     TraceMeta `json:"meta"`
}

func MapHttpToMetloTrace

func MapHttpToMetloTrace(
	req *http.Request,
	resp *http.Response,
	reqBody string,
	respBody string,
	netFlow gopacket.Flow,
	transferFlow gopacket.Flow,
) (*MetloTrace, error)

type NV

type NV struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type TraceMeta

type TraceMeta struct {
	Environment     string `json:"environment"`
	Incoming        bool   `json:"incoming"`
	Source          string `json:"source"`
	SourcePort      int    `json:"sourcePort"`
	Destination     string `json:"destination"`
	DestinationPort int    `json:"destinationPort"`
	MetloSource     string `json:"metloSource"`
}

type TraceReq

type TraceReq struct {
	Url     TraceUrl `json:"url"`
	Headers []NV     `json:"headers"`
	Body    string   `json:"body"`
	Method  string   `json:"method"`
}

type TraceRes

type TraceRes struct {
	Status  int    `json:"status"`
	Headers []NV   `json:"headers"`
	Body    string `json:"body"`
}

type TraceUrl

type TraceUrl struct {
	Host       string `json:"host"`
	Path       string `json:"path"`
	Parameters []NV   `json:"parameters"`
}

Jump to

Keyboard shortcuts

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