mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
2765ab166d
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
33 lines
771 B
Go
33 lines
771 B
Go
package metrics
|
|
|
|
type Recorder interface {
|
|
Record(clientQueryOperation ClientQueryOperation)
|
|
}
|
|
|
|
type clientQueryRecorder struct {
|
|
manager MetricsConfigManager
|
|
ns string
|
|
kind string
|
|
client ClientType
|
|
}
|
|
|
|
func NamespacedClientQueryRecorder(m MetricsConfigManager, ns, kind string, client ClientType) Recorder {
|
|
return &clientQueryRecorder{
|
|
manager: m,
|
|
ns: ns,
|
|
kind: kind,
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
func ClusteredClientQueryRecorder(m MetricsConfigManager, kind string, client ClientType) Recorder {
|
|
return &clientQueryRecorder{
|
|
manager: m,
|
|
kind: kind,
|
|
client: client,
|
|
}
|
|
}
|
|
|
|
func (r *clientQueryRecorder) Record(clientQueryOperation ClientQueryOperation) {
|
|
r.manager.RecordClientQueries(clientQueryOperation, r.client, r.kind, r.ns)
|
|
}
|