lightstep-tracer
Advanced tools
Comparing version 0.24.0 to 0.24.1-no-protobuf
@@ -6,2 +6,9 @@ # CHANGELOG | ||
## vNext | ||
## 0.24.1 | ||
* Guard session storage access | ||
* update type of collector_encryption | ||
* Fix propagator typo | ||
* Update typing on inclusion/exclusion patterns to match docs | ||
## 0.24.0 | ||
@@ -8,0 +15,0 @@ * Adds DataDog header support (#187) |
@@ -5,10 +5,10 @@ | ||
import * as opentracing from 'opentracing'; | ||
export interface TracerOptions { | ||
/** the project access token. Access tokens are used by the LightStep tracer client libraries to identify the project the tracer is reporting for */ | ||
access_token: string | ||
/** the string identifier for the application, service, or process. A Component is a logical service (or client) in a distributed system. The component usually represents a particular process or script in the distributed system */ | ||
component_name: string | ||
/** | ||
@@ -26,6 +26,6 @@ * controls the level of logging to the console | ||
verbosity?: number | ||
/** custom collector hostname */ | ||
collector_host?: string | ||
/** custom collector port */ | ||
@@ -36,3 +36,3 @@ collector_port?: number | ||
collector_path?: string | ||
/** optional, default='tls' | ||
@@ -42,3 +42,3 @@ * `tls` - use HTTPS encrypted connections | ||
*/ | ||
collector_encryption?: string | ||
collector_encryption?: "tls" | "none" | ||
@@ -61,4 +61,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 | ||
@@ -122,3 +121,3 @@ */ | ||
instrument_page_load?: boolean | ||
/** | ||
@@ -134,3 +133,3 @@ * optional. browser-only. if enabled, automatically instruments all XHR requests with context headers. | ||
*/ | ||
xhr_url_inclusion_patterns?: any | ||
xhr_url_inclusion_patterns?: RegExp[] | ||
@@ -141,4 +140,4 @@ /** | ||
*/ | ||
xhr_url_exclusion_patterns?: any | ||
xhr_url_exclusion_patterns?: RegExp[] | ||
/** | ||
@@ -154,3 +153,3 @@ * optional. browser-only. if enabled, automatically instrument all window.fetch requests with context.headers. | ||
*/ | ||
fetch_url_inclusion_patterns?: any | ||
fetch_url_inclusion_patterns?: RegExp[] | ||
@@ -161,3 +160,3 @@ /** | ||
*/ | ||
fetch_url_exclusion_patterns?: any | ||
fetch_url_exclusion_patterns?: RegExp[] | ||
@@ -175,3 +174,3 @@ /** | ||
*/ | ||
nodejs_inclusion_patterns?: any | ||
nodejs_inclusion_patterns?: RegExp[] | ||
@@ -183,3 +182,3 @@ /** | ||
*/ | ||
nodejs_exclusion_patterns?: any | ||
nodejs_exclusion_patterns?: RegExp[] | ||
@@ -186,0 +185,0 @@ /** |
@@ -14,3 +14,2 @@ 'use strict'; | ||
// eslint-disable-line camelcase | ||
var proto = require('./generated_proto/collector_pb.js'); | ||
@@ -40,9 +39,2 @@ var AuthImp = function () { | ||
} | ||
}, { | ||
key: 'toProto', | ||
value: function toProto() { | ||
var authProto = new proto.Auth(); | ||
authProto.setAccessToken(this._accessToken); | ||
return authProto; | ||
} | ||
}]); | ||
@@ -49,0 +41,0 @@ |
@@ -27,5 +27,2 @@ 'use strict'; | ||
// eslint-disable-line camelcase | ||
var proto = require('./generated_proto/collector_pb.js'); | ||
var googleProtobufTimestampPB = require('google-protobuf/google/protobuf/timestamp_pb.js'); | ||
var LogRecordImp = function () { | ||
@@ -126,34 +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 millis = Math.floor(this._timestampMicros / 1000); | ||
var secs = Math.floor(millis / 1000); | ||
var nanos = millis % 1000 * 1000000; | ||
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; | ||
} | ||
}]); | ||
@@ -160,0 +125,0 @@ |
@@ -125,3 +125,12 @@ 'use strict'; | ||
value: function localStoreGet(key) { | ||
if (!window.sessionStorage) { | ||
try { | ||
if (!window.sessionStorage) { | ||
return null; | ||
} | ||
} catch (_ignored) { | ||
// Accessing `sessionStorage` or `localStorage` in an `<iframe>` in Chrome throws when | ||
// the user setting "block third-party cookies and site data" is turned on. | ||
// | ||
// eslint-disable-next-line max-len | ||
// https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document | ||
return null; | ||
@@ -138,3 +147,8 @@ } | ||
value: function localStoreSet(key, value) { | ||
if (!window.sessionStorage) { | ||
try { | ||
if (!window.sessionStorage) { | ||
return; | ||
} | ||
} catch (_ignored) { | ||
// (See comment above) | ||
return; | ||
@@ -141,0 +155,0 @@ } |
@@ -29,5 +29,5 @@ 'use strict'; | ||
var DDProgagator = function () { | ||
function DDProgagator(tracer) { | ||
_classCallCheck(this, DDProgagator); | ||
var DDPropagator = function () { | ||
function DDPropagator(tracer) { | ||
_classCallCheck(this, DDPropagator); | ||
@@ -39,3 +39,3 @@ this._tracer = tracer; | ||
_createClass(DDProgagator, [{ | ||
_createClass(DDPropagator, [{ | ||
key: 'inject', | ||
@@ -137,8 +137,8 @@ value: function inject(spanContext, carrier) { | ||
return DDProgagator; | ||
return DDPropagator; | ||
}(); | ||
exports.default = DDProgagator; | ||
exports.default = DDPropagator; | ||
module.exports = exports.default; | ||
//# sourceMappingURL=propagator_dd.js.map |
@@ -27,4 +27,2 @@ 'use strict'; | ||
var proto = require('./generated_proto/collector_pb.js'); | ||
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); | ||
reportProto.setInternalMetrics(internalMetrics); | ||
return reportProto; | ||
} | ||
}]); | ||
@@ -125,0 +95,0 @@ |
@@ -27,3 +27,2 @@ 'use strict'; | ||
var proto = require('./generated_proto/collector_pb.js'); | ||
var converter = require('hex2dec'); | ||
@@ -62,48 +61,2 @@ var packageObject = require('../../package.json'); | ||
} | ||
}, { | ||
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 +63,0 @@ |
@@ -52,4 +52,2 @@ 'use strict'; | ||
var converter = require('hex2dec'); | ||
var proto = require('./generated_proto/collector_pb.js'); | ||
var googleProtobufTimestampPB = require('google-protobuf/google/protobuf/timestamp_pb.js'); | ||
@@ -294,60 +292,2 @@ var SpanImp = function (_opentracing$Span) { | ||
} | ||
}, { | ||
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 startMillis = Math.floor(this._beginMicros / 1000); | ||
var startSeconds = Math.floor(startMillis / 1000); | ||
var startNanos = startMillis % 1000 * 1000000; | ||
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 = undefined; | ||
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; | ||
} | ||
}]); | ||
@@ -354,0 +294,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.'); | ||
} | ||
@@ -281,3 +277,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' }); | ||
@@ -284,0 +280,0 @@ // Non-standard, may be deprecated |
@@ -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,6 +20,4 @@ } else { | ||
ThriftTransport: require('./imp/platform/node/transport_httpthrift.js'), | ||
ProtoTransport: require('./imp/platform/node/transport_httpproto.js'), | ||
thrift: require('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') | ||
}; | ||
@@ -28,0 +24,0 @@ } |
{ | ||
"name": "lightstep-tracer", | ||
"version": "0.24.0", | ||
"version": "0.24.1-no-protobuf", | ||
"main": "index.js", | ||
@@ -21,3 +21,2 @@ "types": "index.d.ts", | ||
"eventemitter3": "1.1.1", | ||
"google-protobuf": "3.6.1", | ||
"hex2dec": "1.0.1", | ||
@@ -60,3 +59,2 @@ "source-map-support": "0.3.3", | ||
"opentracing": "^0.14.4", | ||
"protobufjs": "6.8.8", | ||
"shelljs": "0.5.3", | ||
@@ -63,0 +61,0 @@ "sprintf-js": "1.0.3", |
@@ -124,3 +124,3 @@ # lightstep-tracer | ||
* `disable_meta_event_reporting` `bool` *optional*, *default=false* - when `disable_meta_event_reporting` is set to `true`, the tracer will disable meta event reporting even if requested by the Satellite. | ||
* `propagator` `dictionary` *optional*, *defaults=*`{opentracing.FORMAT_HTTP: LightStepPropagator, opentracing.FORMAT_TEXT_MAP: LightStepPropagator, opentracing.FORMAT_BINARY: UnsupportedPropagator}`: Allows inject/extract to use custom propagators for different formats. This package includes a `B3Propagator` that supports B3 headers on text maps and http headers. `DDPropagator` supports DataDog trace headers. | ||
* `propagator` `dictionary` *optional*, *defaults=*`{opentracing.FORMAT_HTTP_HEADERS: LightStepPropagator, opentracing.FORMAT_TEXT_MAP: LightStepPropagator, opentracing.FORMAT_BINARY: UnsupportedPropagator}`: Allows inject/extract to use custom propagators for different formats. This package includes a `B3Propagator` that supports B3 headers on text maps and http headers. `DDPropagator` supports DataDog trace headers. | ||
@@ -127,0 +127,0 @@ ### SpanImp |
import { crouton_thrift } from '../platform_abstraction_layer'; // eslint-disable-line camelcase | ||
let proto = require('./generated_proto/collector_pb.js'); | ||
@@ -22,8 +21,2 @@ export default class AuthImp { | ||
} | ||
toProto() { | ||
let authProto = new proto.Auth(); | ||
authProto.setAccessToken(this._accessToken); | ||
return authProto; | ||
} | ||
} |
import { crouton_thrift } from '../platform_abstraction_layer'; // eslint-disable-line camelcase | ||
import _each from '../_each'; | ||
import * as coerce from './coerce'; // eslint-disable-line camelcase | ||
let proto = require('./generated_proto/collector_pb.js'); | ||
let googleProtobufTimestampPB = require('google-protobuf/google/protobuf/timestamp_pb.js'); | ||
export default class LogRecordImp { | ||
@@ -91,31 +88,2 @@ constructor(logFieldKeyHardLimit, logFieldValueHardLimit, timestampMicros, fields) { | ||
} | ||
toProto() { | ||
this._clearOverLimits(); | ||
let log = new proto.Log(); | ||
let ts = new googleProtobufTimestampPB.Timestamp(); | ||
let millis = Math.floor(this._timestampMicros / 1000); | ||
let secs = Math.floor(millis / 1000); | ||
let nanos = (millis % 1000) * 1000000; | ||
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; | ||
} | ||
} |
@@ -118,3 +118,12 @@ const optionsParser = require('./options_parser.js'); | ||
localStoreGet(key) { | ||
if (!window.sessionStorage) { | ||
try { | ||
if (!window.sessionStorage) { | ||
return null; | ||
} | ||
} catch (_ignored) { | ||
// Accessing `sessionStorage` or `localStorage` in an `<iframe>` in Chrome throws when | ||
// the user setting "block third-party cookies and site data" is turned on. | ||
// | ||
// eslint-disable-next-line max-len | ||
// https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document | ||
return null; | ||
@@ -130,3 +139,8 @@ } | ||
localStoreSet(key, value) { | ||
if (!window.sessionStorage) { | ||
try { | ||
if (!window.sessionStorage) { | ||
return; | ||
} | ||
} catch (_ignored) { | ||
// (See comment above) | ||
return; | ||
@@ -133,0 +147,0 @@ } |
@@ -7,3 +7,3 @@ import _each from '../_each'; | ||
export default class DDProgagator { | ||
export default class DDPropagator { | ||
constructor(tracer) { | ||
@@ -10,0 +10,0 @@ this._tracer = tracer; |
import { crouton_thrift } from '../platform_abstraction_layer'; // eslint-disable-line camelcase | ||
import _each from '../_each'; // eslint-disable-line camelcase | ||
import * as coerce from './coerce.js'; | ||
let proto = require('./generated_proto/collector_pb.js'); | ||
@@ -62,29 +61,2 @@ export default class ReportImp { | ||
} | ||
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); | ||
reportProto.setInternalMetrics(internalMetrics); | ||
return reportProto; | ||
} | ||
} |
import { crouton_thrift } from '../platform_abstraction_layer'; // eslint-disable-line camelcase | ||
import _each from '../_each'; // eslint-disable-line camelcase | ||
import * as coerce from './coerce.js'; | ||
let proto = require('./generated_proto/collector_pb.js'); | ||
let converter = require('hex2dec'); | ||
@@ -34,47 +33,2 @@ const packageObject = require('../../package.json'); | ||
} | ||
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,5 +9,2 @@ import * as coerce from './coerce.js'; | ||
let converter = require('hex2dec'); | ||
let proto = require('./generated_proto/collector_pb.js'); | ||
let googleProtobufTimestampPB = require('google-protobuf/google/protobuf/timestamp_pb.js'); | ||
export default class SpanImp extends opentracing.Span { | ||
@@ -222,57 +219,2 @@ | ||
} | ||
_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 startMillis = Math.floor(this._beginMicros / 1000); | ||
let startSeconds = Math.floor(startMillis / 1000); | ||
let startNanos = (startMillis % 1000) * 1000000; | ||
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 = undefined; | ||
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'; | ||
@@ -144,6 +144,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': | ||
@@ -154,4 +150,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.'); | ||
} | ||
@@ -238,3 +234,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' }); | ||
@@ -241,0 +237,0 @@ // Non-standard, may be deprecated |
@@ -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,7 +18,5 @@ } else { | ||
ThriftTransport : require('./imp/platform/node/transport_httpthrift.js'), | ||
ProtoTransport : require('./imp/platform/node/transport_httpproto.js'), | ||
thrift : require('thrift'), | ||
crouton_thrift : require('./imp/platform/node/crouton_thrift.js'), | ||
proto : require('./imp/generated_proto/collector_pb.js'), | ||
}; | ||
} |
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
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
5
38
18
2651058
183
44832
- Removedgoogle-protobuf@3.6.1
- Removedgoogle-protobuf@3.6.1(transitive)