lightstep-tracer
Advanced tools
Comparing version 0.27.0 to 0.28.0-no-protobuf
@@ -7,2 +7,11 @@ # CHANGELOG | ||
## 0.28.0 | ||
* Bug fix for propagating baggage from parent span to child span | ||
* SpanContext is now exported to facilitate creating custom propagators | ||
## 0.27.0 | ||
* No changes | ||
## 0.26.0 | ||
@@ -9,0 +18,0 @@ |
@@ -57,4 +57,3 @@ | ||
/** | ||
* optional, specifies the transport method used for communication to the Satellite. default = proto. | ||
* `proto` - use protobuf over HTTP(S) | ||
* optional, specifies the transport method used for communication to the Satellite. default = thrift. | ||
* `thrift` - use thrift | ||
@@ -61,0 +60,0 @@ */ |
@@ -7,5 +7,4 @@ 'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // eslint-disable-next-line camelcase | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _platform_abstraction_layer = require('../platform_abstraction_layer'); | ||
@@ -15,3 +14,3 @@ | ||
var proto = require('./generated_proto/collector_pb.js'); | ||
// eslint-disable-line camelcase | ||
@@ -41,9 +40,2 @@ var AuthImp = function () { | ||
} | ||
}, { | ||
key: 'toProto', | ||
value: function toProto() { | ||
var authProto = new proto.Auth(); | ||
authProto.setAccessToken(this._accessToken); | ||
return authProto; | ||
} | ||
}]); | ||
@@ -50,0 +42,0 @@ |
@@ -27,5 +27,2 @@ 'use strict'; | ||
// eslint-disable-line camelcase | ||
var googleProtobufTimestampPB = require('google-protobuf/google/protobuf/timestamp_pb.js'); | ||
var proto = require('./generated_proto/collector_pb.js'); | ||
var LogRecordImp = function () { | ||
@@ -126,33 +123,2 @@ function LogRecordImp(logFieldKeyHardLimit, logFieldValueHardLimit, timestampMicros, fields) { | ||
} | ||
}, { | ||
key: 'toProto', | ||
value: function toProto() { | ||
var _this2 = this; | ||
this._clearOverLimits(); | ||
var log = new proto.Log(); | ||
var ts = new googleProtobufTimestampPB.Timestamp(); | ||
var secs = Math.floor(this._timestampMicros / 1000000); | ||
var nanos = this._timestampMicros % 1000000 * 1000; | ||
ts.setSeconds(secs); | ||
ts.setNanos(nanos); | ||
log.setTimestamp(ts); | ||
var keyValues = []; | ||
(0, _each3.default)(this._fields, function (value, key) { | ||
if (!key || !value) { | ||
return; | ||
} | ||
var keyStr = _this2.getFieldKey(key); | ||
var valStr = _this2.getFieldValue(value); | ||
var keyValue = new proto.KeyValue(); | ||
keyValue.setKey(keyStr); | ||
keyValue.setStringValue(valStr); | ||
keyValues.push(keyValue); | ||
}); | ||
log.setFieldsList(keyValues); | ||
return log; | ||
} | ||
}]); | ||
@@ -159,0 +125,0 @@ |
@@ -27,4 +27,2 @@ 'use strict'; | ||
var proto = require('./generated_proto/collector_pb'); | ||
var ReportImp = function () { | ||
@@ -95,30 +93,2 @@ function ReportImp(runtime, oldestMicros, youngestMicros, spanRecords, internalLogs, counters, timestampOffsetMicros) { | ||
} | ||
}, { | ||
key: 'toProto', | ||
value: function toProto(auth) { | ||
var spansList = []; | ||
(0, _each3.default)(this._spanRecords, function (spanRecord) { | ||
spansList.push(spanRecord._toProto()); | ||
}); | ||
var countsList = []; | ||
(0, _each3.default)(this._counters, function (count) { | ||
var metricSample = new proto.MetricsSample(); | ||
metricSample.setName(count.name); | ||
metricSample.setIntValue(count.int64_value); | ||
metricSample.setDoubleValue(count.double_value); | ||
countsList.push(metricSample); | ||
}); | ||
var internalMetrics = new proto.InternalMetrics(); | ||
internalMetrics.setCountsList(countsList); | ||
var reportProto = new proto.ReportRequest(); | ||
reportProto.setAuth(auth.toProto()); | ||
reportProto.setReporter(this._runtime.toProto()); | ||
reportProto.setSpansList(spansList); | ||
reportProto.setTimestampOffsetMicros(this._timestampOffsetMicros.toString(10)); | ||
reportProto.setInternalMetrics(internalMetrics); | ||
return reportProto; | ||
} | ||
}]); | ||
@@ -125,0 +95,0 @@ |
@@ -27,6 +27,2 @@ 'use strict'; | ||
var converter = require('hex2dec'); | ||
var proto = require('./generated_proto/collector_pb'); | ||
var packageObject = require('../../package.json'); | ||
var RuntimeImp = function () { | ||
@@ -62,48 +58,2 @@ function RuntimeImp(runtimeGUID, startMicros, componentName, attributes) { | ||
} | ||
}, { | ||
key: 'toProto', | ||
value: function toProto() { | ||
var tracerVersion = new proto.KeyValue(); | ||
tracerVersion.setKey('lightstep.tracer_version'); | ||
tracerVersion.setStringValue(packageObject.version); | ||
var tracerPlatform = new proto.KeyValue(); | ||
tracerPlatform.setKey('lightstep.tracer_platform'); | ||
tracerPlatform.setStringValue(this._attributes['lightstep.tracer_platform']); | ||
var tracerPlatformVersion = new proto.KeyValue(); | ||
tracerPlatformVersion.setKey('lightstep.tracer_platform_version'); | ||
tracerPlatformVersion.setStringValue(this._attributes['lightstep.tracer_platform_version']); | ||
var componentName = new proto.KeyValue(); | ||
componentName.setKey('lightstep.component_name'); | ||
componentName.setStringValue(this._componentName); | ||
var commandLine = new proto.KeyValue(); | ||
commandLine.setKey('lightstep.command_line'); | ||
commandLine.setStringValue(this._attributes['lightstep.command_line']); | ||
var hostname = new proto.KeyValue(); | ||
hostname.setKey('lightstep.hostname'); | ||
hostname.setStringValue(this._attributes['lightstep.hostname']); | ||
var reporterId = converter.hexToDec(this._runtimeGUID); | ||
var tracerTags = []; | ||
(0, _each3.default)(this._attributes, function (val, key) { | ||
var ttag = new proto.KeyValue(); | ||
ttag.setKey(key); | ||
ttag.setStringValue(val); | ||
tracerTags.push(ttag); | ||
}); | ||
var reporterTags = [tracerVersion, tracerPlatform, componentName, commandLine, hostname, tracerPlatformVersion]; | ||
var allTags = reporterTags.concat(tracerTags); | ||
var reporterProto = new proto.Reporter(); | ||
reporterProto.setReporterId(reporterId); | ||
reporterProto.setTagsList(allTags); | ||
return reporterProto; | ||
} | ||
}]); | ||
@@ -110,0 +60,0 @@ |
@@ -51,6 +51,2 @@ 'use strict'; | ||
var converter = require('hex2dec'); | ||
var googleProtobufTimestampPB = require('google-protobuf/google/protobuf/timestamp_pb'); | ||
var proto = require('./generated_proto/collector_pb'); | ||
var SpanImp = function (_opentracing$Span) { | ||
@@ -80,2 +76,12 @@ _inherits(SpanImp, _opentracing$Span); | ||
}, { | ||
key: '_setBaggageItem', | ||
value: function _setBaggageItem(key, value) { | ||
this._ctx.setBaggageItem(key, value); | ||
} | ||
}, { | ||
key: '_getBaggageItem', | ||
value: function _getBaggageItem(key) { | ||
return this._ctx.getBaggageItem(key); | ||
} | ||
}, { | ||
key: '_addTags', | ||
@@ -294,59 +300,2 @@ value: function _addTags(keyValuePairs) { | ||
} | ||
}, { | ||
key: '_toProto', | ||
value: function _toProto() { | ||
var _this3 = this; | ||
var spanContextProto = new proto.SpanContext(); | ||
spanContextProto.setTraceId(converter.hexToDec(this.traceGUID())); | ||
spanContextProto.setSpanId(converter.hexToDec(this.guid())); | ||
var spanProto = new proto.Span(); | ||
spanProto.setSpanContext(spanContextProto); | ||
spanProto.setOperationName(this._operationName); | ||
var startTimestamp = new googleProtobufTimestampPB.Timestamp(); | ||
var startSeconds = Math.floor(this._beginMicros / 1000000); | ||
var startNanos = this._beginMicros % 1000000 * 1000; | ||
startTimestamp.setSeconds(startSeconds); | ||
startTimestamp.setNanos(startNanos); | ||
spanProto.setStartTimestamp(startTimestamp); | ||
spanProto.setDurationMicros((this._endMicros - this._beginMicros).toString()); | ||
var logs = []; | ||
(0, _each3.default)(this._log_records, function (logRecord) { | ||
var logProto = logRecord.toProto(); | ||
_this3._tracerImp._counters['logs.keys.over_limit'] += logRecord.getNumKeysOverLimit(); | ||
_this3._tracerImp._counters['logs.values.over_limit'] += logRecord.getNumValuesOverLimit(); | ||
logs.push(logProto); | ||
}); | ||
spanProto.setLogsList(logs); | ||
var parentSpanGUID = void 0; | ||
var tags = []; | ||
(0, _each3.default)(this._tags, function (value, key) { | ||
var strValue = coerce.toString(value); | ||
var strKey = coerce.toString(key); | ||
var tag = new proto.KeyValue(); | ||
if (strKey === 'parent_span_guid') { | ||
parentSpanGUID = strValue; | ||
} | ||
tag.setKey(strKey); | ||
tag.setStringValue(strValue); | ||
tags.push(tag); | ||
}); | ||
spanProto.setTagsList(tags); | ||
if (parentSpanGUID !== undefined) { | ||
var ref = new proto.Reference(); | ||
ref.setRelationship(proto.Reference.Relationship.CHILD_OF); | ||
var parentSpanContext = new proto.SpanContext(); | ||
parentSpanContext.setSpanId(converter.hexToDec(parentSpanGUID)); | ||
ref.setSpanContext(parentSpanContext); | ||
spanProto.setReferencesList([ref]); | ||
} | ||
return spanProto; | ||
} | ||
}]); | ||
@@ -353,0 +302,0 @@ |
@@ -196,6 +196,2 @@ 'use strict'; | ||
switch (_this._options.transport) { | ||
case 'proto': | ||
_this._transport = new _platform_abstraction_layer.ProtoTransport(logger); | ||
_this._info('Using protobuf over HTTP transport per user-defined option.'); | ||
break; | ||
case 'thrift': | ||
@@ -206,4 +202,4 @@ _this._transport = new _platform_abstraction_layer.ThriftTransport(logger); | ||
default: | ||
_this._transport = new _platform_abstraction_layer.ProtoTransport(logger); | ||
_this._info('Using protobuf over HTTP transport as no user-defined option was supplied.'); | ||
_this._transport = new _platform_abstraction_layer.ThriftTransport(logger); | ||
_this._info('Using thrift transport per user-defined option.'); | ||
} | ||
@@ -284,3 +280,3 @@ } | ||
this.addOption('disable_clock_skew_correction', { type: 'bool', defaultValue: false }); | ||
this.addOption('transport', { type: 'string', defaultValue: 'proto' }); | ||
this.addOption('transport', { type: 'string', defaultValue: 'thrift' }); | ||
@@ -353,3 +349,4 @@ // Non-standard, may be deprecated | ||
var sampled = parentCtxImp ? parentCtxImp._sampled : true; | ||
var spanImp = new _span_imp2.default(this, name, new _span_context_imp2.default(this._platform.generateUUID(), traceGUID, sampled)); | ||
var spanCtx = new _span_context_imp2.default(this._platform.generateUUID(), traceGUID, sampled); | ||
var spanImp = new _span_imp2.default(this, name, spanCtx); | ||
spanImp.addTags(this._options.default_span_tags); | ||
@@ -377,2 +374,7 @@ | ||
spanImp.setParentGUID(parentCtxImp._guid); | ||
// Copy baggage items from parent to child | ||
parentCtxImp.forEachBaggageItem(function (k, v) { | ||
return spanCtx.setBaggageItem(k, v); | ||
}); | ||
} | ||
@@ -379,0 +381,0 @@ |
@@ -19,2 +19,6 @@ 'use strict'; | ||
var _span_context_imp = require('./imp/span_context_imp'); | ||
var _span_context_imp2 = _interopRequireDefault(_span_context_imp); | ||
var _platform_abstraction_layer = require('./platform_abstraction_layer'); | ||
@@ -28,3 +32,4 @@ | ||
B3Propagator: _propagator_b2.default, | ||
DDPropagator: _propagator_dd2.default | ||
DDPropagator: _propagator_dd2.default, | ||
SpanContext: _span_context_imp2.default | ||
}; | ||
@@ -31,0 +36,0 @@ |
@@ -12,6 +12,4 @@ 'use strict'; | ||
ThriftTransport: require('./imp/platform/browser/transport_httpthrift.js'), | ||
ProtoTransport: require('./imp/platform/browser/transport_httpproto.js'), | ||
thrift: require('./imp/platform/browser/thrift.js'), | ||
crouton_thrift: require('./imp/platform/browser/crouton_thrift.js'), | ||
proto: require('./imp/generated_proto/collector_pb.js') | ||
crouton_thrift: require('./imp/platform/browser/crouton_thrift.js') | ||
}; | ||
@@ -22,8 +20,6 @@ } else { | ||
ThriftTransport: require('./imp/platform/node/transport_httpthrift.js'), | ||
ProtoTransport: require('./imp/platform/node/transport_httpproto.js'), | ||
// Note: THRIFT-5029 requires us to use a non-standard require | ||
// TODO: remove non-standard require after https://github.com/apache/thrift/pull/1947 merges | ||
thrift: require('thrift/src/thrift'), | ||
crouton_thrift: require('./imp/platform/node/crouton_thrift.js'), | ||
proto: require('./imp/generated_proto/collector_pb.js') | ||
crouton_thrift: require('./imp/platform/node/crouton_thrift.js') | ||
}; | ||
@@ -30,0 +26,0 @@ } |
{ | ||
"name": "lightstep-tracer", | ||
"version": "0.27.0", | ||
"version": "0.28.0-no-protobuf", | ||
"main": "index.js", | ||
@@ -22,3 +22,2 @@ "types": "index.d.ts", | ||
"eventemitter3": "1.1.1", | ||
"google-protobuf": "3.6.1", | ||
"hex2dec": "1.0.1", | ||
@@ -25,0 +24,0 @@ "opentracing": "^0.14.4", |
@@ -1,6 +0,3 @@ | ||
// eslint-disable-next-line camelcase | ||
import { crouton_thrift } from '../platform_abstraction_layer'; | ||
import { crouton_thrift } from '../platform_abstraction_layer'; // eslint-disable-line camelcase | ||
let proto = require('./generated_proto/collector_pb.js'); | ||
export default class AuthImp { | ||
@@ -24,8 +21,2 @@ constructor(accessToken) { | ||
} | ||
toProto() { | ||
let authProto = new proto.Auth(); | ||
authProto.setAccessToken(this._accessToken); | ||
return authProto; | ||
} | ||
} |
@@ -5,5 +5,2 @@ import { crouton_thrift } from '../platform_abstraction_layer'; // eslint-disable-line camelcase | ||
// eslint-disable-line camelcase | ||
let googleProtobufTimestampPB = require('google-protobuf/google/protobuf/timestamp_pb.js'); | ||
let proto = require('./generated_proto/collector_pb.js'); | ||
export default class LogRecordImp { | ||
@@ -93,30 +90,2 @@ constructor(logFieldKeyHardLimit, logFieldValueHardLimit, timestampMicros, fields) { | ||
} | ||
toProto() { | ||
this._clearOverLimits(); | ||
let log = new proto.Log(); | ||
let ts = new googleProtobufTimestampPB.Timestamp(); | ||
let secs = Math.floor(this._timestampMicros / 1000000); | ||
let nanos = (this._timestampMicros % 1000000) * 1000; | ||
ts.setSeconds(secs); | ||
ts.setNanos(nanos); | ||
log.setTimestamp(ts); | ||
let keyValues = []; | ||
_each(this._fields, (value, key) => { | ||
if (!key || !value) { | ||
return; | ||
} | ||
let keyStr = this.getFieldKey(key); | ||
let valStr = this.getFieldValue(value); | ||
let keyValue = new proto.KeyValue(); | ||
keyValue.setKey(keyStr); | ||
keyValue.setStringValue(valStr); | ||
keyValues.push(keyValue); | ||
}); | ||
log.setFieldsList(keyValues); | ||
return log; | ||
} | ||
} |
@@ -5,4 +5,2 @@ import { crouton_thrift } from '../platform_abstraction_layer'; // eslint-disable-line camelcase | ||
let proto = require('./generated_proto/collector_pb'); | ||
export default class ReportImp { | ||
@@ -64,29 +62,2 @@ constructor(runtime, oldestMicros, youngestMicros, spanRecords, internalLogs, counters, timestampOffsetMicros) { | ||
} | ||
toProto(auth) { | ||
let spansList = []; | ||
_each(this._spanRecords, (spanRecord) => { | ||
spansList.push(spanRecord._toProto()); | ||
}); | ||
let countsList = []; | ||
_each(this._counters, (count) => { | ||
let metricSample = new proto.MetricsSample(); | ||
metricSample.setName(count.name); | ||
metricSample.setIntValue(count.int64_value); | ||
metricSample.setDoubleValue(count.double_value); | ||
countsList.push(metricSample); | ||
}); | ||
let internalMetrics = new proto.InternalMetrics(); | ||
internalMetrics.setCountsList(countsList); | ||
let reportProto = new proto.ReportRequest(); | ||
reportProto.setAuth(auth.toProto()); | ||
reportProto.setReporter(this._runtime.toProto()); | ||
reportProto.setSpansList(spansList); | ||
reportProto.setTimestampOffsetMicros(this._timestampOffsetMicros.toString(10)); | ||
reportProto.setInternalMetrics(internalMetrics); | ||
return reportProto; | ||
} | ||
} |
@@ -5,6 +5,2 @@ import { crouton_thrift } from '../platform_abstraction_layer'; // eslint-disable-line camelcase | ||
let converter = require('hex2dec'); | ||
let proto = require('./generated_proto/collector_pb'); | ||
const packageObject = require('../../package.json'); | ||
export default class RuntimeImp { | ||
@@ -36,47 +32,2 @@ constructor(runtimeGUID, startMicros, componentName, attributes) { | ||
} | ||
toProto() { | ||
let tracerVersion = new proto.KeyValue(); | ||
tracerVersion.setKey('lightstep.tracer_version'); | ||
tracerVersion.setStringValue(packageObject.version); | ||
let tracerPlatform = new proto.KeyValue(); | ||
tracerPlatform.setKey('lightstep.tracer_platform'); | ||
tracerPlatform.setStringValue(this._attributes['lightstep.tracer_platform']); | ||
let tracerPlatformVersion = new proto.KeyValue(); | ||
tracerPlatformVersion.setKey('lightstep.tracer_platform_version'); | ||
tracerPlatformVersion.setStringValue(this._attributes['lightstep.tracer_platform_version']); | ||
let componentName = new proto.KeyValue(); | ||
componentName.setKey('lightstep.component_name'); | ||
componentName.setStringValue(this._componentName); | ||
let commandLine = new proto.KeyValue(); | ||
commandLine.setKey('lightstep.command_line'); | ||
commandLine.setStringValue(this._attributes['lightstep.command_line']); | ||
let hostname = new proto.KeyValue(); | ||
hostname.setKey('lightstep.hostname'); | ||
hostname.setStringValue(this._attributes['lightstep.hostname']); | ||
let reporterId = converter.hexToDec(this._runtimeGUID); | ||
let tracerTags = []; | ||
_each(this._attributes, (val, key) => { | ||
let ttag = new proto.KeyValue(); | ||
ttag.setKey(key); | ||
ttag.setStringValue(val); | ||
tracerTags.push(ttag); | ||
}); | ||
let reporterTags = [tracerVersion, tracerPlatform, componentName, commandLine, hostname, tracerPlatformVersion]; | ||
let allTags = reporterTags.concat(tracerTags); | ||
let reporterProto = new proto.Reporter(); | ||
reporterProto.setReporterId(reporterId); | ||
reporterProto.setTagsList(allTags); | ||
return reporterProto; | ||
} | ||
} |
@@ -9,6 +9,2 @@ import * as opentracing from 'opentracing'; | ||
let converter = require('hex2dec'); | ||
let googleProtobufTimestampPB = require('google-protobuf/google/protobuf/timestamp_pb'); | ||
let proto = require('./generated_proto/collector_pb'); | ||
export default class SpanImp extends opentracing.Span { | ||
@@ -31,2 +27,10 @@ // ---------------------------------------------------------------------- // | ||
_setBaggageItem(key, value) { | ||
this._ctx.setBaggageItem(key, value); | ||
} | ||
_getBaggageItem(key) { | ||
return this._ctx.getBaggageItem(key); | ||
} | ||
_addTags(keyValuePairs) { | ||
@@ -224,56 +228,2 @@ let self = this; | ||
} | ||
_toProto() { | ||
let spanContextProto = new proto.SpanContext(); | ||
spanContextProto.setTraceId(converter.hexToDec(this.traceGUID())); | ||
spanContextProto.setSpanId(converter.hexToDec(this.guid())); | ||
let spanProto = new proto.Span(); | ||
spanProto.setSpanContext(spanContextProto); | ||
spanProto.setOperationName(this._operationName); | ||
let startTimestamp = new googleProtobufTimestampPB.Timestamp(); | ||
let startSeconds = Math.floor(this._beginMicros / 1000000); | ||
let startNanos = (this._beginMicros % 1000000) * 1000; | ||
startTimestamp.setSeconds(startSeconds); | ||
startTimestamp.setNanos(startNanos); | ||
spanProto.setStartTimestamp(startTimestamp); | ||
spanProto.setDurationMicros((this._endMicros - this._beginMicros).toString()); | ||
let logs = []; | ||
_each(this._log_records, (logRecord) => { | ||
let logProto = logRecord.toProto(); | ||
this._tracerImp._counters['logs.keys.over_limit'] += logRecord.getNumKeysOverLimit(); | ||
this._tracerImp._counters['logs.values.over_limit'] += logRecord.getNumValuesOverLimit(); | ||
logs.push(logProto); | ||
}); | ||
spanProto.setLogsList(logs); | ||
let parentSpanGUID; | ||
let tags = []; | ||
_each(this._tags, (value, key) => { | ||
let strValue = coerce.toString(value); | ||
let strKey = coerce.toString(key); | ||
let tag = new proto.KeyValue(); | ||
if (strKey === 'parent_span_guid') { | ||
parentSpanGUID = strValue; | ||
} | ||
tag.setKey(strKey); | ||
tag.setStringValue(strValue); | ||
tags.push(tag); | ||
}); | ||
spanProto.setTagsList(tags); | ||
if (parentSpanGUID !== undefined) { | ||
let ref = new proto.Reference(); | ||
ref.setRelationship(proto.Reference.Relationship.CHILD_OF); | ||
let parentSpanContext = new proto.SpanContext(); | ||
parentSpanContext.setSpanId(converter.hexToDec(parentSpanGUID)); | ||
ref.setSpanContext(parentSpanContext); | ||
spanProto.setReferencesList([ref]); | ||
} | ||
return spanProto; | ||
} | ||
} |
@@ -11,3 +11,3 @@ //============================================================================// | ||
import _each from '../_each'; | ||
import { Platform, ProtoTransport, ThriftTransport } from '../platform_abstraction_layer'; | ||
import { Platform, ThriftTransport } from '../platform_abstraction_layer'; | ||
import AuthImp from './auth_imp'; | ||
@@ -143,6 +143,2 @@ import RuntimeImp from './runtime_imp'; | ||
switch (this._options.transport) { | ||
case 'proto': | ||
this._transport = new ProtoTransport(logger); | ||
this._info('Using protobuf over HTTP transport per user-defined option.'); | ||
break; | ||
case 'thrift': | ||
@@ -153,4 +149,4 @@ this._transport = new ThriftTransport(logger); | ||
default: | ||
this._transport = new ProtoTransport(logger); | ||
this._info('Using protobuf over HTTP transport as no user-defined option was supplied.'); | ||
this._transport = new ThriftTransport(logger); | ||
this._info('Using thrift transport per user-defined option.'); | ||
} | ||
@@ -241,3 +237,3 @@ } | ||
this.addOption('disable_clock_skew_correction', { type: 'bool', defaultValue: false }); | ||
this.addOption('transport', { type: 'string', defaultValue: 'proto' }); | ||
this.addOption('transport', { type: 'string', defaultValue: 'thrift' }); | ||
@@ -308,3 +304,4 @@ // Non-standard, may be deprecated | ||
let sampled = parentCtxImp ? parentCtxImp._sampled : true; | ||
let spanImp = new SpanImp(this, name, new SpanContextImp(this._platform.generateUUID(), traceGUID, sampled)); | ||
let spanCtx = new SpanContextImp(this._platform.generateUUID(), traceGUID, sampled); | ||
let spanImp = new SpanImp(this, name, spanCtx); | ||
spanImp.addTags(this._options.default_span_tags); | ||
@@ -332,2 +329,5 @@ | ||
spanImp.setParentGUID(parentCtxImp._guid); | ||
// Copy baggage items from parent to child | ||
parentCtxImp.forEachBaggageItem((k, v) => spanCtx.setBaggageItem(k, v)); | ||
} | ||
@@ -334,0 +334,0 @@ |
@@ -5,2 +5,3 @@ import Tracer from './imp/tracer_imp'; | ||
import DDPropagator from './imp/propagator_dd'; | ||
import SpanContext from './imp/span_context_imp'; | ||
import { Platform } from './platform_abstraction_layer'; | ||
@@ -13,2 +14,3 @@ | ||
DDPropagator : DDPropagator, | ||
SpanContext : SpanContext, | ||
}; | ||
@@ -15,0 +17,0 @@ |
@@ -10,6 +10,4 @@ /* global PLATFORM_BROWSER */ | ||
ThriftTransport : require('./imp/platform/browser/transport_httpthrift.js'), | ||
ProtoTransport : require('./imp/platform/browser/transport_httpproto.js'), | ||
thrift : require('./imp/platform/browser/thrift.js'), | ||
crouton_thrift : require('./imp/platform/browser/crouton_thrift.js'), | ||
proto : require('./imp/generated_proto/collector_pb.js'), | ||
}; | ||
@@ -20,3 +18,2 @@ } else { | ||
ThriftTransport : require('./imp/platform/node/transport_httpthrift.js'), | ||
ProtoTransport : require('./imp/platform/node/transport_httpproto.js'), | ||
// Note: THRIFT-5029 requires us to use a non-standard require | ||
@@ -26,4 +23,3 @@ // TODO: remove non-standard require after https://github.com/apache/thrift/pull/1947 merges | ||
crouton_thrift : require('./imp/platform/node/crouton_thrift.js'), | ||
proto : require('./imp/generated_proto/collector_pb.js'), | ||
}; | ||
} |
@@ -39,2 +39,22 @@ describe("Span", function() { | ||
describe("Span#setBaggageItem", function() { | ||
it("sets the baggage item in the context", function() { | ||
var span = Tracer.startSpan('test'); | ||
span.setBaggageItem('my_baggage', 'my_value'); | ||
span.finish(); | ||
expect(span.context().getBaggageItem('my_baggage')).to.equal('my_value'); | ||
}); | ||
}); | ||
describe("Span#getBaggageItem", function() { | ||
it("gets the baggage item from the context", function() { | ||
var span = Tracer.startSpan('test'); | ||
span.context().setBaggageItem('my_baggage', 'my_value'); | ||
span.finish(); | ||
expect(span.getBaggageItem('my_baggage')).to.equal('my_value'); | ||
}); | ||
}); | ||
describe("Span#addTags", function() { | ||
@@ -41,0 +61,0 @@ it("supports addTags", function() { |
@@ -35,3 +35,8 @@ describe("Tracer", function() { | ||
}); | ||
it('propagates baggage items from parent to children', function() { | ||
var parent = Tracer.startSpan('test1'); | ||
parent.setBaggageItem('test1', 'value1'); | ||
var span = Tracer.startSpan('test2', { childOf : parent }); | ||
expect(span.getBaggageItem('test1')).to.equal('value1'); | ||
}); | ||
it('propagates sampled flag correctly', function() { | ||
@@ -38,0 +43,0 @@ var parent = Tracer.startSpan('test1'); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
23
3279004
196
48422
- Removedgoogle-protobuf@3.6.1
- Removedgoogle-protobuf@3.6.1(transitive)