parsers

package
v0.1.8-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogKeyUpstreamResponseTime            = "upstream_response_time"
	LogKeyUpstreamResponseTimeReplacement = "upstream_response_time_float"
	LogKeyUpstreamResponseTimeTotal       = "upstream_response_time_total"
	LogKeyHost                            = "host"
	LogKeyRequestMethod                   = "request_method"
	LogKeyRequestURI                      = "request_uri"
	LogKeyRequestTime                     = "request_time"
	LogKeyStatus                          = "status"
	LogKeyUpstreamPodName                 = "upstream_pod_name"
)

Nginx related particular log keys

View Source
const (
	LogKeySLA     = "sla"
	LogKeyLogging = "logging"
)

Processing control related fields

View Source
const (
	LogKeyTime   = "time"
	LogKeyStream = "stream"
)

ContainerD related constants

View Source
const LogKeyLog = "log"

LogKeyLog field that contains actual user log in log line.

Variables

View Source
var (
	ErrLogFieldMissing   = errors.New("line does not contain user log field")
	ErrLogFieldNotString = errors.New("user log field does not contain string")
)
View Source
var ErrConstructSLI = errors.New(
	"Empty or incorrect field 'request' in message, " +
		"field 'request' should contain method and path",
)

ErrConstructSLI signals about failed SLA Message construction

Functions

func CreateParserContainerDFormat

func CreateParserContainerDFormat(config configuration.ParserConfig) func(line []byte) (common.EntryMap, error)

CreateParserContainerDFormat returns containerd parser

func CreateParserDockerFormat

func CreateParserDockerFormat(config configuration.ParserConfig) func(line []byte) (common.EntryMap, error)

func CreateParserPlain

func CreateParserPlain(config configuration.ParserConfig) func(line []byte) common.EntryMap

Types

type MetricsCollector

type MetricsCollector interface {
	IncrementHTTPRequestCount(podName, method, service, path string, status int)
	IncrementHTTPRequestsTotalCount(service string)
	ObserveHTTPRequestTime(podName, method, service, path string, value float64)
	ObserveHTTPUpstreamResponseTimeTotal(podName, method, service, path string, value float64)
}

type SLI

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

SLI parser modifies metrics according to data received from serviceProvider

func NewParserSLI

func NewParserSLI(provider ServiceProvider, collector MetricsCollector) *SLI

NewParserSLI is a constructor for ParserSLI

func (*SLI) Parse

func (parser *SLI) Parse(entryMap common.EntryMap)

Parse is an interface function to process EntryMap by convention

type SLIMessage

type SLIMessage struct {
	Host    string
	PodName string

	// HTTP request related fields
	Method                    string
	URI                       string
	Status                    int
	RequestTime               float64
	UpstreamResponseTimeTotal *float64
}

SLIMessage is a structure for storage the parsed message from MQ

type SLIStub

type SLIStub struct{}

SLIStub is stub for testing purposes

func NewParserSliStub

func NewParserSliStub() *SLIStub

NewParserSliStub is a constructor for SLIStub

func (*SLIStub) Parse

func (parser *SLIStub) Parse(_ common.EntryMap)

Parse does nothing, stub

type ServiceProvider

type ServiceProvider interface {
	GetServiceByHost(string) *k8s.Service
}

Jump to

Keyboard shortcuts

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