metrics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsNamespace       = "copilot"
	MetricsSubsystemSystem = "system"
	MetricsSubsystemHTTP   = "http"
	MetricsSubsystemAPI    = "api"
	MetricsSubsystemLLM    = "llm"

	MetricsCloudInstallationLabel = "installationId"
	MetricsVersionLabel           = "version"
)

Variables

This section is empty.

Functions

func NewMetricsHandler

func NewMetricsHandler(metricsService Metrics) http.Handler

NewMetricsHandler creates an HTTP handler to expose metrics.

Types

type ErrorLoggerWrapper

type ErrorLoggerWrapper struct {
}

func (*ErrorLoggerWrapper) Println

func (el *ErrorLoggerWrapper) Println(v ...interface{})

type InstanceInfo

type InstanceInfo struct {
	InstallationID      string
	ConnectedUsersLimit int
	PluginVersion       string
}

type LLMetrics

type LLMetrics interface {
	IncrementLLMRequests()
}

type Metrics

type Metrics interface {
	GetRegistry() *prometheus.Registry

	ObserveAPIEndpointDuration(handler, method, statusCode string, elapsed float64)

	IncrementHTTPRequests()
	IncrementHTTPErrors()

	GetMetricsForAIService(llmName string) *llmMetrics
}

func NewMetrics

func NewMetrics(info InstanceInfo) Metrics

NewMetrics Factory method to create a new metrics collector.

type Server

type Server struct {
	*http.Server
}

Service prometheus to run the server.

func (*Server) Run

func (h *Server) Run() error

Run will start the prometheus server.

func (*Server) Shutdown

func (h *Server) Shutdown() error

Shutdown will shut down the prometheus server.

Jump to

Keyboard shortcuts

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