@opentelemetry/exporter-jaeger
Advanced tools
Comparing version 0.19.1-alpha.41 to 0.19.1-alpha.43
@@ -8,9 +8,9 @@ import { ExportResult } from '@opentelemetry/core'; | ||
export declare class JaegerExporter implements SpanExporter { | ||
private readonly _process; | ||
private readonly _sender; | ||
private readonly _onShutdownFlushTimeout; | ||
private readonly _localConfig; | ||
private _isShutdown; | ||
private _shutdownFlushTimeout; | ||
private _shuttingDownPromise; | ||
constructor(config: jaegerTypes.ExporterConfig); | ||
private _sender?; | ||
constructor(config?: jaegerTypes.ExporterConfig); | ||
/** Exports a list of spans to Jaeger. */ | ||
@@ -23,4 +23,5 @@ export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void; | ||
private _append; | ||
private _getSender; | ||
private _flush; | ||
} | ||
//# sourceMappingURL=jaeger.d.ts.map |
@@ -22,2 +22,3 @@ "use strict"; | ||
const dgram_1 = require("dgram"); | ||
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions"); | ||
const transform_1 = require("./transform"); | ||
@@ -33,3 +34,2 @@ const jaegerTypes = require("./types"); | ||
const localConfig = Object.assign({}, config); | ||
const tags = localConfig.tags || []; | ||
this._onShutdownFlushTimeout = | ||
@@ -52,17 +52,3 @@ typeof localConfig.flushTimeout === 'number' | ||
localConfig.host = localConfig.host || env.OTEL_EXPORTER_JAEGER_AGENT_HOST; | ||
if (localConfig.endpoint) { | ||
this._sender = new jaegerTypes.HTTPSender(localConfig); | ||
} | ||
else { | ||
this._sender = localConfig.endpoint = new jaegerTypes.UDPSender(localConfig); | ||
} | ||
if (this._sender._client instanceof dgram_1.Socket) { | ||
// unref socket to prevent it from keeping the process running | ||
this._sender._client.unref(); | ||
} | ||
this._process = { | ||
serviceName: localConfig.serviceName, | ||
tags: jaegerTypes.ThriftUtils.getThriftTags(tags), | ||
}; | ||
this._sender.setProcess(this._process); | ||
this._localConfig = localConfig; | ||
} | ||
@@ -131,7 +117,7 @@ /** Exports a list of spans to Jaeger. */ | ||
if (done) | ||
return done({ code: core_1.ExportResultCode.SUCCESS }); | ||
return process.nextTick(done, { code: core_1.ExportResultCode.SUCCESS }); | ||
} | ||
async _append(span) { | ||
return new Promise((resolve, reject) => { | ||
this._sender.append(span, (count, err) => { | ||
this._getSender(span).append(span, (count, err) => { | ||
if (err) { | ||
@@ -144,4 +130,25 @@ return reject(new Error(err)); | ||
} | ||
_getSender(span) { | ||
if (this._sender) { | ||
return this._sender; | ||
} | ||
const sender = this._localConfig.endpoint ? new jaegerTypes.HTTPSender(this._localConfig) : new jaegerTypes.UDPSender(this._localConfig); | ||
if (sender._client instanceof dgram_1.Socket) { | ||
// unref socket to prevent it from keeping the process running | ||
sender._client.unref(); | ||
} | ||
const serviceNameTag = span.tags.find(t => t.key === semantic_conventions_1.ResourceAttributes.SERVICE_NAME); | ||
const serviceName = (serviceNameTag === null || serviceNameTag === void 0 ? void 0 : serviceNameTag.vStr) || "unknown_service"; | ||
sender.setProcess({ | ||
serviceName, | ||
tags: jaegerTypes.ThriftUtils.getThriftTags(this._localConfig.tags || []), | ||
}); | ||
this._sender = sender; | ||
return sender; | ||
} | ||
async _flush() { | ||
await new Promise((resolve, reject) => { | ||
if (!this._sender) { | ||
return resolve(); | ||
} | ||
this._sender.flush((_count, err) => { | ||
@@ -148,0 +155,0 @@ if (err) { |
@@ -6,3 +6,2 @@ /// <reference types="node" /> | ||
export interface ExporterConfig { | ||
serviceName: string; | ||
tags?: Tag[]; | ||
@@ -9,0 +8,0 @@ host?: string; |
{ | ||
"name": "@opentelemetry/exporter-jaeger", | ||
"version": "0.19.1-alpha.41+7fa4ff70", | ||
"version": "0.19.1-alpha.43+d5517812", | ||
"description": "OpenTelemetry Exporter Jaeger allows user to send collected traces to Jaeger", | ||
@@ -44,3 +44,3 @@ "main": "build/src/index.js", | ||
"@opentelemetry/api": "^0.20.0", | ||
"@opentelemetry/resources": "^0.19.0", | ||
"@opentelemetry/resources": "^0.19.1-alpha.43+d5517812", | ||
"@types/mocha": "8.2.2", | ||
@@ -57,3 +57,3 @@ "@types/node": "14.14.43", | ||
"ts-node": "9.1.1", | ||
"typescript": "4.2.4" | ||
"typescript": "4.3.2" | ||
}, | ||
@@ -64,7 +64,8 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@opentelemetry/core": "^0.19.0", | ||
"@opentelemetry/tracing": "^0.19.1-alpha.41+7fa4ff70", | ||
"@opentelemetry/core": "^0.19.1-alpha.43+d5517812", | ||
"@opentelemetry/semantic-conventions": "^0.19.1-alpha.43+d5517812", | ||
"@opentelemetry/tracing": "^0.19.1-alpha.43+d5517812", | ||
"jaeger-client": "^3.15.0" | ||
}, | ||
"gitHead": "7fa4ff70d1aad5875cb14c6bff99c838228447bb" | ||
"gitHead": "d5517812b31d9206131bf1df4f8a3b5183ab07fb" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
45764
457
5