Comments (9)
BigInt
support has landed on node in 10.4.0 (or 10.8.0 ?) but it's possible to use jsbi as a polyfill in both node and the browser if needed.
from opentelemetry-js.
I agree with @bg451's approach. Only thing is if they measure type is Long
(or Long typed Measure
/Measurement
.) and provided value with decimals, SDK should either throw an exception or log the error otherwise exporters would crash or throw un handled exceptions.
*this is more like a question/discussion, so removed bug label.
from opentelemetry-js.
I'd like to avoid making BigInt / jsbi a requirement for users, since it would add weight to the JS bundles that get shipped to the browser.
That said, you can't do fully accurate Long
type counting with the regular JS number
(though for smaller counts they work pretty well). I would be inclined to focus the UI on number
, and make BigInt use either not included initially or an optional add-on of some sort.
from opentelemetry-js.
There is also the long.js library, which is likely lighter weight than jsbi since it only needs 64-bit support. Again, something I'd recommend we look at down the road.
from opentelemetry-js.
Some more food for thought from https://github.com/open-telemetry/opentelemetry-js/pull/105/files#diff-1a629a23a3811f06e38fba44580c10bdR42
Measurements can have a long or double type. However, it looks like
// the metric timeseries API (according to spec) accepts values instead of
// Measurements, meaning that if you accept a `number`, the type gets lost.
// Both java and csharp have gone down the route of having two gauge interfaces,
// GaugeDoubleTimeseries and GaugeLongTimeseries, with param for that type. It'd
// be cool to only have a single interface, but maybe having two is necessary?
I guess there's this question of how far we should deviate from the spec, and imo I think this would be a win for API simplicity.
from opentelemetry-js.
What if we have a single interface, and make the type for it accept something like number|bigint
?
Then in our implementation, we make sure that the bigint
dependency is pluggable in some way (maybe different packages, one with it, one without it?). In the code we can do a typeof value === 'number'
check to determine the type of the input value for whether to use a number
or bigint
, and the number
-only implementation could say write a warning log if typeof value !== 'number'
from opentelemetry-js.
How will metrics be sent to the server? This is important because some formats like JSON simply don't support Long. There are also certain libraries that expect a specific format from a specific library, like msgpack-lite
requires int64-buffer
and Protobuf has a similar requirement.
from opentelemetry-js.
The way the OpenCensus service's grpc-gateway works is that you can give a value
field and a string for the number, something like {value: {int64Value: "string of the 64-bit number"}}
. For OpenCensus Node it uses gRPC for the OpenCensus service exporter and for the Stackdriver exporter I think. For OpenCensus Web, I pretty much just used double values for all number
on export, but would have done something similar with the wrapper object and string.
from opentelemetry-js.
The value type in the newer specs is either 64 bit double or a 64 bit signed integer (sfixed64, which can be passed to protobufjs as a string). So strictly speaking BigInt
can't be supported properly, but it might make sense to support the 64 bit integer API, which in the background uses BigInt, e.g. createInt64Counter
.
from opentelemetry-js.
Related Issues (20)
- Logs Stabilization Plan HOT 1
- Update Typescript HOT 2
- Unable to set object as span attribute value HOT 1
- Instrumenting node build chains
- How to add fields to a fetch request, or adding custom fields to a span.
- HTTP instrumentation metrics naming not matching OTel spec. HOT 2
- Separate publishing of semantic conventions for more control over version
- Possible to configure Multiple Exporters using NodeSDK? HOT 1
- diag.error about unknown OTEL_NODE_RESOURCE_DETECTORS entry should be diag.warn HOT 1
- Memory leak in the fetch instrumentation when used against an infinite fetch request resulting in memory leak HOT 1
- Add request path to http-instrumentation metric histogram
- Use updated attributes with ATTR prefix in all packages
- Implement stable http semantic conventions HOT 1
- Publish ESM packages following ESM spec HOT 2
- Add allowUrls as a config option for web instrumentation
- could we *not* `.enable()` instrumentations in their constructor? HOT 1
- TraceID missed after deployed the project in docker containers
- @opentelemetry/sdk-node changes size when installed from package.json HOT 1
- BatchSpanProcessor doesn't re-enable tracing after flushing HOT 7
- CI Automating of Releases
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentelemetry-js.