-
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
Remove Labelset #595
Remove Labelset #595
Conversation
The test failures are related to 32bit builds. Investigating.. |
|
Now the test failure looks unrelated.
|
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.
Rambled a bit about the record reuse. But the PR looks good!
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.
Looks good. Nothing blocking.
This addresses #590.
Introduces a static helper function
metric.Labels(...core.KeyValue) []core.KeyValue
which simplifies rewriting of e.g.,Bind(meter.Labels(keys...))
toBind(metric.Labels(keys...)...)
. The diff is pretty readable. The only significant changes are insdk.go
where the code is reorganized to avoid a new allocation. Whereas before thelabels
object was managed as a pointer, one that had to be allocated insideLabels()
, labels is now a struct embedded in either type of instrument, and the internalmakeLabels()
function allocates a temporaryrecord
that will become garbage if the lookup succeeds and will become the new record otherwise.It does not change the
RecordBatch
API as suggested in OTEP 90 (and I'm not sure that it really matters, after some consideration). This PR does change a lot of benchmarks, but the benchmarks weren't measuring the labelset creation so it's apples and oranges.We have argued that the cost of label set construction can be amortized using bound handles, which is true. Note that there is not a way to amortize this across collection intervals for Observer instruments, because there is no "bound" form of observer instrument and now no
LabelSet
to perform that function. This is acceptable; perhaps if there is a dire need we can add bound Observers somehow in the future.The new RecordBatch benchmark is a good summary of the performance change, BEFORE:
AFTER: