Reduce function indirection in histogram.js for easier debugging - #669
Merged
Conversation
jdmarshall
commented
Jun 24, 2025
SimenB
requested changes
Jul 1, 2025
SimenB
left a comment
Collaborator
There was a problem hiding this comment.
makes sense to me 👍
mind addressing the ESLint warnings?
(I'm not an admin on this repo, so unable to have the actions trigger for first contributions 😅 since a bunch of your other changes have landed tho, it shouldn't be an issues once you push again)
jdmarshall
force-pushed
the
ergonomics
branch
2 times, most recently
from
July 1, 2025 14:48
d64ea6c to
4ad0bcf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also add missing benchmarks for startTimer(), since I'm mucking about in its innards.
In theory removing call() for arrow functions or straight calls improves performance, but I've never managed a benchmark that proves it. This change also reduces closure creation but GC is also difficult to benchmark. Make enough of these changes however and you can get yourself a little teeny tiny notch in your telemetry data that proves you did something (I think I clocked my test case at about .8%, because the calls were slow and so that added up to 5+ms).
So these are officially just about improving single step debugging.
One of the places where Prometheus can outshine OpenTelemetry is in trying to figure out why your metrics are confusing/missing/garbled. If you've ever tried to single-step through OTEL it's a maze of twisty little passages, all the same. prom-client has a fairly straightforward architecture and thus is already much better in this regard but I'm interested in making tools that need to 'just work' more approachable.