logger

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	LoggerWorkerQueueSize = 100
	CloudEventsIdHeader   = "Ce-Id"
)
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"
	//endpoint would be either default or canary
	EndpointAttr = "endpoint"
)

Variables

A buffered channel that we can send work requests on.

View Source
var WorkerQueue chan chan LogRequest

Functions

func New

func New(log logr.Logger, svcHost string, svcPort string, logUrl *url.URL, sourceUri *url.URL, logMode v1alpha2.LoggerMode, inferenceService string, namespace string, endpoint string) http.Handler

func QueueLogRequest

func QueueLogRequest(req LogRequest) error

func StartDispatcher

func StartDispatcher(nworkers int, log logr.Logger)

Types

type LogRequest

type LogRequest struct {
	Url              *url.URL
	Bytes            *[]byte
	ContentType      string
	ReqType          LogRequestType
	Id               string
	SourceUri        *url.URL
	InferenceService string
	Namespace        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         logr.Logger
	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, log logr.Logger) 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