-
Notifications
You must be signed in to change notification settings - Fork 378
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
fix: collect metrics on scrape, not timeout #329
Conversation
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 is wonderful, thanks for working on it! I just went to bed, so I'll review properly tomorrow 🙂
No hurry, enjoy your weekend. I'm willing to remove code for sure, I'll get rid of the timeout relics. |
it's not supported, so I'm not afraid of breaking people's usage if it. And since next release is a major, I think it's fine.
I don't think so - what's the use case for it? |
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.
I think this looks great! I'm all for landing as is, then going over and remove everything that is deprecated (whether we print a warning or not)
No idea, but existing code supports it:
I can reproduce the master behaviour in this PR, but if the comment is correct, then its OK to just delete the support. I'm happy to remove, but I don't know why its there, or if anyone uses it. |
It seems I added that comment 3 years ago - I have no recollection of it 😅 But no, I think it makes sense to throw if called again. IIRC it should do so if we just remove the guard, as that's the default registry behavior |
I agree, in my world the public interface to this library is what is in /index.js |
I agree here aswell. The only potential problem I could see is in tests where you run it multiple times. But that should probably be handled when you write the tests with a proper cleanup. |
I think it looks great, really appreciate your time working on this! |
Or write the test to use a non-default registry, the throw that is in there will trigger if the default metrics are added multiple times to the same registry. They can be added to a number of different registries. |
Added a test for #329 (comment) |
@sam-github the changes LGTM! Just got a conflict after the latest merge, so if you could fix that and update the PR and I'll merge right away! |
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 is great! 🎉
This allows the metrics to be collected at scrape time, rather than on an interval timer.
Only the event loop "lag" is still async, see the in-src notes. Fixes: #180
@SimenB Thanks for the careful review, I made all the suggested changes, PTAL. |
Only the event loop "lag" is still async, see the in-src notes.
Fixes: #180
This is a WIP, it lacks tests (though it passes the existing ones).
Open questions:
Also, my typescript is close to non-existent, pay close attention to my attempt to update the typescript definitions.