prom-client
prom-client copied to clipboard
Support Bigint
Add support for BigInt so we can use high resolution timers and values.
PR very much welcome!
Ref https://github.com/siimon/prom-client/pull/223#issuecomment-440979376
@SimenB Supporting versions prior to bigint would make the code quite tedious, I reckon. If we can limit ourselves to node >=10, it'd be easier. Then we can just change the internal representation to bigint everywhere, and send it as a string to prometheus.
Nah, just check typeof BigInt
when serialising (to strip trailing n
, isn't that enough? Dropping node 8 is not really an option
@SimenB There's a few Number.isFinite
here and there as well. I'd recommend keeping the library lean, without too many ifs and typeofs that'll take up valuable time in the event loop.
I'll be impressed if you can measure time spent on an if
in anything but a synthetic microbenchmark :) That's not really an issue
@SimenB Perhaps. I'd still argue that the correct path is to bump the major version number, and work entirely with bigint instead.
That's not gonna happen until next year, 8 is LTS and there's not big benefit to dropping it early. When we do drop it we can probably rewrite to use BigInt
all over
Yeah, we need to support all current official node versions.
Node 10 is LTS now, It's time to use BigInt by default in this client. We can transform Number to BigInt for compatible.
Node 8 is also LTS and does not support BigInt. It'll be EOL in January 2020 though, at which point we can revisit
Is there any news on this matter? I want to set a gauge value with a high value and I'm limited to the size of number on JS, I need to use a BigInt or other representation to hold this value
Boarding the bandwagon :eyes:
PR welcome - our current minimum node version is 10 👍
lol bump