Adds a new metric-config option named `rawQuery`. The value of
this option will be appended to the metric `path` as URL query
parameters to be used by the pod's application. E.g.,:
```
metric-config.pods.requests-per-second.json-path/rawQuery: "foo=bar&baz=bop"
```
will apppend `?foo=bar&baz=bop` to the URL.
Signed-off-by: Abe Friesen <2319792+doyshinda@users.noreply.github.com>
* This is the initial implementation of support for JSONPath expressions
that return arrays of values instead of a single value.
This extends the
collector to define a few handy reducer functions that take in the slice
of float64 and return a single value. It also allows the user to define
which reducer function to use via the
"metric-config.<metricType>.<metricName>.json-path/reducer-func"
annotation, which
can have the values of 'avg', 'min', 'max' and 'sum'.
For instance, the Ruby puma webserver exposes metrics of the form of $.worker_status[*].last_status.pool_capacity that have to be consumed as an array of values to be properly targetted.
Signed-off-by: Tomás Pinho <me@tomaspinho.com>
* Renames "reducerFunc" to "aggregator" for consistency with other
collectors. Renames the annotation from
"metric-config.<metricType>.<metricName>.json-path/reducer-func" to "metric-config.<metricType>.<metricName>.json-path/aggregator".
Signed-off-by: Tomás Pinho <me@tomaspinho.com>
* Return error instead of defaulting to the avg aggregator, when no valid
aggregator name was specified and the JSONPath value is a slice of
numbers.
Signed-off-by: Tomás Pinho <me@tomaspinho.com>
* Fix index out of range on initialized output slice that was found while
writing tests.
Signed-off-by: Tomás Pinho <me@tomaspinho.com>
* Add tests for all added functions + NewJSONPathMetricsGetter
Signed-off-by: Tomás Pinho <me@tomaspinho.com>
* Add documentation on the `aggregator` option.
Signed-off-by: Tomás Pinho <me@tomaspinho.com>
* reducer function -> aggregator function
Signed-off-by: Tomás Pinho <me@tomaspinho.com>
* Fix comment to account for returned error.
Signed-off-by: Tomás Pinho <me@tomaspinho.com>
This adds support for `averageValue` for the `request-per-second` metric
based on Ingress Objects. This is only supported from Kubernetes
`>=v1.14` (https://github.com/kubernetes/kubernetes/pull/72872).
When defining the HPA with `autoscaling/v2beta1` you still need to
define `targetValue` even though it won't be used when `averageValue` is
set. Once we default to `autoscaling/v2beta2` this akward API will be
gone.
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
* Added weighting of rps metrics based on backend weights
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
* Updated documented with instructions on how to use the backend weighting
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
* Changed separator for RPS metric and added flag to specify backend weights annotation.
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
* Allow for multiple backends with for weighting.
Signed-off-by: Arjun Naik <arjun.rn@gmail.com>
* Adding test coverage through coverall
Adding test coverage through coverall so we can see the current state of
test coverage
Signed-off-by: Muhammad Muaaz Saleem <muhammad.muaaz.saleem@zalando.de>
* Fix go.sum for go 1.11.2
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
* Trying to make travis use go 1.11.2
Since go.mod and go.sum files don't seem to be compatible between
go1.11.1, trying to make travis use go 1.11.2
Signed-off-by: Muhammad Muaaz Saleem <muhammad.muaaz.saleem@zalando.de>