@opentelemetry/exporter-zipkin 0.26.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -6
- package/build/src/index.js.map +1 -1
- package/build/src/platform/browser/index.js.map +1 -1
- package/build/src/platform/browser/util.js +2 -2
- package/build/src/platform/browser/util.js.map +1 -1
- package/build/src/platform/index.js.map +1 -1
- package/build/src/platform/node/index.js.map +1 -1
- package/build/src/platform/node/util.js.map +1 -1
- package/build/src/transform.d.ts +4 -4
- package/build/src/transform.js +14 -12
- package/build/src/transform.js.map +1 -1
- package/build/src/types.js.map +1 -1
- package/build/src/utils.js.map +1 -1
- package/build/src/version.d.ts +1 -1
- package/build/src/version.js +1 -1
- package/build/src/version.js.map +1 -1
- package/build/src/zipkin.js +6 -6
- package/build/src/zipkin.js.map +1 -1
- package/package.json +27 -22
- package/build/esm/index.d.ts +0 -4
- package/build/esm/index.js +0 -18
- package/build/esm/index.js.map +0 -1
- package/build/esm/platform/browser/index.d.ts +0 -2
- package/build/esm/platform/browser/index.js +0 -17
- package/build/esm/platform/browser/index.js.map +0 -1
- package/build/esm/platform/browser/util.d.ts +0 -9
- package/build/esm/platform/browser/util.js +0 -114
- package/build/esm/platform/browser/util.js.map +0 -1
- package/build/esm/platform/index.d.ts +0 -2
- package/build/esm/platform/index.js +0 -17
- package/build/esm/platform/index.js.map +0 -1
- package/build/esm/platform/node/index.d.ts +0 -2
- package/build/esm/platform/node/index.js +0 -17
- package/build/esm/platform/node/index.js.map +0 -1
- package/build/esm/platform/node/util.d.ts +0 -9
- package/build/esm/platform/node/util.js +0 -87
- package/build/esm/platform/node/util.js.map +0 -1
- package/build/esm/transform.d.ts +0 -18
- package/build/esm/transform.js +0 -74
- package/build/esm/transform.js.map +0 -1
- package/build/esm/types.d.ts +0 -158
- package/build/esm/types.js +0 -45
- package/build/esm/types.js.map +0 -1
- package/build/esm/utils.d.ts +0 -3
- package/build/esm/utils.js +0 -6
- package/build/esm/utils.js.map +0 -1
- package/build/esm/version.d.ts +0 -2
- package/build/esm/version.js +0 -18
- package/build/esm/version.js.map +0 -1
- package/build/esm/zipkin.d.ts +0 -38
- package/build/esm/zipkin.js +0 -120
- package/build/esm/zipkin.js.map +0 -1
package/build/esm/zipkin.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright The OpenTelemetry Authors
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { diag } from '@opentelemetry/api';
|
|
17
|
-
import { ExportResultCode, getEnv } from '@opentelemetry/core';
|
|
18
|
-
import { prepareSend } from './platform/index';
|
|
19
|
-
import { toZipkinSpan, defaultStatusCodeTagName, defaultStatusDescriptionTagName, } from './transform';
|
|
20
|
-
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
|
21
|
-
import { prepareGetHeaders } from './utils';
|
|
22
|
-
/**
|
|
23
|
-
* Zipkin Exporter
|
|
24
|
-
*/
|
|
25
|
-
var ZipkinExporter = /** @class */ (function () {
|
|
26
|
-
function ZipkinExporter(config) {
|
|
27
|
-
if (config === void 0) { config = {}; }
|
|
28
|
-
this.DEFAULT_SERVICE_NAME = 'OpenTelemetry Service';
|
|
29
|
-
this._sendingPromises = [];
|
|
30
|
-
this._urlStr = config.url || getEnv().OTEL_EXPORTER_ZIPKIN_ENDPOINT;
|
|
31
|
-
this._send = prepareSend(this._urlStr, config.headers);
|
|
32
|
-
this._serviceName = config.serviceName;
|
|
33
|
-
this._statusCodeTagName = config.statusCodeTagName || defaultStatusCodeTagName;
|
|
34
|
-
this._statusDescriptionTagName =
|
|
35
|
-
config.statusDescriptionTagName || defaultStatusDescriptionTagName;
|
|
36
|
-
this._isShutdown = false;
|
|
37
|
-
if (typeof config.getExportRequestHeaders === 'function') {
|
|
38
|
-
this._getHeaders = prepareGetHeaders(config.getExportRequestHeaders);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
// noop
|
|
42
|
-
this._beforeSend = function () { };
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Export spans.
|
|
47
|
-
*/
|
|
48
|
-
ZipkinExporter.prototype.export = function (spans, resultCallback) {
|
|
49
|
-
var _this = this;
|
|
50
|
-
var serviceName = String(this._serviceName ||
|
|
51
|
-
spans[0].resource.attributes[SemanticResourceAttributes.SERVICE_NAME] ||
|
|
52
|
-
this.DEFAULT_SERVICE_NAME);
|
|
53
|
-
diag.debug('Zipkin exporter export');
|
|
54
|
-
if (this._isShutdown) {
|
|
55
|
-
setTimeout(function () {
|
|
56
|
-
return resultCallback({
|
|
57
|
-
code: ExportResultCode.FAILED,
|
|
58
|
-
error: new Error('Exporter has been shutdown'),
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
var promise = new Promise(function (resolve) {
|
|
64
|
-
_this._sendSpans(spans, serviceName, function (result) {
|
|
65
|
-
resolve();
|
|
66
|
-
resultCallback(result);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
this._sendingPromises.push(promise);
|
|
70
|
-
var popPromise = function () {
|
|
71
|
-
var index = _this._sendingPromises.indexOf(promise);
|
|
72
|
-
_this._sendingPromises.splice(index, 1);
|
|
73
|
-
};
|
|
74
|
-
promise.then(popPromise, popPromise);
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Shutdown exporter. Noop operation in this exporter.
|
|
78
|
-
*/
|
|
79
|
-
ZipkinExporter.prototype.shutdown = function () {
|
|
80
|
-
var _this = this;
|
|
81
|
-
diag.debug('Zipkin exporter shutdown');
|
|
82
|
-
this._isShutdown = true;
|
|
83
|
-
return new Promise(function (resolve, reject) {
|
|
84
|
-
Promise.all(_this._sendingPromises).then(function () {
|
|
85
|
-
resolve();
|
|
86
|
-
}, reject);
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* if user defines getExportRequestHeaders in config then this will be called
|
|
91
|
-
* everytime before send, otherwise it will be replaced with noop in
|
|
92
|
-
* constructor
|
|
93
|
-
* @default noop
|
|
94
|
-
*/
|
|
95
|
-
ZipkinExporter.prototype._beforeSend = function () {
|
|
96
|
-
if (this._getHeaders) {
|
|
97
|
-
this._send = prepareSend(this._urlStr, this._getHeaders());
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Transform spans and sends to Zipkin service.
|
|
102
|
-
*/
|
|
103
|
-
ZipkinExporter.prototype._sendSpans = function (spans, serviceName, done) {
|
|
104
|
-
var _this = this;
|
|
105
|
-
var zipkinSpans = spans.map(function (span) {
|
|
106
|
-
return toZipkinSpan(span, String(span.attributes[SemanticResourceAttributes.SERVICE_NAME] ||
|
|
107
|
-
span.resource.attributes[SemanticResourceAttributes.SERVICE_NAME] ||
|
|
108
|
-
serviceName), _this._statusCodeTagName, _this._statusDescriptionTagName);
|
|
109
|
-
});
|
|
110
|
-
this._beforeSend();
|
|
111
|
-
return this._send(zipkinSpans, function (result) {
|
|
112
|
-
if (done) {
|
|
113
|
-
return done(result);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
return ZipkinExporter;
|
|
118
|
-
}());
|
|
119
|
-
export { ZipkinExporter };
|
|
120
|
-
//# sourceMappingURL=zipkin.js.map
|
package/build/esm/zipkin.js.map
DELETED
|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