Skip to content

Commit

Permalink
Merge branch 'master' into markwolff/impl-redis
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurkale22 authored Nov 19, 2019
2 parents bf1e1a7 + 724f9cc commit d2e1f04
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 5 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ We have a weekly SIG meeting! See the [community page](https://github.com/open-t

Approvers ([@open-telemetry/js-approvers](https://github.com/orgs/open-telemetry/teams/javascript-approvers)):

- [Yuri Shkuro](https://github.com/yurishkuro), Uber
- [Roch Devost](https://github.com/rochdev), DataDog
- [Brandon Gonzalez](https://github.com/bg451), LightStep
- [Olivier Albertini](https://github.com/OlivierAlbertini), VilledeMontreal
Expand Down
10 changes: 10 additions & 0 deletions packages/opentelemetry-exporter-zipkin/src/zipkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class ZipkinExporter implements SpanExporter {
private readonly _statusCodeTagName: string;
private readonly _statusDescriptionTagName: string;
private readonly _reqOpts: http.RequestOptions;
private _isShutdown: boolean;

constructor(config: zipkinTypes.ExporterConfig) {
const urlStr = config.url || ZipkinExporter.DEFAULT_URL;
Expand All @@ -60,6 +61,7 @@ export class ZipkinExporter implements SpanExporter {
this._statusCodeTagName = config.statusCodeTagName || statusCodeTagName;
this._statusDescriptionTagName =
config.statusDescriptionTagName || statusDescriptionTagName;
this._isShutdown = false;
}

/**
Expand All @@ -70,6 +72,10 @@ export class ZipkinExporter implements SpanExporter {
resultCallback: (result: ExportResult) => void
) {
this._logger.debug('Zipkin exporter export');
if (this._isShutdown) {
setTimeout(() => resultCallback(ExportResult.FAILED_NOT_RETRYABLE));
return;
}
return this._sendSpans(spans, resultCallback);
}

Expand All @@ -78,6 +84,10 @@ export class ZipkinExporter implements SpanExporter {
*/
shutdown() {
this._logger.debug('Zipkin exporter shutdown');
if (this._isShutdown) {
return;
}
this._isShutdown = true;
// Make an optimistic flush.
if (this._forceFlush) {
// @todo get spans from span processor (batch)
Expand Down
14 changes: 14 additions & 0 deletions packages/opentelemetry-exporter-zipkin/test/zipkin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,20 @@ describe('ZipkinExporter', () => {
assert.strictEqual(result, ExportResult.FAILED_RETRYABLE);
});
});

it('should return FailedNonRetryable after shutdown', done => {
const exporter = new ZipkinExporter({
serviceName: 'my-service',
logger: new NoopLogger(),
});

exporter.shutdown();

exporter.export([getReadableSpan()], (result: ExportResult) => {
assert.strictEqual(result, ExportResult.FAILED_NOT_RETRYABLE);
done();
});
});
});

describe('shutdown', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@types/got": "^9.6.7",
"@types/mocha": "^5.2.7",
"@types/nock": "^11.1.0",
"@types/node": "^12.7.9",
"@types/node": "^12.12.9",
"@types/request-promise-native": "^1.0.17",
"@types/semver": "^6.0.2",
"@types/shimmer": "^1.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const assertSpan = (
hostname: string;
pathname: string;
reqHeaders?: http.OutgoingHttpHeaders;
path?: string;
path?: string | null;
forceStatus?: Status;
component: string;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-https/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@types/got": "^9.6.7",
"@types/mocha": "^5.2.7",
"@types/nock": "^11.1.0",
"@types/node": "^12.7.8",
"@types/node": "^12.12.9",
"@types/request-promise-native": "^1.0.17",
"@types/semver": "^6.0.2",
"@types/shimmer": "^1.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const assertSpan = (
hostname: string;
pathname: string;
reqHeaders?: http.OutgoingHttpHeaders;
path?: string;
path?: string | null;
component: string;
}
) => {
Expand Down

0 comments on commit d2e1f04

Please sign in to comment.