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

Add metric description to factory API #61

Merged
merged 5 commits into from
Dec 2, 2018

Conversation

objectiser
Copy link
Contributor

Resolves #60

Signed-off-by: Gary Brown gary@brownuk.com

Signed-off-by: Gary Brown <gary@brownuk.com>
@codecov
Copy link

codecov bot commented Nov 19, 2018

Codecov Report

Merging #61 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #61   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          25     25           
  Lines         694    711   +17     
=====================================
+ Hits          694    711   +17
Impacted Files Coverage Δ
metrics/tally/factory.go 100% <100%> (ø) ⬆️
metrics/metricstest/local.go 100% <100%> (ø) ⬆️
metrics/factory.go 100% <100%> (ø) ⬆️
metrics/adapters/tagless.go 100% <100%> (ø) ⬆️
metrics/adapters/factory.go 100% <100%> (ø) ⬆️
metrics/go-kit/factory.go 100% <100%> (ø) ⬆️
metrics/prometheus/factory.go 100% <100%> (ø) ⬆️
metrics/multi/multi.go 100% <100%> (ø) ⬆️
metrics/expvar/factory.go 100% <100%> (ø) ⬆️
metrics/metrics.go 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1fc5c31...2dde290. Read the comment docs.

@yurishkuro
Copy link
Member

I just mentioned in #62 - maybe we should consider using structs as arguments instead of explicit args.

Signed-off-by: Gary Brown <gary@brownuk.com>
@objectiser
Copy link
Contributor Author

@yurishkuro Updated. Let me know if you would prefer different struct names, and whether would prefer no embedded type.

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

one other thing (unless I missed it) - the reflection-based initializer should support description field in the struct tags, so that we can continue init-ing metrics declaratively.

@@ -14,22 +14,40 @@

package metrics

// MetricScope defines the name and tags map associated with a metric
type MetricScope struct {
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a bit overkill, makes calls to Counter() etc a lot uglier.

}

// MetricInfo defines the information associated with a metric
type MetricInfo struct {
Copy link
Member

Choose a reason for hiding this comment

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

I'd move Name/Tags here. Also can it be renamed to Options? So that the syntax doesn't stutter:

c := factory.Counter(metrics.Options{Name: .., Description: ...})

…de the Options.

Signed-off-by: Gary Brown <gary@brownuk.com>
@objectiser
Copy link
Contributor Author

@yurishkuro Updates applied. Did you mean the reflection here?

@yurishkuro
Copy link
Member

@objectiser one minor thing was nagging at me - maybe we should use the name Help instead of Description? It will make the syntax more concise. I can do that change on top of yours.

Signed-off-by: Gary Brown <gary@brownuk.com>
@objectiser
Copy link
Contributor Author

@yurishkuro SGTM - updated.

}
func (nullFactory) Gauge(options Options) Gauge {
return NullGauge
}
Copy link
Member

Choose a reason for hiding this comment

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

Why multi-line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Autoformatting by vscode - but seems to accept manually putting it back to single line.

@@ -14,22 +14,41 @@

package metrics

// Scope defines the name and tags map associated with a metric
type Scope struct {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe something like NSOptions instead? Scope sounds like we’re introducing another concept

Signed-off-by: Gary Brown <gary@brownuk.com>
@objectiser
Copy link
Contributor Author

@yurishkuro Changes applied.

@yurishkuro yurishkuro merged commit 3fa9aa0 into jaegertracing:master Dec 2, 2018
@yurishkuro
Copy link
Member

Nice!

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