Skip to content

Commit

Permalink
feat: add metric count
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulguptajss committed Jul 21, 2023
1 parent 6d8995c commit fd55c14
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cmd/poller/plugin/changelog/change_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *ChangeLog) Init() error {
}

// Initialize the changeLogMap
c.changeLogMap = make(map[string]*matrix.Matrix)
c.changeLogMap = make(map[string]*matrix.Matrix, 0)

object := c.ParentParams.GetChildS("object")
c.matrixName = object.GetContentS() + "_" + changeLog
Expand Down Expand Up @@ -148,7 +148,7 @@ func (c *ChangeLog) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, er

prevMat := c.previousData
oldInstances := set.New()
prevInstancesUUIDKey := make(map[string]string)
prevInstancesUUIDKey := make(map[string]string, 0)
for key, prevInstance := range prevMat.GetInstances() {
uuid := prevInstance.GetLabel("uuid")
if uuid == "" {
Expand Down Expand Up @@ -185,7 +185,7 @@ func (c *ChangeLog) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, er
key: uuid + "_" + object,
object: object,
op: create,
labels: make(map[string]string),
labels: make(map[string]string, 0),
time: currentTime,
}
c.updateChangeLogLabels(object, instance, change)
Expand All @@ -199,7 +199,7 @@ func (c *ChangeLog) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, er
key: uuid + "_" + object + "_" + currentLabel,
object: object,
op: update,
labels: make(map[string]string),
labels: make(map[string]string, 0),
track: currentLabel,
oldValue: old.Get(currentLabel),
newValue: newLabel,
Expand Down Expand Up @@ -228,7 +228,7 @@ func (c *ChangeLog) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, er
key: uuid + "_" + object,
object: object,
op: del,
labels: make(map[string]string),
labels: make(map[string]string, 0),
time: currentTime,
}
c.updateChangeLogLabels(object, prevInstance, change)
Expand All @@ -254,6 +254,7 @@ func (c *ChangeLog) Run(dataMap map[string]*matrix.Matrix) ([]*matrix.Matrix, er

// reset metric count
c.metricsCount = 0
c.metricsCount = 0

return matricesArray, nil
}
Expand Down

0 comments on commit fd55c14

Please sign in to comment.