This patch adds a simple go benchmark test, injecting Kubernetes objects
and simulating scrape requests. It uses the Kubernetes client-go fake
client. Alongside comes some refactoring of each collectors structure
using informer factories to be compatible with the fake client.
The patch lays the groundwork to make future performance optimizations
comparable with past versions.
How to run test:
`go test -race -bench . -memprofile=mem.out -cpuprofile=cpu.out`
This commit reworks node metrics in the same manner as deployment
metrics.
The node states are broken out into one time series for each possible
conditional state. One constant metric holds textual meta information
about cluster nodes.
* Rework container restart metric
This commit reworks the container restart metric in the same manner as
deployment metrics. The format remains unchanged to the previous format
as in one metric per container via labels.
* Normalize expected string representation
To be able to compare strings easier when a failure occurs, remove empty
lines and trim whitespace for each line of the expected metrics string.
* Update prometheus client vendoring
* Rework deployment metrics
This change extracts the deployment metrics into their own
deployment collector. The metrics are collected synchronously with
each scrape rather than every 10 seconds.
The `deployment` label replaces the `name` label to avoid name
collisions further up in the monitoring chain.