Documentation
¶
Index ¶
- type DB
- func (db *DB) Cleanup(olderThan time.Duration) (int64, error)
- func (db *DB) Close() error
- func (db *DB) GetLogs(filter *TrafficFilter) ([]TrafficLog, int, error)
- func (db *DB) GetStats(deploymentName string, since time.Duration) (*TrafficStats, error)
- func (db *DB) GetUnknownDomainStats(knownDeployments []string, since time.Duration) (*UnknownDomainStats, error)
- func (db *DB) InsertLog(log *TrafficLog) (int64, error)
- func (db *DB) REDSeries(deploymentName string, since time.Time, bucket time.Duration) ([]REDPoint, error)
- type DeploymentTrafficStats
- type HourlyStats
- type IPTrafficStats
- type IngestTrafficLog
- type Manager
- func (m *Manager) Cleanup(days int) (int64, error)
- func (m *Manager) Close() error
- func (m *Manager) GetLogs(filter *TrafficFilter) ([]TrafficLog, int, error)
- func (m *Manager) GetREDSeries(deploymentName string, since time.Duration) ([]REDPoint, error)
- func (m *Manager) GetStats(deploymentName string, since time.Duration) (*TrafficStats, error)
- func (m *Manager) GetUnknownDomainStats(knownDeployments []string, since time.Duration) (*UnknownDomainStats, error)
- func (m *Manager) IngestLog(ingest *IngestTrafficLog) (*TrafficLog, error)
- type PathStats
- type REDPoint
- type TrafficFilter
- type TrafficLog
- type TrafficStats
- type UnknownDomainEntry
- type UnknownDomainIPEntry
- type UnknownDomainStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) GetLogs ¶
func (db *DB) GetLogs(filter *TrafficFilter) ([]TrafficLog, int, error)
func (*DB) GetUnknownDomainStats ¶
func (*DB) REDSeries ¶
func (db *DB) REDSeries(deploymentName string, since time.Time, bucket time.Duration) ([]REDPoint, error)
REDSeries returns a deployment's request rate, error rate and latency over time, bucketed.
Every deployment's traffic crosses FlatRun's proxy, and the proxy already reports each request here, so this is instrumentation of an application that was never asked to cooperate: no agent in the container, no change to the app.
An empty deployment name covers every deployment at once.
type DeploymentTrafficStats ¶
type DeploymentTrafficStats struct {
Name string `json:"name"`
TotalRequests int64 `json:"total_requests"`
AvgResponseTime float64 `json:"avg_response_time_ms"`
ErrorRate float64 `json:"error_rate"`
Status2xx int64 `json:"status_2xx"`
Status3xx int64 `json:"status_3xx"`
Status4xx int64 `json:"status_4xx"`
Status5xx int64 `json:"status_5xx"`
}
type HourlyStats ¶
type IPTrafficStats ¶
type IngestTrafficLog ¶
type IngestTrafficLog struct {
DeploymentName string `json:"deployment_name"`
RequestPath string `json:"request_path"`
RequestMethod string `json:"request_method"`
StatusCode int `json:"status_code"`
SourceIP string `json:"source_ip"`
ResponseTimeMs int `json:"response_time_ms"`
BytesSent int `json:"bytes_sent"`
RequestLength int `json:"request_length"`
UpstreamTimeMs *int `json:"upstream_time_ms,omitempty"`
Timestamp int64 `json:"timestamp"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) GetLogs ¶
func (m *Manager) GetLogs(filter *TrafficFilter) ([]TrafficLog, int, error)
func (*Manager) GetREDSeries ¶
GetREDSeries returns a deployment's request rate, error rate and latency over time. The bucket is chosen from the window so a chart gets a useful number of points rather than one per second over a day.
func (*Manager) GetUnknownDomainStats ¶
func (*Manager) IngestLog ¶
func (m *Manager) IngestLog(ingest *IngestTrafficLog) (*TrafficLog, error)
type REDPoint ¶
type REDPoint struct {
Time time.Time `json:"time"`
Requests int64 `json:"requests"`
Errors int64 `json:"errors"`
AvgTimeMs float64 `json:"avg_time_ms"`
P95TimeMs float64 `json:"p95_time_ms"`
}
REDPoint is one time bucket of a deployment's request behaviour: how many requests, how many failed, and how long they took.
type TrafficFilter ¶
type TrafficLog ¶
type TrafficLog struct {
ID int64 `json:"id"`
DeploymentName string `json:"deployment_name"`
RequestPath string `json:"request_path"`
RequestMethod string `json:"request_method"`
StatusCode int `json:"status_code"`
SourceIP string `json:"source_ip"`
ResponseTimeMs int `json:"response_time_ms"`
BytesSent int `json:"bytes_sent"`
RequestLength int `json:"request_length"`
UpstreamTimeMs *int `json:"upstream_time_ms,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type TrafficStats ¶
type TrafficStats struct {
TotalRequests int64 `json:"total_requests"`
TotalBytes int64 `json:"total_bytes"`
AvgResponseTimeMs float64 `json:"avg_response_time_ms"`
ByStatusGroup map[string]int64 `json:"by_status_group"`
ByDeployment map[string]int64 `json:"by_deployment"`
ByMethod map[string]int64 `json:"by_method"`
TopPaths []PathStats `json:"top_paths"`
TopIPs []IPTrafficStats `json:"top_ips"`
RequestsPerHour []HourlyStats `json:"requests_per_hour"`
DeploymentStats []DeploymentTrafficStats `json:"deployment_stats"`
}
type UnknownDomainEntry ¶
type UnknownDomainIPEntry ¶
type UnknownDomainStats ¶
type UnknownDomainStats struct {
TotalRequests int64 `json:"total_requests"`
TopDomains []UnknownDomainEntry `json:"top_domains"`
TopIPs []UnknownDomainIPEntry `json:"top_ips"`
RecentLogs []TrafficLog `json:"recent_logs"`
}