diff --git a/serve.go b/serve.go index 535986e..1447607 100644 --- a/serve.go +++ b/serve.go @@ -54,6 +54,10 @@ func Serve(ctx context.Context, handlers *types.FaaSHandlers, config *types.FaaS handlers.Info = auth.DecorateWithBasicAuth(handlers.Info, credentials) handlers.Secrets = auth.DecorateWithBasicAuth(handlers.Secrets, credentials) handlers.Logs = auth.DecorateWithBasicAuth(handlers.Logs, credentials) + + if handlers.Telemetry != nil { + handlers.Telemetry = auth.DecorateWithBasicAuth(handlers.Telemetry, credentials) + } } hm := newHttpMetrics() @@ -102,6 +106,10 @@ func Serve(ctx context.Context, handlers *types.FaaSHandlers, config *types.FaaS r.HandleFunc("/healthz", handlers.Health).Methods(http.MethodGet) } + if handlers.Telemetry != nil { + r.HandleFunc("/system/telemetry", hm.InstrumentHandler(handlers.Telemetry, "")).Methods(http.MethodGet) + } + r.HandleFunc("/metrics", promhttp.Handler().ServeHTTP) readTimeout := config.ReadTimeout diff --git a/types/config.go b/types/config.go index 9920bb6..6682173 100644 --- a/types/config.go +++ b/types/config.go @@ -48,6 +48,8 @@ type FaaSHandlers struct { Health http.HandlerFunc Info http.HandlerFunc + + Telemetry http.HandlerFunc } // FaaSConfig set config for HTTP handlers diff --git a/types/function_deployment.go b/types/function_deployment.go index 22b2abd..3c8b291 100644 --- a/types/function_deployment.go +++ b/types/function_deployment.go @@ -48,4 +48,8 @@ type FunctionDeployment struct { type FunctionResources struct { Memory string `json:"memory,omitempty"` CPU string `json:"cpu,omitempty"` + + NvidiaGPU string `json:"nvidia.com/gpu,omitempty"` + AmdGPU string `json:"amd.com/gpu,omitempty"` + IntelGPU string `json:"intel.com/gpu,omitempty"` }