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

[Do not merge]Consume latest tally #334

Merged
merged 3 commits into from
Mar 8, 2017
Merged

[Do not merge]Consume latest tally #334

merged 3 commits into from
Mar 8, 2017

Conversation

ghost
Copy link

@ghost ghost commented Feb 24, 2017

Tally introduced histograms to their interfaces and changed constructor for a scope, which requires us to implement it for NopReported and update some tests.

Will not merge, until migrate internal tools to the new tally version.

@mention-bot
Copy link

@alsamylkin, thanks for your PR! By analyzing the history of the files in this pull request, we identified @sectioneight, @madhuravi and @glibsm to be potential reviewers.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 90.72% when pulling c688d03 on updateTally into 6b9a93d on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.751% when pulling c688d03 on updateTally into 6b9a93d on master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 90.751% when pulling c688d03 on updateTally into 6b9a93d on master.

Copy link
Contributor

@ascandella ascandella left a comment

Choose a reason for hiding this comment

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

lgtm, would like a once-over from @glibsm or somebody else familiar with our tally stuff

@@ -99,3 +103,30 @@ type nopCachedTimer struct {

func (nopCachedTimer) ReportTimer(interval time.Duration) {
}

// NopCachedHistogram is an implementation of tally.CachedHistogram
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe mention this is exported for testing?

Copy link
Author

Choose a reason for hiding this comment

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

Should we do this everywhere in this file? I'd prefer that, but not sure, if it will confuse reviewers.

// NopCachedHistogram is an implementation of tally.CachedHistogram
var NopCachedHistogram tally.CachedHistogram = nopCachedHistogram{}

type nopCachedHistogram struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

style nit: empty struct on a single line generally, right? or are we doing differerently:

type nopCachedHistogram struct{}

Copy link
Author

Choose a reason for hiding this comment

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

Well, I was following the leader(couple lines above) :)

}

func (nopCachedHistogram) ValueBucket(
bucketLowerBound, bucketUpperBound float64,
Copy link
Contributor

Choose a reason for hiding this comment

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

style nit: inconsistent oneline versus multiline. we may need a style guide :|

i thought we either did:

func foo(lotsAndLots, ofArgumentsHere ofThisType) {

or

func foo(
  lotsAndLots,
  ofArguments ofThisType,
)

but maybe i'm misremembering

Copy link
Author

Choose a reason for hiding this comment

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

They have the same type, but sure.

@@ -62,6 +62,10 @@ func (nopCachedStatsReporter) AllocateGauge(name string, tags map[string]string)
return NopCachedGauge
}

func (nopCachedStatsReporter) AllocateHistogram(name string, tags map[string]string, buckets tally.Buckets) tally.CachedHistogram {
Copy link
Contributor

Choose a reason for hiding this comment

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

how come this one doesn't get godoc comments but the other one you added does?

Copy link
Author

Choose a reason for hiding this comment

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

nopCachedStatsReporter is the internal type.

@@ -38,7 +38,16 @@ import (
func TestServiceCreation(t *testing.T) {
r := metrics.NewTestStatsReporter()
r.CountersWG.Add(1)
scope, closer := tally.NewRootScope("", nil, r, 50*time.Millisecond, tally.DefaultSeparator)
opts := tally.ScopeOptions{
Tags: nil,
Copy link
Contributor

Choose a reason for hiding this comment

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

why the explicit nil/empty string stuff here? i think i actually like it, but generally see it elided as:

opts := tally.ScopeOptions {
  Reporter: r,
  Separator: ...,
  DefaultBuckets: ...,
}

for brevity. thoughts?

Copy link
Author

Choose a reason for hiding this comment

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

Well, I was afraid linter would complain, because, we can extend a struct and forget some mandatory fields. But it didn't. Let's get dangerous.

DefaultBuckets: tally.DefaultBuckets,
}

scope, _ := tally.NewRootScope(opts, 100*time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated to this change, but what is this magic number for?

Copy link
Author

Choose a reason for hiding this comment

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

It is the reporting interval, how often we are going to sample metrics.

Counters map[string]int64
Gauges map[string]float64
Timers map[string]time.Duration
HistogramSamples map[string]tally.Buckets
Copy link
Contributor

Choose a reason for hiding this comment

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

Has this been implemented internally? If not we cannot use it until the internal implementation support these APIs.

Copy link
Author

Choose a reason for hiding this comment

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

Why? Nop implementations doesn't have to do anything.

Copy link
Author

Choose a reason for hiding this comment

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

This is needed only to implement interfaces.

The way service is using it is in service_setup.go, where options became a separate struct.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant for Tally 2.0 CachedStatsReporter. We don't have its implementation here, but we rely on internal implementation from our private repo.

@ghost ghost changed the title Consume latest tally [Do not merge]Consume latest tally Feb 27, 2017

func (nopCachedHistogram) ValueBucket(
bucketLowerBound, bucketUpperBound float64,
bucketLowerBound float64,
Copy link
Contributor

Choose a reason for hiding this comment

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

note: i wasn't suggesting repeating the type, just putting each param on its own line or having them all on one line, not some mix-and-match

Copy link
Author

Choose a reason for hiding this comment

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

I know, personally, it is easier to read. Really wish go fmt will help with these things :)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 90.875% when pulling 6769cd1 on updateTally into 6b9a93d on master.

@glibsm
Copy link
Collaborator

glibsm commented Feb 27, 2017

Looks good. What Anup said about internal implementation changes applies. As soon as this lands, m3 backend will be broken.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 91.509% when pulling fb2ffe2 on updateTally into be1e111 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 91.509% when pulling d303ea8 on updateTally into be1e111 on master.

@anuptalwalkar
Copy link
Contributor

merging since we have all the necessary components ready.

@anuptalwalkar anuptalwalkar merged commit 2470d0e into master Mar 8, 2017
@anuptalwalkar anuptalwalkar deleted the updateTally branch March 8, 2017 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants