mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
34 lines
771 B
Go
34 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)
|
||
|
}
|