logger

package
v0.8.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CEInferenceRequest  = "org.kubeflow.serving.inference.request"
	CEInferenceResponse = "org.kubeflow.serving.inference.response"

	// cloud events extension attributes have to be lowercase alphanumeric
	//TODO: ideally request id would have its own header but make do with ce-id for now
	InferenceServiceAttr = "inferenceservicename"
	NamespaceAttr        = "namespace"
	ComponentAttr        = "component"
	//endpoint would be either default or canary
	EndpointAttr = "endpoint"

	LoggerWorkerQueueSize = 100
	CloudEventsIdHeader   = "Ce-Id"
)

Variables

A buffered channel that we can send work requests on.

View Source
var WorkerQueue chan chan LogRequest

Functions

func New

func New(logUrl *url.URL, sourceUri *url.URL, logMode v1beta1.LoggerType,
	inferenceService string, namespace string, endpoint string, component string, next http.Handler) http.Handler

func QueueLogRequest

func QueueLogRequest(req LogRequest) error

func StartDispatcher

func StartDispatcher(nworkers int, logger *zap.SugaredLogger)

Types

type LogRequest

type LogRequest struct {
	Url              *url.URL
	Bytes            *[]byte
	ContentType      string
	ReqType          LogRequestType
	Id               string
	SourceUri        *url.URL
	InferenceService string
	Namespace        string
	Component        string
	Endpoint         string
}

type LogRequestType

type LogRequestType string
const (
	InferenceRequest  LogRequestType = "Request"
	InferenceResponse LogRequestType = "Response"
)

type LoggerHandler

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

func (*LoggerHandler) ServeHTTP

func (eh *LoggerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

call svc and add send request/responses to logUrl

type Worker

type Worker struct {
	Log         *zap.SugaredLogger
	ID          int
	Work        chan LogRequest
	WorkerQueue chan chan LogRequest
	QuitChan    chan bool
	Client      http.Client
	CeCtx       context.Context
	CeTransport transport.Transport
}

func NewWorker

func NewWorker(id int, workerQueue chan chan LogRequest, logger *zap.SugaredLogger) Worker

NewWorker creates, and returns a new Worker object. Its only argument is a channel that the worker can add itself to whenever it is done its work.

func (*Worker) Start

func (w *Worker) Start()

This function "starts" the worker by starting a goroutine, that is an infinite "for-select" loop.

func (*Worker) Stop

func (w *Worker) Stop()

Stop tells the worker to stop listening for work requests.

Note that the worker will only stop *after* it has finished its work.

Jump to

Keyboard shortcuts

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