feat: ingress metrics query apis

Signed-off-by: Roland.Ma <rolandma@yunify.com>
This commit is contained in:
Roland.Ma
2021-09-10 02:13:22 +00:00
parent b0506c35a4
commit 1ee5e49ac0
11 changed files with 228 additions and 0 deletions

View File

@@ -37,6 +37,7 @@ const (
LevelContainer
LevelPVC
LevelComponent
LevelIngress
)
var MeteringLevelMap = map[string]int{
@@ -81,6 +82,8 @@ type QueryOptions struct {
PVCFilter string
ApplicationName string
ServiceName string
Ingress string
Job string
MeterOptions *Meteroptions
}
@@ -287,6 +290,29 @@ func (po PVCOption) Apply(o *QueryOptions) {
o.PVCFilter = po.PersistentVolumeClaimName
}
type IngressOption struct {
ResourceFilter string
NamespaceName string
Ingress string
Job string
Pod string
Step *time.Duration
}
func (no IngressOption) Apply(o *QueryOptions) {
o.Level = LevelIngress
o.ResourceFilter = no.ResourceFilter
o.NamespaceName = no.NamespaceName
o.Ingress = no.Ingress
o.Job = no.Job
o.PodName = no.Pod
if no.Step != nil {
o.MeterOptions = &Meteroptions{
Step: *no.Step,
}
}
}
type ComponentOption struct{}
func (_ ComponentOption) Apply(o *QueryOptions) {