Skip to content

Commit

Permalink
feat(opentelemetry-exporter-jaeger): http sender
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardodalcin committed Apr 13, 2020
1 parent ff58652 commit 3942759
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/opentelemetry-exporter-jaeger/src/jaeger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,17 @@ export class JaegerExporter implements SpanExporter {
typeof config.flushTimeout === 'number' ? config.flushTimeout : 2000;

config.host = config.host || process.env.JAEGER_AGENT_HOST;

config.endpoint = config.endpoint || process.env.JAEGER_ENDPOINT;
config.username = config.username || process.env.JAEGER_USER;
config.password = config.password || process.env.JAEGER_PASSWORD;
// https://github.com/jaegertracing/jaeger-client-node#environment-variables
// By default, the client sends traces via UDP to the agent at localhost:6832. Use JAEGER_AGENT_HOST and
// JAEGER_AGENT_PORT to send UDP traces to a different host:port. If JAEGER_ENDPOINT is set, the client sends traces
// to the endpoint via HTTP, making the JAEGER_AGENT_HOST and JAEGER_AGENT_PORT unused. If JAEGER_ENDPOINT is secured,
// HTTP basic authentication can be performed by setting the JAEGER_USER and JAEGER_PASSWORD environment variables.
this._sender = config.endpoint
? new jaegerTypes.HTTPSender(config)
: new jaegerTypes.UDPSender(config);
this._sender = new jaegerTypes.UDPSender(config);
if (this._sender._client instanceof Socket) {
// unref socket to prevent it from keeping the process running
Expand Down
9 changes: 9 additions & 0 deletions packages/opentelemetry-exporter-jaeger/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ export interface ExporterConfig {
maxPacketSize?: number; // default: 65000
/** Time to wait for an onShutdown flush to finish before closing the sender */
flushTimeout?: number; // default: 2000
//The HTTP endpoint for sending spans directly to a collector, i.e. http://jaeger-collector:14268/api/traces
//If setten will override host and port
endpoint?: string;
//Username to send as part of "Basic" authentication to the collector endpoint
username?: string;
//Password to send as part of "Basic" authentication to the collector endpoint
password?: string;
}

// Below require is needed as jaeger-client types does not expose the thrift,
Expand All @@ -41,6 +48,8 @@ export const Utils = require('jaeger-client/dist/src/util').default;
// tslint:disable-next-line:variable-name
export const ThriftUtils = require('jaeger-client/dist/src/thrift').default;

export const HTTPSender = require('jaeger-client/dist/src/reporters/http_sender').default;

export type TagValue = string | number | boolean;

export interface Tag {
Expand Down

0 comments on commit 3942759

Please sign in to comment.