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)
- ConsoleSpanExporter not logging anything for Custom Spans for prebuilds HOT 3
- LogRecord discards attributes which are `instanceof Error` HOT 4
- propagator-aws-xray broken with GRPC? HOT 2
- (draft) [api] document best-practices and limitations
- Types returned by getMeter are not compatible HOT 2
- [instrumentation] hide `shimmer` types from the public API
- How to set `credentials: include`? If it cannot be done, please add an option to include Cookies for the Exporters.
- [instrumentation] research adding experimental features to `Instrumentation`, `InstrumentationBase`
- Can not use ESM support in lambda environment HOT 2
- @opentelemetry/semantic-conventions out of sync. E.g. 1.25.1 `http.user_agent` does not follow semantic conventions? HOT 4
- traceparent http header field is not extracted correctly when datadog agent also inserts it HOT 2
- [instrumentation] update "Instrumentation for ES Modules" documentation HOT 1
- How to determine Parent Span from a ReadableSpan, check if Parent Span is Remote?
- Unable to access to trace information using opentelemetry-js SDK + aws lambda layer HOT 2
- `HttpInstrumentation` does not create outgoing request span for `http.get` in ESM HOT 1
- Lamda Auto Instrumentation Causes -> Internal Server Error Due To Span not Ending HOT 2
- node http integration: ignoreIncomingRequests() option does not work HOT 2
- couchbase instrumentation doesn't not support?
- Logs Stabilization Plan HOT 1
- Update Typescript HOT 1
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.