@opentelemetry/exporter-jaeger
Advanced tools
Comparing version 0.11.1-alpha.48 to 0.11.1-alpha.53
@@ -12,2 +12,5 @@ import { ExportResult } from '@opentelemetry/core'; | ||
private readonly _onShutdownFlushTimeout; | ||
private _isShutdown; | ||
private _shutdownFlushTimeout; | ||
private _shuttingDownPromise; | ||
constructor(config: jaegerTypes.ExporterConfig); | ||
@@ -17,3 +20,3 @@ /** Exports a list of spans to Jaeger. */ | ||
/** Shutdown exporter. */ | ||
shutdown(): void; | ||
shutdown(): Promise<void>; | ||
/** Transform spans and sends to Jaeger service. */ | ||
@@ -20,0 +23,0 @@ private _sendSpans; |
@@ -23,3 +23,2 @@ "use strict"; | ||
const jaegerTypes = require("./types"); | ||
const utils_1 = require("./utils"); | ||
/** | ||
@@ -30,2 +29,4 @@ * Format and sends span information to Jaeger Exporter. | ||
constructor(config) { | ||
this._isShutdown = false; | ||
this._shuttingDownPromise = Promise.resolve(); | ||
const localConfig = Object.assign({}, config); | ||
@@ -49,3 +50,2 @@ this._logger = localConfig.logger || new core_1.NoopLogger(); | ||
this._sender = new jaegerTypes.HTTPSender(localConfig); | ||
this._sender._httpOptions.headers[utils_1.OT_REQUEST_HEADER] = 1; | ||
} | ||
@@ -72,3 +72,3 @@ else { | ||
this._sendSpans(spans, resultCallback).catch(err => { | ||
this._logger.error(`JaegerExporter failed to export: ${err}`); | ||
core_1.globalErrorHandler(err); | ||
}); | ||
@@ -78,9 +78,34 @@ } | ||
shutdown() { | ||
// Make an optimistic flush. | ||
this._flush(); | ||
// Sleeping x seconds before closing the sender's connection to ensure | ||
// all spans are flushed. | ||
setTimeout(() => { | ||
this._sender.close(); | ||
}, this._onShutdownFlushTimeout); | ||
if (this._isShutdown) { | ||
return this._shuttingDownPromise; | ||
} | ||
this._isShutdown = true; | ||
this._shuttingDownPromise = new Promise((resolve, reject) => { | ||
let rejected = false; | ||
this._shutdownFlushTimeout = setTimeout(() => { | ||
rejected = true; | ||
reject('timeout'); | ||
this._sender.close(); | ||
}, this._onShutdownFlushTimeout); | ||
Promise.resolve() | ||
.then(() => { | ||
// Make an optimistic flush. | ||
return this._flush(); | ||
}) | ||
.then(() => { | ||
if (rejected) { | ||
return; | ||
} | ||
else { | ||
this._shutdownFlushTimeout && | ||
clearTimeout(this._shutdownFlushTimeout); | ||
resolve(); | ||
this._sender.close(); | ||
} | ||
}) | ||
.catch(e => { | ||
reject(e); | ||
}); | ||
}); | ||
return this._shuttingDownPromise; | ||
} | ||
@@ -95,3 +120,3 @@ /** Transform spans and sends to Jaeger service. */ | ||
catch (err) { | ||
this._logger.error(`failed to append span: ${err}`); | ||
core_1.globalErrorHandler(err); | ||
// TODO right now we break out on first error, is that desirable? | ||
@@ -98,0 +123,0 @@ if (done) |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.11.1-alpha.48+15174c6"; | ||
export declare const VERSION = "0.11.1-alpha.53+00a8ce7f"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.11.1-alpha.48+15174c6'; | ||
exports.VERSION = '0.11.1-alpha.53+00a8ce7f'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/exporter-jaeger", | ||
"version": "0.11.1-alpha.48+15174c6", | ||
"version": "0.11.1-alpha.53+00a8ce7f", | ||
"description": "OpenTelemetry Exporter Jaeger allows user to send collected traces to Jaeger", | ||
@@ -45,5 +45,6 @@ "main": "build/src/index.js", | ||
"devDependencies": { | ||
"@opentelemetry/resources": "^0.11.1-alpha.48+15174c6", | ||
"@opentelemetry/resources": "^0.11.1-alpha.53+00a8ce7f", | ||
"@types/mocha": "8.0.2", | ||
"@types/node": "14.0.27", | ||
"@types/sinon": "^9.0.8", | ||
"codecov": "3.7.2", | ||
@@ -55,13 +56,14 @@ "gts": "2.0.2", | ||
"rimraf": "3.0.2", | ||
"sinon": "^9.2.0", | ||
"ts-mocha": "7.0.0", | ||
"ts-node": "8.10.2", | ||
"ts-node": "9.0.0", | ||
"typescript": "3.9.7" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.11.1-alpha.48+15174c6", | ||
"@opentelemetry/core": "^0.11.1-alpha.48+15174c6", | ||
"@opentelemetry/tracing": "^0.11.1-alpha.48+15174c6", | ||
"@opentelemetry/api": "^0.11.1-alpha.53+00a8ce7f", | ||
"@opentelemetry/core": "^0.11.1-alpha.53+00a8ce7f", | ||
"@opentelemetry/tracing": "^0.11.1-alpha.53+00a8ce7f", | ||
"jaeger-client": "^3.15.0" | ||
}, | ||
"gitHead": "15174c6647ab9863dfc1424412fa60f2fddb3351" | ||
"gitHead": "00a8ce7f982ea24bcd4bc398477112894078ab29" | ||
} |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
43974
434
14
18