Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/exporter-jaeger

Package Overview
Dependencies
Maintainers
5
Versions
205
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/exporter-jaeger - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

6

build/src/jaeger.d.ts

@@ -26,5 +26,4 @@ /*!

private readonly _sender;
private readonly _forceFlush;
private readonly _flushTimeout;
private _timer;
private readonly _forceFlushOnShutdown;
private readonly _onShutdownFlushTimeout;
constructor(config: jaegerTypes.ExporterConfig);

@@ -37,3 +36,4 @@ /** Exports a list of spans to Jaeger. */

private _sendSpans;
private _append;
private _flush;
}

@@ -22,3 +22,2 @@ "use strict";

const transform_1 = require("./transform");
const core_2 = require("@opentelemetry/core");
/**

@@ -29,9 +28,9 @@ * Format and sends span information to Jaeger Exporter.

constructor(config) {
this._forceFlush = true;
this._forceFlushOnShutdown = true;
this._logger = config.logger || new core_1.NoopLogger();
const tags = config.tags || [];
if (config.forceFlush !== undefined) {
this._forceFlush = config.forceFlush;
}
this._flushTimeout = config.flushTimeout || 2000;
this._forceFlushOnShutdown =
typeof config.forceFlush === 'boolean' ? config.forceFlush : true;
this._onShutdownFlushTimeout =
typeof config.flushTimeout === 'number' ? config.flushTimeout : 2000;
this._sender = new jaegerTypes.UDPSender(config);

@@ -43,14 +42,16 @@ this._process = {

this._sender.setProcess(this._process);
const flushInterval = config.flushInterval || 5000;
this._timer = setInterval(this._flush.bind(this), flushInterval);
core_2.unrefTimer(this._timer);
}
/** Exports a list of spans to Jaeger. */
export(spans, resultCallback) {
if (spans.length === 0) {
return resultCallback(base_1.ExportResult.SUCCESS);
}
this._logger.debug('Jaeger exporter export');
return this._sendSpans(spans, resultCallback);
this._sendSpans(spans, resultCallback).catch(err => {
this._logger.error(`JaegerExporter failed to export: ${err}`);
});
}
/** Shutdown exporter. */
shutdown() {
if (!this._forceFlush)
if (!this._forceFlushOnShutdown)
return;

@@ -63,32 +64,47 @@ // Make an optimistic flush.

this._sender.close();
}, this._flushTimeout);
}, this._onShutdownFlushTimeout);
}
/** Transform spans and sends to Jaeger service. */
_sendSpans(spans, done) {
async _sendSpans(spans, done) {
const thriftSpan = spans.map(span => transform_1.spanToThrift(span));
for (const span of thriftSpan) {
this._sender.append(span, (numSpans, err) => {
if (err) {
// @todo: decide whether to break out the loop on first error.
this._logger.error(`failed to append span: ${err}`);
if (done)
return done(base_1.ExportResult.FAILED_NOT_RETRYABLE);
}
});
try {
await this._append(span);
}
catch (err) {
this._logger.error(`failed to append span: ${err}`);
// TODO right now we break out on first error, is that desirable?
if (done)
return done(base_1.ExportResult.FAILED_NOT_RETRYABLE);
}
}
// @todo: We should wait for all the callbacks of the append calls to
// complete before it calls done with success.
this._logger.debug('successful append for : %s', thriftSpan.length);
// Flush all spans on each export. No-op if span buffer is empty
await this._flush();
if (done)
return done(base_1.ExportResult.SUCCESS);
}
_flush() {
this._sender.flush((numSpans, err) => {
if (err) {
this._logger.error(`failed to flush ${numSpans} spans: ${err}`);
}
async _append(span) {
return new Promise((resolve, reject) => {
this._sender.append(span, (count, err) => {
if (err) {
return reject(new Error(err));
}
resolve(count);
});
});
}
async _flush() {
await new Promise((resolve, reject) => {
this._sender.flush((_count, err) => {
if (err) {
return reject(new Error(err));
}
this._logger.debug('successful flush for %s spans', _count);
resolve();
});
});
}
}
exports.JaegerExporter = JaegerExporter;
//# sourceMappingURL=jaeger.js.map

@@ -43,2 +43,5 @@ "use strict";

}
if (span.kind !== undefined) {
tags.push({ key: 'span.kind', value: types_1.SpanKind[span.kind] });
}
const spanTags = types_2.ThriftUtils.getThriftTags(tags);

@@ -45,0 +48,0 @@ const logs = span.events.map((event) => {

@@ -28,5 +28,6 @@ /*!

maxPacketSize?: number;
/** Force a flush on shutdown */
forceFlush?: boolean;
/** Time to wait for an onShutdown flush to finish before closing the sender */
flushTimeout?: number;
flushInterval?: number;
}

@@ -33,0 +34,0 @@ export declare const UDPSender: any;

{
"name": "@opentelemetry/exporter-jaeger",
"version": "0.2.0",
"version": "0.3.0",
"description": "OpenTelemetry Exporter Jaeger allows user to send collected traces to Jaeger",

@@ -14,2 +14,3 @@ "main": "build/src/index.js",

"check": "gts check",
"precompile": "tsc --version",
"compile": "tsc -p .",

@@ -43,3 +44,3 @@ "fix": "gts fix",

"@types/node": "^12.6.9",
"codecov": "^3.5.0",
"codecov": "^3.6.1",
"gts": "^1.1.0",

@@ -53,11 +54,11 @@ "mocha": "^6.2.0",

"tslint-microsoft-contrib": "^6.2.0",
"typescript": "^3.6.3"
"typescript": "3.7.2"
},
"dependencies": {
"@opentelemetry/base": "^0.2.0",
"@opentelemetry/core": "^0.2.0",
"@opentelemetry/tracing": "^0.2.0",
"@opentelemetry/types": "^0.2.0",
"@opentelemetry/base": "^0.3.0",
"@opentelemetry/core": "^0.3.0",
"@opentelemetry/tracing": "^0.3.0",
"@opentelemetry/types": "^0.3.0",
"jaeger-client": "^3.15.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc