-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Global meter forwarding implementation #392
Conversation
api/global/global.go
Outdated
// If none is registered then an instance of metric.NoopProvider is returned. | ||
// Use the trace provider to create a named meter. E.g. | ||
// MeterProvider returns the registered global meter provider. If | ||
// none is registered then a dewfault meter provider is returned that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo:s/dewfault/default/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
api/global/internal/state.go
Outdated
if current == mp { | ||
// Setting the provider to the prior default | ||
// is nonsense, set it to a noop. | ||
mp = metric.NoopProvider{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic would be better than replacing it with NoopProvider{}.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -71,13 +77,19 @@ const ( | |||
) | |||
|
|||
func (i *Instrument) AcquireHandle(labels apimetric.LabelSet) apimetric.HandleImpl { | |||
if ld, ok := labels.(apimetric.LabelSetDelegate); ok { | |||
labels = ld.Delegate() | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check should be done for sdk as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! This crossed my mind as I was walking out the office. Suggests more tests, too :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
mock.MeasurementBatches[2].Measurements[0].Number) | ||
require.Equal(t, "test.measure", | ||
mock.MeasurementBatches[2].Measurements[0].Instrument.Name) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps add test for multiple Meters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
FYI I discovered that named Tracers will need similar support as discussed in open-telemetry/oteps#74 but I will leave that out of this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small grammars nits but LGTM
api/global/internal/meter.go
Outdated
// provider. Mutexes in the Provider and Meters ensure that each | ||
// instrument has a delegate before the global provider is set. | ||
// | ||
// LabelSets are implemented using the by delegating to the Meter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that there is an extra using the
here
LabelSets are implemented
using theby delegating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
api/global/internal/meter.go
Outdated
// LabelSets are implemented using the by delegating to the Meter | ||
// instance using the metric.LabelSetDelegator interface. | ||
// | ||
// Bound instrument operations are implementing by delegating to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be are implemented
to be consistent with the LabelSets
doc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks!
Implements deferred initialization for metric instruments registered before the first Meter SDK is installed.
This implements the behavior specified in open-telemetry/oteps#45.
Resolves #388.