Documentation
¶
Index ¶
- func AvgServicesLatenciesCSV(ctx context.Context, w io.Writer, db Storage) error
- func ConsumerReportCSV(ctx context.Context, w io.Writer, db Storage, id string) error
- func InsertBatch(ctx context.Context, db Storage, r io.Reader) error
- func ServiceReportCSV(ctx context.Context, w io.Writer, db Storage, id string) error
- func ValidRecord(r *Record) error
- type AuthenticatedEntity
- type Latencies
- type Record
- type ReportRow
- type Request
- type RequestHeaders
- type Response
- type ResponseHeaders
- type Route
- type RouteService
- type Service
- type ServiceLatencies
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvgServicesLatenciesCSV ¶
AvgServicesLatenciesCSV generates a CSV latencies report of all services.
func ConsumerReportCSV ¶
ConsumerReportCSV generates a CSV requests report of a consumer with ID id.
func InsertBatch ¶
InsertBatch inserts a stream of log Records into the db Storage. The insertion is made in batches.
func ServiceReportCSV ¶
ServiceReportCSV generates a CSV requets report of a service with ID id.
Types ¶
type AuthenticatedEntity ¶
type AuthenticatedEntity struct {
ConsumerID struct {
UUID string `json:"uuid"`
} `json:"consumer_id"`
}
type Record ¶
type Record struct {
Request Request `json:"request"`
UpstreamURI string `json:"upstream_uri"`
Response Response `json:"response"`
AuthenticatedEntity AuthenticatedEntity `json:"authenticated_entity"`
Route Route `json:"route"`
Service Service `json:"service"`
Latencies Latencies `json:"latencies"`
ClientIP string `json:"client_ip"`
StartedAt int64 `json:"started_at"`
}
Record stores log information.
type ReportRow ¶
type ReportRow struct {
ID int64
ConsumerID string
UpstreamURI string
ResponseID string
RequestID string
RouteID string
ServiceID string
ProxyLatency int64
GatewayLatency int64
RequestLatency int64
ClientIP string
StartedAt time.Time
RspStatus int64
RspSize int64
RspContentLength int64
RspVia string
RspConnection string
RspAccessControlAllowCredentials string
RspAccessControlAllowOrigin string
RspContentType string
RspServer string
ReqMethod string
ReqURI string
ReqURL string
ReqSize int64
ReqQuerystring string
ReqHeaderAccept string
ReqHeaderHost string
ReqUserAgent string
}
ReportRow stores information about requests and it's response.
type RequestHeaders ¶
type Response ¶
type Response struct {
Status int64 `json:"status"`
Size int `json:"size"`
Headers ResponseHeaders `json:"headers"`
}
type ResponseHeaders ¶
type ResponseHeaders struct {
ContentLength string `json:"Content-Length"`
Via string `json:"via"`
Connection string `json:"Connection"`
AccessControlAllowCredentials string `json:"access-control-allow-credentials"`
ContentType string `json:"Content-Type"`
Server string `json:"server"`
AccessControlAllowOrigin string `json:"access-control-allow-origin"`
}
type Route ¶
type Route struct {
CreatedAt int64 `json:"created_at"`
Hosts string `json:"hosts"`
ID string `json:"id"`
Methods []string `json:"methods"`
Paths []string `json:"paths"`
PreserveHost bool `json:"preserve_host"`
Protocols []string `json:"protocols"`
RegexPriority int64 `json:"regex_priority"`
Service RouteService `json:"service"`
StripPath bool `json:"strip_path"`
UpdatedAt int64 `json:"updated_at"`
}
type RouteService ¶
type RouteService struct {
ID string `json:"id"`
}
type Service ¶
type Service struct {
ConnectTimeout int64 `json:"connect_timeout"`
CreatedAt int64 `json:"created_at"`
Host string `json:"host"`
ID string `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Port int64 `json:"port"`
Protocol string `json:"protocol"`
ReadTimeout int64 `json:"read_timeout"`
Retries int64 `json:"retries"`
UpdatedAt int64 `json:"updated_at"`
WriteTimeout int64 `json:"write_timeout"`
}
type ServiceLatencies ¶
ServiceLatencies reports the proxy, request and gateway latencies of each service.
type Storage ¶
type Storage interface {
// InserRecord inserts the Record into the Storage.
InsertRecord(context.Context, *Record) error
// InserRecordBatch inserts a batch of Records into the Storage.
InsertRecordBatch(context.Context, []Record) error
// AverageServicesLatencies returns the latencies of all services.
AverageServicesLatencies(context.Context) ([]ServiceLatencies, error)
// ConsumerReport returns information about the specified consumer's
// requests.
ConsumerReport(ctx context.Context, id string) ([]ReportRow, error)
// ServiceReport returns information about the specified service's
// requests.
ServiceReport(ctx context.Context, id string) ([]ReportRow, error)
}
Storage is used to persist data, usually a database.
Click to show internal directories.
Click to hide internal directories.