@allthings/cloud-toolkit 5.4.0-beta.2 → 5.4.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/dist/tracing.cjs.js +4 -1
- package/dist/tracing.esm.mjs +4 -1
- package/package.json +1 -1
package/dist/tracing.cjs.js
CHANGED
|
@@ -38,6 +38,9 @@ const encode = (spans) => {
|
|
|
38
38
|
: Buffer.from(`${PROTOCOL_HEADER}${OTEL_TRACES_BINARY_PREFIX}${Buffer.from(serialized).toString('base64')}`, 'utf8');
|
|
39
39
|
};
|
|
40
40
|
const encodeBatches = (spans, maxPayloadBytes) => {
|
|
41
|
+
if (spans.length === 0) {
|
|
42
|
+
return { droppedSpans: 0, messages: [] };
|
|
43
|
+
}
|
|
41
44
|
const message = encode(spans);
|
|
42
45
|
if (!message) {
|
|
43
46
|
return { droppedSpans: 0, messages: [] };
|
|
@@ -84,7 +87,7 @@ const createOtlpUdpSpanExporter = (endpoint = DEFAULT_ENDPOINT, { maxPayloadByte
|
|
|
84
87
|
socket.unref();
|
|
85
88
|
return {
|
|
86
89
|
export: (spans, resultCallback) => {
|
|
87
|
-
void exportBatches(socket, parsedEndpoint, encodeBatches(spans, maxPayloadBytes)).then(resultCallback);
|
|
90
|
+
void exportBatches(socket, parsedEndpoint, encodeBatches(spans, Math.min(maxPayloadBytes, MAX_UDP_PAYLOAD_BYTES))).then(resultCallback);
|
|
88
91
|
},
|
|
89
92
|
forceFlush: () => Promise.resolve(),
|
|
90
93
|
shutdown: () => new Promise((resolve) => {
|
package/dist/tracing.esm.mjs
CHANGED
|
@@ -36,6 +36,9 @@ const encode = (spans) => {
|
|
|
36
36
|
: Buffer.from(`${PROTOCOL_HEADER}${OTEL_TRACES_BINARY_PREFIX}${Buffer.from(serialized).toString('base64')}`, 'utf8');
|
|
37
37
|
};
|
|
38
38
|
const encodeBatches = (spans, maxPayloadBytes) => {
|
|
39
|
+
if (spans.length === 0) {
|
|
40
|
+
return { droppedSpans: 0, messages: [] };
|
|
41
|
+
}
|
|
39
42
|
const message = encode(spans);
|
|
40
43
|
if (!message) {
|
|
41
44
|
return { droppedSpans: 0, messages: [] };
|
|
@@ -82,7 +85,7 @@ const createOtlpUdpSpanExporter = (endpoint = DEFAULT_ENDPOINT, { maxPayloadByte
|
|
|
82
85
|
socket.unref();
|
|
83
86
|
return {
|
|
84
87
|
export: (spans, resultCallback) => {
|
|
85
|
-
void exportBatches(socket, parsedEndpoint, encodeBatches(spans, maxPayloadBytes)).then(resultCallback);
|
|
88
|
+
void exportBatches(socket, parsedEndpoint, encodeBatches(spans, Math.min(maxPayloadBytes, MAX_UDP_PAYLOAD_BYTES))).then(resultCallback);
|
|
86
89
|
},
|
|
87
90
|
forceFlush: () => Promise.resolve(),
|
|
88
91
|
shutdown: () => new Promise((resolve) => {
|