Comments (2)
@kayousterhout Thank you very much for the clear explanation! I'm sorry I didn't know that Lightstep only used 64 bit trace ids. Not knowing that was very confusing when comparing this implementation to the new OpenTelemetry libraries! I'm glad I know now.
You are also correct that the X-Cloud-Trace-Header is not in the code in this repo; again, my apologies. It's from an internal extension of the Tracer
from this repo that does something like this to construct the header:
public inject(
spanContext: any,
format: string,
carrier: LightstepCarrier,
): void {
LightstepTracer.prototype.inject.call(this, spanContext, format, carrier);
const traceGuid = carrier['ot-tracer-traceid'];
const spanGuid = carrier['ot-tracer-spanid'];
const traceGuidForHeader: string = traceGuid.padEnd(32, '0');
const spanGuidForHeader: string = hexToIntString(spanGuid);
const traceValue = `${traceGuidForHeader}/${spanGuidForHeader};o=1`;
carrier['X-Cloud-Trace-Context'] = traceValue;
}
Since it's using the values placed into carrier
by LightstepTracer.prototype.inject
, I assumed showing the header was a good example to illustrate the most significant bits being dropped (since it's basically just using the values from this library), but forgot that the header was GCP/opencensus. Sorry for the confusion.
from lightstep-tracer-javascript.
This is the expected behavior. The underlying reason for all of this is that Lightstep only accepts 64 bit trace IDs (which maps to 16 hex characters), but context propagation formats typically allow for 128 bit trace IDs (32 hex characters). We truncate those trace IDs (by taking the least-significant 64 bits / 8 bytes / 16 hex chars) before sending them to a satellite. Typically propagators send the full 128-bit trace ID and the truncation happens later, right before we send data to a satellite. But, for the Lightstep context propagation format, we assume the data is eventually going to a Lightstep satellite, so do the truncation earlier, as part of the context propagation.
The B3 spec dictates that it will propagate what it receives, so if it receives just 16 hex chars, it will propagate those 16 (that's the behavior in the code snippet you linked), or otherwise it will propagate the full 128 bit (32 hex chars) trace ID.
I'm not sure whether there is something wrong in the X-Cloud-Trace-Context header you linked - that looks like a GCP-specific header format (that I don't think could have been emitted by the code here? But perhaps was in a connected service?).
Let me know if this all makes sense or if there seem to be remaining bugs here! I'll be out next week but I added @andrewhsu here to help with any further issues.
from lightstep-tracer-javascript.
Related Issues (20)
- Clock skew correction should take into account wrong window.performance time on browser platform HOT 1
- [Chrome] lighstep-tracer triggers browser errors: `Security Error: Failed to read the 'sessionStorage' property from 'Window': Access is denied for this document.` HOT 1
- Support for reporter tags HOT 2
- Page fails to load on IE11 with lightstep-tracer 0.24.3
- Enable `global-require` lint
- Extract babel config from Makefile / webpack config
- SameSite Cookie attributes
- Optionally _clearBuffer on _reportErrorStreak Threshold
- No way to create a custom propagator HOT 1
- Make and use getters on SpanContext
- React Native crash when it tries to access or add cookies. Error: 'document is undefined'.' HOT 2
- Browser friendly lightweight distribution HOT 3
- Broken in Edge 18 due to spread in object literal HOT 2
- lightstep-tracer-javascript latest version contains high severity vulnerability of underscore package HOT 3
- Prototype Pollution in async HOT 2
- Update dependencies in order to fix security vulnerabilities HOT 1
- Support for ot-tracer-sampled HOT 1
- Default value for `sampling.priority` tag?
- Resource leak with Node.js 20
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 lightstep-tracer-javascript.