@echoteam/signoz-react 1.2.6 → 1.2.7
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 +1 -0
- package/dist/index.esm.js +18 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15364,12 +15364,21 @@ function addFetchLogging(config) {
|
|
|
15364
15364
|
span.setAttribute('duration_ms', Math.round(duration));
|
|
15365
15365
|
// Log response data
|
|
15366
15366
|
span.setAttribute('http.status_code', response.status);
|
|
15367
|
+
// Log response content length from headers
|
|
15368
|
+
const contentLength = response.headers.get('content-length');
|
|
15369
|
+
if (contentLength) {
|
|
15370
|
+
span.setAttribute('http.response_content_length', parseInt(contentLength));
|
|
15371
|
+
}
|
|
15367
15372
|
if (config.logResponseBody && response.ok) {
|
|
15368
15373
|
const clonedResponse = response.clone();
|
|
15369
15374
|
try {
|
|
15370
15375
|
const responseData = await clonedResponse.text();
|
|
15371
15376
|
const truncatedData = truncateBody(responseData, config.maxBodyLogSize);
|
|
15372
15377
|
span.setAttribute('response.data', truncatedData);
|
|
15378
|
+
// If content-length header is not available, calculate from response data
|
|
15379
|
+
if (!contentLength) {
|
|
15380
|
+
span.setAttribute('http.response_content_length', responseData.length);
|
|
15381
|
+
}
|
|
15373
15382
|
// Try to parse JSON and extract message if exists
|
|
15374
15383
|
try {
|
|
15375
15384
|
const jsonData = JSON.parse(responseData);
|
|
@@ -15457,11 +15466,20 @@ function addXHRLogging(config) {
|
|
|
15457
15466
|
const duration = performance.now() - startTime;
|
|
15458
15467
|
span.setAttribute('duration_ms', Math.round(duration));
|
|
15459
15468
|
span.setAttribute('http.status_code', xhr.status);
|
|
15469
|
+
// Log response content length from headers
|
|
15470
|
+
const contentLength = xhr.getResponseHeader('content-length');
|
|
15471
|
+
if (contentLength) {
|
|
15472
|
+
span.setAttribute('http.response_content_length', parseInt(contentLength));
|
|
15473
|
+
}
|
|
15460
15474
|
// Log response body
|
|
15461
15475
|
if (config.logResponseBody && xhr.status >= 200 && xhr.status < 300) {
|
|
15462
15476
|
const responseData = xhr.responseText;
|
|
15463
15477
|
const truncatedData = truncateBody(responseData, config.maxBodyLogSize);
|
|
15464
15478
|
span.setAttribute('response.data', truncatedData);
|
|
15479
|
+
// If content-length header is not available, calculate from response data
|
|
15480
|
+
if (!contentLength) {
|
|
15481
|
+
span.setAttribute('http.response_content_length', responseData.length);
|
|
15482
|
+
}
|
|
15465
15483
|
// Try to parse JSON and extract message if exists
|
|
15466
15484
|
try {
|
|
15467
15485
|
const jsonData = JSON.parse(responseData);
|