Migrate to Go 1.18 and update dependencies

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2022-08-04 15:53:40 +01:00
committed by Alex Ellis
parent 2e14a34243
commit b87b96ae45
219 changed files with 15095 additions and 16950 deletions

View File

@ -63,19 +63,19 @@ type FunctionStatus struct {
// data store for when the function or its container was created.
CreatedAt time.Time `json:"createdAt,omitempty"`
// Utilisation represents CPU and RAM used by all of the
// Usage represents CPU and RAM used by all of the
// functions' replicas. Divide by AvailableReplicas for an
// average value per replica.
Utilisation FunctionUtilisation `json:"usage,omitempty"`
Usage *FunctionUsage `json:"usage,omitempty"`
}
// FunctionUtilisation represents CPU and RAM used by all of the
// FunctionUsage represents CPU and RAM used by all of the
// functions' replicas.
//
// CPU is measured in seconds consumed since the last measurement
// RAM is measured in total bytes consumed
//
type FunctionUtilisation struct {
type FunctionUsage struct {
// CPU is the increase in CPU usage since the last measurement
// equivalent to Kubernetes' concept of millicores.
CPU float64 `json:"cpu,omitempty"`

View File

@ -2,7 +2,6 @@ package handler
import (
"encoding/json"
"fmt"
"log"
"sync"
"time"
@ -33,7 +32,13 @@ type NATSQueue struct {
// Queue request for processing
func (q *NATSQueue) Queue(req *ftypes.QueueRequest) error {
fmt.Printf("NatsQueue - submitting request: %s.\n", req.Function)
callId := ""
if v := req.Header.Get("X-Call-Id"); len(v) > 0 {
callId = v
}
log.Printf("[%s] Queueing (%d) bytes for: %s.\n", callId, len(req.Body), req.Function)
out, err := json.Marshal(req)
if err != nil {