mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 20:16:37 +00:00
Adjust documentation
Allow content-type for UI
This commit is contained in:
@ -30,22 +30,27 @@ func MakeFunctionReader(metricsOptions metrics.MetricOptions, c *client.Client)
|
||||
}
|
||||
|
||||
// TODO: Filter only "faas" functions (via metadata?)
|
||||
functions := make([]requests.Function, 0)
|
||||
var functions []requests.Function
|
||||
|
||||
for _, service := range services {
|
||||
counter, _ := metricsOptions.GatewayFunctionInvocation.GetMetricWithLabelValues(service.Spec.Name)
|
||||
|
||||
// Get the metric's value from ProtoBuf interface (idea via Julius Volz)
|
||||
var protoMetric io_prometheus_client.Metric
|
||||
counter.Write(&protoMetric)
|
||||
invocations := protoMetric.GetCounter().GetValue()
|
||||
if len(service.Spec.TaskTemplate.ContainerSpec.Labels["function"]) > 0 {
|
||||
|
||||
f := requests.Function{
|
||||
Name: service.Spec.Name,
|
||||
Image: service.Spec.TaskTemplate.ContainerSpec.Image,
|
||||
InvocationCount: invocations,
|
||||
Replicas: *service.Spec.Mode.Replicated.Replicas,
|
||||
counter, _ := metricsOptions.GatewayFunctionInvocation.GetMetricWithLabelValues(service.Spec.Name)
|
||||
|
||||
// Get the metric's value from ProtoBuf interface (idea via Julius Volz)
|
||||
var protoMetric io_prometheus_client.Metric
|
||||
counter.Write(&protoMetric)
|
||||
invocations := protoMetric.GetCounter().GetValue()
|
||||
|
||||
f := requests.Function{
|
||||
Name: service.Spec.Name,
|
||||
Image: service.Spec.TaskTemplate.ContainerSpec.Image,
|
||||
InvocationCount: invocations,
|
||||
Replicas: *service.Spec.Mode.Replicated.Replicas,
|
||||
}
|
||||
functions = append(functions, f)
|
||||
}
|
||||
functions = append(functions, f)
|
||||
}
|
||||
|
||||
functionBytes, _ := json.Marshal(functions)
|
||||
|
Reference in New Issue
Block a user