diff --git a/gateway/plugin/external.go b/gateway/plugin/external.go index 872c1b71..08bd9550 100644 --- a/gateway/plugin/external.go +++ b/gateway/plugin/external.go @@ -25,6 +25,9 @@ type ExternalServiceQuery struct { URL url.URL ProxyClient http.Client AuthInjector middleware.AuthInjector + + // IncludeUsage includes usage metrics in the response + IncludeUsage bool } // NewExternalServiceQuery proxies service queries to external plugin via HTTP @@ -49,6 +52,7 @@ func NewExternalServiceQuery(externalURL url.URL, authInjector middleware.AuthIn URL: externalURL, ProxyClient: proxyClient, AuthInjector: authInjector, + IncludeUsage: false, } } @@ -61,7 +65,11 @@ func (s ExternalServiceQuery) GetReplicas(serviceName, serviceNamespace string) function := types.FunctionStatus{} - urlPath := fmt.Sprintf("%ssystem/function/%s?namespace=%s", s.URL.String(), serviceName, serviceNamespace) + urlPath := fmt.Sprintf("%ssystem/function/%s?namespace=%s&usage=%v", + s.URL.String(), + serviceName, + serviceNamespace, + s.IncludeUsage) req, err := http.NewRequest(http.MethodGet, urlPath, nil) if err != nil { diff --git a/gateway/types/handler_set.go b/gateway/types/handler_set.go index 585008e8..0fb51f87 100644 --- a/gateway/types/handler_set.go +++ b/gateway/types/handler_set.go @@ -15,7 +15,9 @@ type HandlerSet struct { // ListFunctions lists all deployed functions in a namespace ListFunctions http.HandlerFunc - Alert http.HandlerFunc + + // Alert handles alerts triggered from AlertManager + Alert http.HandlerFunc // UpdateFunction updates an existing function UpdateFunction http.HandlerFunc