Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show timers distribution on a histogram #3413

Merged

Conversation

mantas-sidlauskas
Copy link
Contributor

@mantas-sidlauskas mantas-sidlauskas commented Jul 28, 2020

What changed?

  • Timers now can be displayed as a histogram. Buckets can defined as custom time format
  • Supports loading data from json file, no need to connect to persistence.
  • Can group data into "day", "hour", "minute" and "second" buckets. Or handcrafted-custom date layout.
  • Added "shard multiplier" to adjust numbers of timers in a bucket.

Why?

How did you test it?

Potential risks

@coveralls
Copy link

coveralls commented Jul 28, 2020

Coverage Status

Coverage decreased (-0.6%) to 67.211% when pulling fe921e5 on mantas-sidlauskas:histograms into 78031ab on uber:master.

h.Add(t.VisibilityTimestamp.Format(hp.timeFormat))
}

if err := h.Print(hp.ctx.Int(FlagShardMultiplier)); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe just return h.Print(hp.ctx.Int(FlagShardMultiplier)) the if does not add anything here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch!

counters []*counter
}

func NewHistorgram() *Histogram {
Copy link
Contributor

Choose a reason for hiding this comment

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

s/NewHistorgram/NewHistogram

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

if len(key) > len(h.maxKey) {
h.maxKey = key
}

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove empty line

func (h *Histogram) Add(key string) {
var found bool
for _, c := range h.counters {

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove empty line

type Printer interface {
Print(timers []*persistence.TimerTaskInfo) error
}
type TimerPrinter struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we call it something else? Initial glance suggests that it might implement Printer interface. While it is an aggregate structure of both loader and printer.

@mantas-sidlauskas mantas-sidlauskas marked this pull request as ready for review July 29, 2020 16:36
@mantas-sidlauskas mantas-sidlauskas merged commit 6c18bc6 into cadence-workflow:master Jul 30, 2020
@mantas-sidlauskas mantas-sidlauskas deleted the histograms branch September 16, 2020 09:41
yux0 pushed a commit to yux0/cadence that referenced this pull request May 4, 2021
* show timers distribution on a histogram

* Add license header

* add convenient time bucket option

* address comments

* rename raw printer to json printer
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.

4 participants