@opentelemetry/exporter-zipkin 1.0.1 → 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/platform/browser/util.js +2 -2
- package/build/src/platform/browser/util.js.map +1 -1
- package/build/src/transform.js +3 -3
- package/build/src/transform.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 +5 -5
- package/build/src/zipkin.js.map +1 -1
- package/package.json +26 -21
- 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 -76
- 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/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# OpenTelemetry Zipkin Trace Exporter
|
|
2
2
|
|
|
3
3
|
[![NPM Published Version][npm-img]][npm-url]
|
|
4
|
-
[![dependencies][dependencies-image]][dependencies-url]
|
|
5
|
-
[![devDependencies][devDependencies-image]][devDependencies-url]
|
|
6
4
|
[![Apache License][license-image]][license-image]
|
|
7
5
|
|
|
8
6
|
OpenTelemetry Zipkin Trace Exporter allows the user to send collected traces to Zipkin.
|
|
@@ -74,9 +72,5 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
|
|
|
74
72
|
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
|
|
75
73
|
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
|
|
76
74
|
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
|
|
77
|
-
[dependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-zipkin
|
|
78
|
-
[dependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-zipkin
|
|
79
|
-
[devDependencies-image]: https://status.david-dm.org/gh/open-telemetry/opentelemetry-js.svg?path=packages%2Fopentelemetry-exporter-zipkin&type=dev
|
|
80
|
-
[devDependencies-url]: https://david-dm.org/open-telemetry/opentelemetry-js?path=packages%2Fopentelemetry-exporter-zipkin&type=dev
|
|
81
75
|
[npm-url]: https://www.npmjs.com/package/@opentelemetry/exporter-zipkin
|
|
82
76
|
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fexporter-zipkin.svg
|
|
@@ -74,7 +74,7 @@ function sendWithBeacon(data, done, urlStr) {
|
|
|
74
74
|
* @param xhrHeaders
|
|
75
75
|
*/
|
|
76
76
|
function sendWithXhr(data, done, urlStr, xhrHeaders = {}) {
|
|
77
|
-
const xhr = new
|
|
77
|
+
const xhr = new XMLHttpRequest();
|
|
78
78
|
xhr.open('POST', urlStr);
|
|
79
79
|
Object.entries(xhrHeaders).forEach(([k, v]) => {
|
|
80
80
|
xhr.setRequestHeader(k, v);
|
|
@@ -95,7 +95,7 @@ function sendWithXhr(data, done, urlStr, xhrHeaders = {}) {
|
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
xhr.onerror = msg => {
|
|
98
|
-
core_1.globalErrorHandler(new Error(`Zipkin request error: ${msg}`));
|
|
98
|
+
(0, core_1.globalErrorHandler)(new Error(`Zipkin request error: ${msg}`));
|
|
99
99
|
return done({ code: core_1.ExportResultCode.FAILED });
|
|
100
100
|
};
|
|
101
101
|
// Issue request to remote service
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../src/platform/browser/util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0C;AAC1C,8CAI6B;AAG7B;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,MAAc,EAAE,OAAgC;IAC1E,IAAI,UAAkC,CAAC;IACvC,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,UAAU,KAAK,UAAU,IAAI,CAAC,OAAO,CAAC;IACzE,IAAI,OAAO,EAAE;QACX,UAAU,mBACR,MAAM,EAAE,kBAAkB,EAC1B,cAAc,EAAE,kBAAkB,IAC/B,OAAO,CACX,CAAC;KACH;IAED;;OAEG;IACH,OAAO,SAAS,IAAI,CAClB,WAA+B,EAC/B,IAAoC;QAEpC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,UAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;YAC3C,OAAO,IAAI,CAAC,EAAE,IAAI,EAAE,uBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;SACjD;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC5C,IAAI,SAAS,EAAE;YACb,cAAc,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;S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AAC;IAC7B,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,kBAAkB,GAAG,GAAG,EAAE;QAC5B,IAAI,GAAG,CAAC,UAAU,KAAK,cAAc,CAAC,IAAI,EAAE;YAC1C,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;YACnC,UAAI,CAAC,KAAK,CAAC,gCAAgC,UAAU,WAAW,IAAI,EAAE,CAAC,CAAC;YAExE,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE;gBACzC,OAAO,IAAI,CAAC,EAAE,IAAI,EAAE,uBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;aACjD;iBAAM;gBACL,OAAO,IAAI,CAAC;oBACV,IAAI,EAAE,uBAAgB,CAAC,MAAM;oBAC7B,KAAK,EAAE,IAAI,KAAK,CACd,2CAA2C,GAAG,CAAC,MAAM,EAAE,CACxD;iBACF,CAAC,CAAC;aACJ;SACF;IACH,CAAC,CAAC;IAEF,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,EAAE;QAClB,IAAA,yBAAkB,EAAC,IAAI,KAAK,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,EAAE,IAAI,EAAE,uBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC,CAAC;IAEF,kCAAkC;IAClC,UAAI,CAAC,KAAK,CAAC,2BAA2B,IAAI,EAAE,CAAC,CAAC;IAC9C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n globalErrorHandler,\n} from '@opentelemetry/core';\nimport * as zipkinTypes from '../../types';\n\n/**\n * Prepares send function that will send spans to the remote Zipkin service.\n * @param urlStr - url to send spans\n * @param headers - headers\n * send\n */\nexport function prepareSend(urlStr: string, headers?: Record<string, string>): zipkinTypes.SendFn {\n let xhrHeaders: Record<string, string>;\n const useBeacon = typeof navigator.sendBeacon === 'function' && !headers;\n if (headers) {\n xhrHeaders = {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...headers,\n };\n }\n\n /**\n * Send spans to the remote Zipkin service.\n */\n return function send(\n zipkinSpans: zipkinTypes.Span[],\n done: (result: ExportResult) => void\n ) {\n if (zipkinSpans.length === 0) {\n diag.debug('Zipkin send with empty spans');\n return done({ code: ExportResultCode.SUCCESS });\n }\n const payload = JSON.stringify(zipkinSpans);\n if (useBeacon) {\n sendWithBeacon(payload, done, urlStr);\n } else {\n sendWithXhr(payload, done, urlStr, xhrHeaders);\n }\n };\n}\n\n/**\n * Sends data using beacon\n * @param data\n * @param done\n * @param urlStr\n */\nfunction sendWithBeacon(\n data: string,\n done: (result: ExportResult) => void,\n urlStr: string\n) {\n if (navigator.sendBeacon(urlStr, data)) {\n diag.debug('sendBeacon - can send', data);\n done({ code: ExportResultCode.SUCCESS });\n } else {\n done({\n code: ExportResultCode.FAILED,\n error: new Error(`sendBeacon - cannot send ${data}`),\n });\n }\n}\n\n/**\n * Sends data using XMLHttpRequest\n * @param data\n * @param done\n * @param urlStr\n * @param xhrHeaders\n */\nfunction sendWithXhr(\n data: string,\n done: (result: ExportResult) => void,\n urlStr: string,\n xhrHeaders: Record<string, string> = {}\n) {\n const xhr = new XMLHttpRequest();\n xhr.open('POST', urlStr);\n Object.entries(xhrHeaders).forEach(([k, v]) => {\n xhr.setRequestHeader(k, v);\n });\n\n xhr.onreadystatechange = () => {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n const statusCode = xhr.status || 0;\n diag.debug(`Zipkin response status code: ${statusCode}, body: ${data}`);\n\n if (xhr.status >= 200 && xhr.status < 400) {\n return done({ code: ExportResultCode.SUCCESS });\n } else {\n return done({\n code: ExportResultCode.FAILED,\n error: new Error(\n `Got unexpected status code from zipkin: ${xhr.status}`\n ),\n });\n }\n }\n };\n\n xhr.onerror = msg => {\n globalErrorHandler(new Error(`Zipkin request error: ${msg}`));\n return done({ code: ExportResultCode.FAILED });\n };\n\n // Issue request to remote service\n diag.debug(`Zipkin request payload: ${data}`);\n xhr.send(data);\n}\n"]}
|
package/build/src/transform.js
CHANGED
|
@@ -40,8 +40,8 @@ function toZipkinSpan(span, serviceName, statusCodeTagName, statusErrorTagName)
|
|
|
40
40
|
name: span.name,
|
|
41
41
|
id: span.spanContext().spanId,
|
|
42
42
|
kind: ZIPKIN_SPAN_KIND_MAPPING[span.kind],
|
|
43
|
-
timestamp: core_1.hrTimeToMicroseconds(span.startTime),
|
|
44
|
-
duration: core_1.hrTimeToMicroseconds(span.duration),
|
|
43
|
+
timestamp: (0, core_1.hrTimeToMicroseconds)(span.startTime),
|
|
44
|
+
duration: (0, core_1.hrTimeToMicroseconds)(span.duration),
|
|
45
45
|
localEndpoint: { serviceName },
|
|
46
46
|
tags: _toZipkinTags(span.attributes, span.status, statusCodeTagName, statusErrorTagName, span.resource),
|
|
47
47
|
annotations: span.events.length
|
|
@@ -72,7 +72,7 @@ exports._toZipkinTags = _toZipkinTags;
|
|
|
72
72
|
*/
|
|
73
73
|
function _toZipkinAnnotations(events) {
|
|
74
74
|
return events.map(event => ({
|
|
75
|
-
timestamp: core_1.hrTimeToMicroseconds(event.time),
|
|
75
|
+
timestamp: (0, core_1.hrTimeToMicroseconds)(event.time),
|
|
76
76
|
value: event.name,
|
|
77
77
|
}));
|
|
78
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/transform.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,0CAA0C;AAE1C,8CAA2D;AAC3D,uCAAuC;AAGvC,MAAM,wBAAwB,GAAG;IAC/B,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,MAAM;IAClD,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,MAAM;IAClD,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,QAAQ;IACtD,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,QAAQ;IACtD,kCAAkC;IAClC,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS;CACnC,CAAC;AAEW,QAAA,wBAAwB,GAAG,kBAAkB,CAAC;AAC9C,QAAA,yBAAyB,GAAG,OAAO,CAAC;AAEjD;;;GAGG;AACH,SAAgB,YAAY,CAC1B,IAAkB,EAClB,WAAmB,EACnB,iBAAyB,EACzB,kBAA0B;IAE1B,MAAM,UAAU,GAAqB;QACnC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO;QACnC,QAAQ,EAAE,IAAI,CAAC,YAAY;QAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM;QAC7B,IAAI,EAAE,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC;QACzC,SAAS,EAAE,2BAAoB,
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/transform.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,0CAA0C;AAE1C,8CAA2D;AAC3D,uCAAuC;AAGvC,MAAM,wBAAwB,G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QAC3C,KAAK,EAAE,KAAK,CAAC,IAAI;KAClB,CAAC,CAAC,CAAC;AACN,CAAC;AAPD,oDAOC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as api from '@opentelemetry/api';\nimport { ReadableSpan, TimedEvent } from '@opentelemetry/sdk-trace-base';\nimport { hrTimeToMicroseconds } from '@opentelemetry/core';\nimport * as zipkinTypes from './types';\nimport { Resource } from '@opentelemetry/resources';\n\nconst ZIPKIN_SPAN_KIND_MAPPING = {\n [api.SpanKind.CLIENT]: zipkinTypes.SpanKind.CLIENT,\n [api.SpanKind.SERVER]: zipkinTypes.SpanKind.SERVER,\n [api.SpanKind.CONSUMER]: zipkinTypes.SpanKind.CONSUMER,\n [api.SpanKind.PRODUCER]: zipkinTypes.SpanKind.PRODUCER,\n // When absent, the span is local.\n [api.SpanKind.INTERNAL]: undefined,\n};\n\nexport const defaultStatusCodeTagName = 'otel.status_code';\nexport const defaultStatusErrorTagName = 'error';\n\n/**\n * Translate OpenTelemetry ReadableSpan to ZipkinSpan format\n * @param span Span to be translated\n */\nexport function toZipkinSpan(\n span: ReadableSpan,\n serviceName: string,\n statusCodeTagName: string,\n statusErrorTagName: string\n): zipkinTypes.Span {\n const zipkinSpan: zipkinTypes.Span = {\n traceId: span.spanContext().traceId,\n parentId: span.parentSpanId,\n name: span.name,\n id: span.spanContext().spanId,\n kind: ZIPKIN_SPAN_KIND_MAPPING[span.kind],\n timestamp: hrTimeToMicroseconds(span.startTime),\n duration: hrTimeToMicroseconds(span.duration),\n localEndpoint: { serviceName },\n tags: _toZipkinTags(\n span.attributes,\n span.status,\n statusCodeTagName,\n statusErrorTagName,\n span.resource\n ),\n annotations: span.events.length\n ? _toZipkinAnnotations(span.events)\n : undefined,\n };\n\n return zipkinSpan;\n}\n\n/** Converts OpenTelemetry SpanAttributes and SpanStatus to Zipkin Tags format. */\nexport function _toZipkinTags(\n attributes: api.SpanAttributes,\n status: api.SpanStatus,\n statusCodeTagName: string,\n statusErrorTagName: string,\n resource: Resource\n): zipkinTypes.Tags {\n const tags: { [key: string]: string } = {};\n for (const key of Object.keys(attributes)) {\n tags[key] = String(attributes[key]);\n }\n if (status.code !== api.SpanStatusCode.UNSET) {\n tags[statusCodeTagName] = String(api.SpanStatusCode[status.code]);\n }\n if (status.code === api.SpanStatusCode.ERROR && status.message) {\n tags[statusErrorTagName] = status.message;\n }\n\n Object.keys(resource.attributes).forEach(\n name => (tags[name] = String(resource.attributes[name]))\n );\n\n return tags;\n}\n\n/**\n * Converts OpenTelemetry Events to Zipkin Annotations format.\n */\nexport function _toZipkinAnnotations(\n events: TimedEvent[]\n): zipkinTypes.Annotation[] {\n return events.map(event => ({\n timestamp: hrTimeToMicroseconds(event.time),\n value: event.name,\n }));\n}\n"]}
|
package/build/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.0
|
|
1
|
+
export declare const VERSION = "1.1.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/src/version.js
CHANGED
package/build/src/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '1.0
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,OAAO,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '1.1.0';\n"]}
|
package/build/src/zipkin.js
CHANGED
|
@@ -29,15 +29,15 @@ class ZipkinExporter {
|
|
|
29
29
|
constructor(config = {}) {
|
|
30
30
|
this.DEFAULT_SERVICE_NAME = 'OpenTelemetry Service';
|
|
31
31
|
this._sendingPromises = [];
|
|
32
|
-
this._urlStr = config.url || core_1.getEnv().OTEL_EXPORTER_ZIPKIN_ENDPOINT;
|
|
33
|
-
this._send = index_1.prepareSend(this._urlStr, config.headers);
|
|
32
|
+
this._urlStr = config.url || (0, core_1.getEnv)().OTEL_EXPORTER_ZIPKIN_ENDPOINT;
|
|
33
|
+
this._send = (0, index_1.prepareSend)(this._urlStr, config.headers);
|
|
34
34
|
this._serviceName = config.serviceName;
|
|
35
35
|
this._statusCodeTagName = config.statusCodeTagName || transform_1.defaultStatusCodeTagName;
|
|
36
36
|
this._statusDescriptionTagName =
|
|
37
37
|
config.statusDescriptionTagName || transform_1.defaultStatusErrorTagName;
|
|
38
38
|
this._isShutdown = false;
|
|
39
39
|
if (typeof config.getExportRequestHeaders === 'function') {
|
|
40
|
-
this._getHeaders = utils_1.prepareGetHeaders(config.getExportRequestHeaders);
|
|
40
|
+
this._getHeaders = (0, utils_1.prepareGetHeaders)(config.getExportRequestHeaders);
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
// noop
|
|
@@ -92,14 +92,14 @@ class ZipkinExporter {
|
|
|
92
92
|
*/
|
|
93
93
|
_beforeSend() {
|
|
94
94
|
if (this._getHeaders) {
|
|
95
|
-
this._send = index_1.prepareSend(this._urlStr, this._getHeaders());
|
|
95
|
+
this._send = (0, index_1.prepareSend)(this._urlStr, this._getHeaders());
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* Transform spans and sends to Zipkin service.
|
|
100
100
|
*/
|
|
101
101
|
_sendSpans(spans, serviceName, done) {
|
|
102
|
-
const zipkinSpans = spans.map(span => transform_1.toZipkinSpan(span, String(span.attributes[semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME] ||
|
|
102
|
+
const zipkinSpans = spans.map(span => (0, transform_1.toZipkinSpan)(span, String(span.attributes[semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME] ||
|
|
103
103
|
span.resource.attributes[semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME] ||
|
|
104
104
|
serviceName), this._statusCodeTagName, this._statusDescriptionTagName));
|
|
105
105
|
this._beforeSend();
|
package/build/src/zipkin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zipkin.js","sourceRoot":"","sources":["../../src/zipkin.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,4CAA0C;AAC1C,8CAA6E;AAE7E,4CAA+C;AAE/C,2CAIqB;AACrB,8EAAiF;AACjF,mCAA4C;AAE5C;;GAEG;AACH,MA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CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC3C,OAAO,EAAE,CAAC;YACZ,CAAC,EAAE,MAAM,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACK,WAAW;QACjB,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,IAAI,CAAC,KAAK,GAAG,IAAA,mBAAW,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;SAC5D;IACH,CAAC;IAED;;OAEG;IACK,UAAU,CAChB,KAAqB,EACrB,WAAmB,EACnB,IAAqC;QAErC,MAAM,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACnC,IAAA,wBAAY,EACV,IAAI,EACJ,MAAM,CACJ,IAAI,CAAC,UAAU,CAAC,iDAA0B,CAAC,YAAY,CAAC;YACtD,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,iDAA0B,CAAC,YAAY,CAAC;YACjE,WAAW,CACd,EACD,IAAI,CAAC,kBAAkB,EACvB,IAAI,CAAC,yBAAyB,CAC/B,CACF,CAAC;QACF,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,MAAoB,EAAE,EAAE;YACtD,IAAI,IAAI,EAAE;gBACR,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;aACrB;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtHD,wCAsHC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\nimport { ExportResult, ExportResultCode, getEnv } from '@opentelemetry/core';\nimport { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { prepareSend } from './platform/index';\nimport * as zipkinTypes from './types';\nimport {\n toZipkinSpan,\n defaultStatusCodeTagName,\n defaultStatusErrorTagName,\n} from './transform';\nimport { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';\nimport { prepareGetHeaders } from './utils';\n\n/**\n * Zipkin Exporter\n */\nexport class ZipkinExporter implements SpanExporter {\n private readonly DEFAULT_SERVICE_NAME = 'OpenTelemetry Service';\n private readonly _statusCodeTagName: string;\n private readonly _statusDescriptionTagName: string;\n private _urlStr: string;\n private _send: zipkinTypes.SendFunction;\n private _getHeaders: zipkinTypes.GetHeaders | undefined;\n private _serviceName?: string;\n private _isShutdown: boolean;\n private _sendingPromises: Promise<unknown>[] = [];\n\n constructor(config: zipkinTypes.ExporterConfig = {}) {\n this._urlStr = config.url || getEnv().OTEL_EXPORTER_ZIPKIN_ENDPOINT;\n this._send = prepareSend(this._urlStr, config.headers);\n this._serviceName = config.serviceName;\n this._statusCodeTagName = config.statusCodeTagName || defaultStatusCodeTagName;\n this._statusDescriptionTagName =\n config.statusDescriptionTagName || defaultStatusErrorTagName;\n this._isShutdown = false;\n if (typeof config.getExportRequestHeaders === 'function') {\n this._getHeaders = prepareGetHeaders(config.getExportRequestHeaders);\n } else {\n // noop\n this._beforeSend = function () {};\n }\n }\n\n /**\n * Export spans.\n */\n export(\n spans: ReadableSpan[],\n resultCallback: (result: ExportResult) => void\n ): void {\n const serviceName = String(\n this._serviceName ||\n spans[0].resource.attributes[SemanticResourceAttributes.SERVICE_NAME] ||\n this.DEFAULT_SERVICE_NAME\n );\n\n diag.debug('Zipkin exporter export');\n if (this._isShutdown) {\n setTimeout(() =>\n resultCallback({\n code: ExportResultCode.FAILED,\n error: new Error('Exporter has been shutdown'),\n })\n );\n return;\n }\n const promise = new Promise<void>(resolve => {\n this._sendSpans(spans, serviceName, result => {\n resolve();\n resultCallback(result);\n });\n });\n\n\n this._sendingPromises.push(promise);\n const popPromise = () => {\n const index = this._sendingPromises.indexOf(promise);\n this._sendingPromises.splice(index, 1);\n };\n promise.then(popPromise, popPromise);\n }\n\n /**\n * Shutdown exporter. Noop operation in this exporter.\n */\n shutdown(): Promise<void> {\n diag.debug('Zipkin exporter shutdown');\n this._isShutdown = true;\n return new Promise((resolve, reject) => {\n Promise.all(this._sendingPromises).then(() => {\n resolve();\n }, reject);\n });\n }\n\n /**\n * if user defines getExportRequestHeaders in config then this will be called\n * everytime before send, otherwise it will be replaced with noop in\n * constructor\n * @default noop\n */\n private _beforeSend() {\n if (this._getHeaders) {\n this._send = prepareSend(this._urlStr, this._getHeaders());\n }\n }\n\n /**\n * Transform spans and sends to Zipkin service.\n */\n private _sendSpans(\n spans: ReadableSpan[],\n serviceName: string,\n done?: (result: ExportResult) => void\n ) {\n const zipkinSpans = spans.map(span =>\n toZipkinSpan(\n span,\n String(\n span.attributes[SemanticResourceAttributes.SERVICE_NAME] ||\n span.resource.attributes[SemanticResourceAttributes.SERVICE_NAME] ||\n serviceName\n ),\n this._statusCodeTagName,\n this._statusDescriptionTagName\n )\n );\n this._beforeSend();\n return this._send(zipkinSpans, (result: ExportResult) => {\n if (done) {\n return done(result);\n }\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentelemetry/exporter-zipkin",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "OpenTelemetry Zipkin Exporter allows the user to send collected traces to Zipkin.",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"module": "build/esm/index.js",
|
|
7
|
+
"esnext": "build/esnext/index.js",
|
|
7
8
|
"types": "build/src/index.d.ts",
|
|
8
9
|
"repository": "open-telemetry/opentelemetry-js",
|
|
9
10
|
"browser": {
|
|
10
11
|
"./src/platform/index.ts": "./src/platform/browser/index.ts",
|
|
11
12
|
"./build/esm/platform/index.js": "./build/esm/platform/browser/index.js",
|
|
13
|
+
"./build/esnext/platform/index.js": "./build/esnext/platform/browser/index.js",
|
|
12
14
|
"./build/src/platform/index.js": "./build/src/platform/browser/index.js"
|
|
13
15
|
},
|
|
14
16
|
"scripts": {
|
|
15
|
-
"compile": "tsc --build tsconfig.
|
|
16
|
-
"clean": "tsc --build --clean tsconfig.
|
|
17
|
+
"compile": "tsc --build tsconfig.all.json",
|
|
18
|
+
"clean": "tsc --build --clean tsconfig.all.json",
|
|
17
19
|
"codecov": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
|
|
18
20
|
"codecov:browser": "nyc report --reporter=json && codecov -f coverage/*.json -p ../../",
|
|
19
21
|
"lint": "eslint . --ext .ts",
|
|
@@ -22,8 +24,8 @@
|
|
|
22
24
|
"test": "nyc ts-mocha -p tsconfig.json 'test/**/*.test.ts' --exclude 'test/browser/**/*.ts'",
|
|
23
25
|
"test:browser": "nyc karma start --single-run",
|
|
24
26
|
"version": "node ../../scripts/version-update.js",
|
|
25
|
-
"watch": "tsc --build --watch tsconfig.
|
|
26
|
-
"precompile": "lerna run version --scope $(npm pkg get name) --include-
|
|
27
|
+
"watch": "tsc --build --watch tsconfig.all.json",
|
|
28
|
+
"precompile": "lerna run version --scope $(npm pkg get name) --include-dependencies",
|
|
27
29
|
"prewatch": "npm run precompile"
|
|
28
30
|
},
|
|
29
31
|
"keywords": [
|
|
@@ -42,6 +44,9 @@
|
|
|
42
44
|
"build/esm/**/*.js",
|
|
43
45
|
"build/esm/**/*.js.map",
|
|
44
46
|
"build/esm/**/*.d.ts",
|
|
47
|
+
"build/esnext/**/*.js",
|
|
48
|
+
"build/esnext/**/*.js.map",
|
|
49
|
+
"build/esnext/**/*.d.ts",
|
|
45
50
|
"build/src/**/*.js",
|
|
46
51
|
"build/src/**/*.js.map",
|
|
47
52
|
"build/src/**/*.d.ts",
|
|
@@ -53,41 +58,41 @@
|
|
|
53
58
|
"access": "public"
|
|
54
59
|
},
|
|
55
60
|
"devDependencies": {
|
|
56
|
-
"@babel/core": "7.
|
|
57
|
-
"@opentelemetry/api": "^1.0
|
|
61
|
+
"@babel/core": "7.16.0",
|
|
62
|
+
"@opentelemetry/api": "^1.1.0",
|
|
58
63
|
"@types/mocha": "8.2.3",
|
|
59
|
-
"@types/node": "14.17.
|
|
60
|
-
"@types/sinon": "10.0.
|
|
61
|
-
"@types/webpack-env": "1.16.
|
|
62
|
-
"babel-loader": "8.2.
|
|
64
|
+
"@types/node": "14.17.33",
|
|
65
|
+
"@types/sinon": "10.0.6",
|
|
66
|
+
"@types/webpack-env": "1.16.3",
|
|
67
|
+
"babel-loader": "8.2.3",
|
|
63
68
|
"codecov": "3.8.3",
|
|
64
69
|
"istanbul-instrumenter-loader": "3.0.1",
|
|
65
|
-
"karma": "6.3.
|
|
70
|
+
"karma": "6.3.16",
|
|
66
71
|
"karma-chrome-launcher": "3.1.0",
|
|
67
72
|
"karma-coverage-istanbul-reporter": "3.0.3",
|
|
68
73
|
"karma-mocha": "2.0.1",
|
|
69
74
|
"karma-spec-reporter": "0.0.32",
|
|
70
75
|
"karma-webpack": "4.0.2",
|
|
71
76
|
"mocha": "7.2.0",
|
|
72
|
-
"nock": "
|
|
77
|
+
"nock": "13.0.11",
|
|
73
78
|
"nyc": "15.1.0",
|
|
74
79
|
"rimraf": "3.0.2",
|
|
75
80
|
"sinon": "12.0.1",
|
|
76
81
|
"ts-loader": "8.3.0",
|
|
77
82
|
"ts-mocha": "8.0.0",
|
|
78
|
-
"typescript": "4.
|
|
83
|
+
"typescript": "4.4.4",
|
|
79
84
|
"webpack": "4.46.0",
|
|
80
|
-
"webpack-cli": "4.
|
|
85
|
+
"webpack-cli": "4.9.1",
|
|
81
86
|
"webpack-merge": "5.8.0"
|
|
82
87
|
},
|
|
83
88
|
"peerDependencies": {
|
|
84
|
-
"@opentelemetry/api": "^1.0.
|
|
89
|
+
"@opentelemetry/api": "^1.0.3"
|
|
85
90
|
},
|
|
86
91
|
"dependencies": {
|
|
87
|
-
"@opentelemetry/core": "1.0
|
|
88
|
-
"@opentelemetry/resources": "1.0
|
|
89
|
-
"@opentelemetry/sdk-trace-base": "1.0
|
|
90
|
-
"@opentelemetry/semantic-conventions": "1.0
|
|
92
|
+
"@opentelemetry/core": "1.1.0",
|
|
93
|
+
"@opentelemetry/resources": "1.1.0",
|
|
94
|
+
"@opentelemetry/sdk-trace-base": "1.1.0",
|
|
95
|
+
"@opentelemetry/semantic-conventions": "1.1.0"
|
|
91
96
|
},
|
|
92
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "f384303ac469914d0dbafde0758ccdae473f336e"
|
|
93
98
|
}
|
package/build/esm/index.d.ts
DELETED
package/build/esm/index.js
DELETED
|
@@ -1,18 +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
|
-
export * from './platform';
|
|
17
|
-
export * from './zipkin';
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,YAAY,CAAC;AAE3B,cAAc,UAAU,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './platform';\nexport { ExporterConfig } from './types';\nexport * from './zipkin';\n"]}
|
|
@@ -1,17 +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
|
-
export * from './util';
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './util';\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as zipkinTypes from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Prepares send function that will send spans to the remote Zipkin service.
|
|
4
|
-
* @param urlStr - url to send spans
|
|
5
|
-
* @param headers - headers
|
|
6
|
-
* send
|
|
7
|
-
*/
|
|
8
|
-
export declare function prepareSend(urlStr: string, headers?: Record<string, string>): zipkinTypes.SendFn;
|
|
9
|
-
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1,114 +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
|
-
var __assign = (this && this.__assign) || function () {
|
|
17
|
-
__assign = Object.assign || function(t) {
|
|
18
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
-
s = arguments[i];
|
|
20
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
-
t[p] = s[p];
|
|
22
|
-
}
|
|
23
|
-
return t;
|
|
24
|
-
};
|
|
25
|
-
return __assign.apply(this, arguments);
|
|
26
|
-
};
|
|
27
|
-
import { diag } from '@opentelemetry/api';
|
|
28
|
-
import { ExportResultCode, globalErrorHandler, } from '@opentelemetry/core';
|
|
29
|
-
/**
|
|
30
|
-
* Prepares send function that will send spans to the remote Zipkin service.
|
|
31
|
-
* @param urlStr - url to send spans
|
|
32
|
-
* @param headers - headers
|
|
33
|
-
* send
|
|
34
|
-
*/
|
|
35
|
-
export function prepareSend(urlStr, headers) {
|
|
36
|
-
var xhrHeaders;
|
|
37
|
-
var useBeacon = typeof navigator.sendBeacon === 'function' && !headers;
|
|
38
|
-
if (headers) {
|
|
39
|
-
xhrHeaders = __assign({ Accept: 'application/json', 'Content-Type': 'application/json' }, headers);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Send spans to the remote Zipkin service.
|
|
43
|
-
*/
|
|
44
|
-
return function send(zipkinSpans, done) {
|
|
45
|
-
if (zipkinSpans.length === 0) {
|
|
46
|
-
diag.debug('Zipkin send with empty spans');
|
|
47
|
-
return done({ code: ExportResultCode.SUCCESS });
|
|
48
|
-
}
|
|
49
|
-
var payload = JSON.stringify(zipkinSpans);
|
|
50
|
-
if (useBeacon) {
|
|
51
|
-
sendWithBeacon(payload, done, urlStr);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
sendWithXhr(payload, done, urlStr, xhrHeaders);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Sends data using beacon
|
|
60
|
-
* @param data
|
|
61
|
-
* @param done
|
|
62
|
-
* @param urlStr
|
|
63
|
-
*/
|
|
64
|
-
function sendWithBeacon(data, done, urlStr) {
|
|
65
|
-
if (navigator.sendBeacon(urlStr, data)) {
|
|
66
|
-
diag.debug('sendBeacon - can send', data);
|
|
67
|
-
done({ code: ExportResultCode.SUCCESS });
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
done({
|
|
71
|
-
code: ExportResultCode.FAILED,
|
|
72
|
-
error: new Error("sendBeacon - cannot send " + data),
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Sends data using XMLHttpRequest
|
|
78
|
-
* @param data
|
|
79
|
-
* @param done
|
|
80
|
-
* @param urlStr
|
|
81
|
-
* @param xhrHeaders
|
|
82
|
-
*/
|
|
83
|
-
function sendWithXhr(data, done, urlStr, xhrHeaders) {
|
|
84
|
-
if (xhrHeaders === void 0) { xhrHeaders = {}; }
|
|
85
|
-
var xhr = new window.XMLHttpRequest();
|
|
86
|
-
xhr.open('POST', urlStr);
|
|
87
|
-
Object.entries(xhrHeaders).forEach(function (_a) {
|
|
88
|
-
var k = _a[0], v = _a[1];
|
|
89
|
-
xhr.setRequestHeader(k, v);
|
|
90
|
-
});
|
|
91
|
-
xhr.onreadystatechange = function () {
|
|
92
|
-
if (xhr.readyState === XMLHttpRequest.DONE) {
|
|
93
|
-
var statusCode = xhr.status || 0;
|
|
94
|
-
diag.debug("Zipkin response status code: " + statusCode + ", body: " + data);
|
|
95
|
-
if (xhr.status >= 200 && xhr.status < 400) {
|
|
96
|
-
return done({ code: ExportResultCode.SUCCESS });
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
return done({
|
|
100
|
-
code: ExportResultCode.FAILED,
|
|
101
|
-
error: new Error("Got unexpected status code from zipkin: " + xhr.status),
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
xhr.onerror = function (msg) {
|
|
107
|
-
globalErrorHandler(new Error("Zipkin request error: " + msg));
|
|
108
|
-
return done({ code: ExportResultCode.FAILED });
|
|
109
|
-
};
|
|
110
|
-
// Issue request to remote service
|
|
111
|
-
diag.debug("Zipkin request payload: " + data);
|
|
112
|
-
xhr.send(data);
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=util.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../src/platform/browser/util.ts"],"names":[],"mappings":"AA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AAkB,CAAC,IAAI,KAAK,CAAC,2BAAyB,GAAK,CAAC,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC,CAAC;IAEF,kCAAkC;IAClC,IAAI,CAAC,KAAK,CAAC,6BAA2B,IAAM,CAAC,CAAC;IAC9C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { diag } from '@opentelemetry/api';\nimport {\n ExportResult,\n ExportResultCode,\n globalErrorHandler,\n} from '@opentelemetry/core';\nimport * as zipkinTypes from '../../types';\n\n/**\n * Prepares send function that will send spans to the remote Zipkin service.\n * @param urlStr - url to send spans\n * @param headers - headers\n * send\n */\nexport function prepareSend(urlStr: string, headers?: Record<string, string>): zipkinTypes.SendFn {\n let xhrHeaders: Record<string, string>;\n const useBeacon = typeof navigator.sendBeacon === 'function' && !headers;\n if (headers) {\n xhrHeaders = {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n ...headers,\n };\n }\n\n /**\n * Send spans to the remote Zipkin service.\n */\n return function send(\n zipkinSpans: zipkinTypes.Span[],\n done: (result: ExportResult) => void\n ) {\n if (zipkinSpans.length === 0) {\n diag.debug('Zipkin send with empty spans');\n return done({ code: ExportResultCode.SUCCESS });\n }\n const payload = JSON.stringify(zipkinSpans);\n if (useBeacon) {\n sendWithBeacon(payload, done, urlStr);\n } else {\n sendWithXhr(payload, done, urlStr, xhrHeaders);\n }\n };\n}\n\n/**\n * Sends data using beacon\n * @param data\n * @param done\n * @param urlStr\n */\nfunction sendWithBeacon(\n data: string,\n done: (result: ExportResult) => void,\n urlStr: string\n) {\n if (navigator.sendBeacon(urlStr, data)) {\n diag.debug('sendBeacon - can send', data);\n done({ code: ExportResultCode.SUCCESS });\n } else {\n done({\n code: ExportResultCode.FAILED,\n error: new Error(`sendBeacon - cannot send ${data}`),\n });\n }\n}\n\n/**\n * Sends data using XMLHttpRequest\n * @param data\n * @param done\n * @param urlStr\n * @param xhrHeaders\n */\nfunction sendWithXhr(\n data: string,\n done: (result: ExportResult) => void,\n urlStr: string,\n xhrHeaders: Record<string, string> = {}\n) {\n const xhr = new window.XMLHttpRequest();\n xhr.open('POST', urlStr);\n Object.entries(xhrHeaders).forEach(([k, v]) => {\n xhr.setRequestHeader(k, v);\n });\n\n xhr.onreadystatechange = () => {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n const statusCode = xhr.status || 0;\n diag.debug(`Zipkin response status code: ${statusCode}, body: ${data}`);\n\n if (xhr.status >= 200 && xhr.status < 400) {\n return done({ code: ExportResultCode.SUCCESS });\n } else {\n return done({\n code: ExportResultCode.FAILED,\n error: new Error(\n `Got unexpected status code from zipkin: ${xhr.status}`\n ),\n });\n }\n }\n };\n\n xhr.onerror = msg => {\n globalErrorHandler(new Error(`Zipkin request error: ${msg}`));\n return done({ code: ExportResultCode.FAILED });\n };\n\n // Issue request to remote service\n diag.debug(`Zipkin request payload: ${data}`);\n xhr.send(data);\n}\n"]}
|
|
@@ -1,17 +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
|
-
export * from './node';
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './node';\n"]}
|
|
@@ -1,17 +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
|
-
export * from './util';
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/platform/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,QAAQ,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './util';\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as zipkinTypes from '../../types';
|
|
2
|
-
/**
|
|
3
|
-
* Prepares send function that will send spans to the remote Zipkin service.
|
|
4
|
-
* @param urlStr - url to send spans
|
|
5
|
-
* @param headers - headers
|
|
6
|
-
* send
|
|
7
|
-
*/
|
|
8
|
-
export declare function prepareSend(urlStr: string, headers?: Record<string, string>): zipkinTypes.SendFn;
|
|
9
|
-
//# sourceMappingURL=util.d.ts.map
|