Skip to content

Commit

Permalink
fix: unref jaeger socket to prevent process running indefinitely (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored Jan 24, 2020
1 parent d7f4fe2 commit 801df25
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/opentelemetry-exporter-jaeger/src/jaeger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
* limitations under the License.
*/

import { SpanExporter, ReadableSpan } from '@opentelemetry/tracing';
import { ExportResult } from '@opentelemetry/base';
import * as jaegerTypes from './types';
import { NoopLogger } from '@opentelemetry/core';
import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing';
import * as types from '@opentelemetry/types';
import { Socket } from 'dgram';
import { spanToThrift } from './transform';
import * as jaegerTypes from './types';

/**
* Format and sends span information to Jaeger Exporter.
Expand All @@ -40,6 +41,11 @@ export class JaegerExporter implements SpanExporter {
typeof config.flushTimeout === 'number' ? config.flushTimeout : 2000;

this._sender = new jaegerTypes.UDPSender(config);
if (this._sender._client instanceof Socket) {
// unref socket to prevent it from keeping the process running
this._sender._client.unref();
}

this._process = {
serviceName: config.serviceName,
tags: jaegerTypes.ThriftUtils.getThriftTags(tags),
Expand Down

0 comments on commit 801df25

Please sign in to comment.