Skip to content

Commit

Permalink
fix(zipkin-exporter): address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Marton committed Aug 12, 2019
1 parent df93be2 commit 77d8a4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion packages/opentelemetry-exporter-zipkin/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const ZIPKIN_SPAN_KIND_MAPPING = {
[types.SpanKind.SERVER]: zipkinTypes.SpanKind.SERVER,
[types.SpanKind.CONSUMER]: zipkinTypes.SpanKind.CONSUMER,
[types.SpanKind.PRODUCER]: zipkinTypes.SpanKind.PRODUCER,
// TODO: discuss mapping
// Zipkin doesnt have type INTERNAL
[types.SpanKind.INTERNAL]: zipkinTypes.SpanKind.CLIENT,
};
Expand All @@ -48,7 +49,7 @@ export function toZipkinSpan(
id: span.spanContext.spanId,
kind: ZIPKIN_SPAN_KIND_MAPPING[span.kind],
timestamp: span.startTime * MICROS_PER_MILLI,
duration: Math.round(span.startTime - span.endTime * MICROS_PER_MILLI),
duration: (span.startTime - span.endTime) * MICROS_PER_MILLI,
debug: true,
// FIXME: how to determinate that it was created from existing span context?
// True if we are contributing to a span started by another tracer (ex on a different host).
Expand Down
4 changes: 2 additions & 2 deletions packages/opentelemetry-exporter-zipkin/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import * as types from '@opentelemetry/types';
* Exporter config
*/
export interface ExporterConfig {
url?: string;
logger?: types.Logger;
serviceName: string;
logger: types.Logger;
url?: string;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/opentelemetry-exporter-zipkin/src/zipkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export class ZipkinExporter implements SpanExporter {
) {
this._logger.debug('Zipkin exporter export');
// TODO: buffer spans (batch based on both time and max number)
const zipkinSpans = spans.map(this.toZipkinSpan);
const zipkinSpans = spans.map(this._toZipkinSpan);
// TODO: will the caller retry and manage backoff in the case ExportResult
// is FailedRetriable?
return this.send(zipkinSpans, resultCallback);
return this._send(zipkinSpans, resultCallback);
}

/**
Expand All @@ -72,14 +72,14 @@ export class ZipkinExporter implements SpanExporter {
/**
* Transforms an OpenTelemetry span to a Zipkin span.
*/
private toZipkinSpan(span: ReadableSpan): zipkinTypes.Span {
private _toZipkinSpan(span: ReadableSpan): zipkinTypes.Span {
return toZipkinSpan(this._serviceName, span);
}

/**
* Send spans to the remote Zipkin service.
*/
private send(
private _send(
zipkinSpans: zipkinTypes.Span[],
done: (result: ExportResult) => void
) {
Expand Down

0 comments on commit 77d8a4a

Please sign in to comment.