Skip to content

New events client to support Streaming structured events.#3

Closed
renukamanavalan wants to merge 13 commits intomasterfrom
statistics
Closed

New events client to support Streaming structured events.#3
renukamanavalan wants to merge 13 commits intomasterfrom
statistics

Conversation

@renukamanavalan
Copy link
Owner

Refer HLD #954

@renukamanavalan renukamanavalan self-assigned this Aug 5, 2022
// Stats counter
counters map[string]uint64

last_latencies [LATENCT_LIST_SIZE]int64;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not matching spelling on line 30

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update is not reflecting. Let me check

var total uint64 = 0
var cnt int = 0

for _ v := range evtc.last_latencies {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing comma. for _, v

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid one letter var names

cnt++
}
}
evtc.counters[LATENCY] = (int64) (total/cnt/1000/1000)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if last_latencies are all 0, wouldnt this be divide by 0 error?

/* Init current values for cumulative keys and clear for absolute */
for _, key := range STATS_CUMULATIVE_KEYS {
fv, err := rclient.HGetAll(key).Result()
db_counters[key] = fv[STATS_FIELD_NAME]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deal with error case

})

var db_counters map[string]uint64
var wr_counters *map[string]uint64 = NULL;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No semicolon

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uninitialized value is nil by default

db_counters[key] = fv[STATS_FIELD_NAME]
}
for _, key := range STATS_ABSOLUTE_KEYS {
db_counters[key] = 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No semicolon

}
tmp_counters[DROPPED] += evtc.last_errors

if (wr_counters != nil) && !reflect.DeepEqual(tmp_counters, *wr_counters) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some comments for this block of code? When is wr_counters not nil? Is line 157 supposed to be outside of this block?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants