@use-tusk/drift-node-sdk 0.1.9 → 0.1.10
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/index.cjs +7 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -286,7 +286,7 @@ var TdInstrumentationAbstract = class {
|
|
|
286
286
|
|
|
287
287
|
//#endregion
|
|
288
288
|
//#region package.json
|
|
289
|
-
var version = "0.1.
|
|
289
|
+
var version = "0.1.10";
|
|
290
290
|
|
|
291
291
|
//#endregion
|
|
292
292
|
//#region src/version.ts
|
|
@@ -1228,6 +1228,7 @@ async function httpBodyEncoder({ bodyBuffer, contentEncoding }) {
|
|
|
1228
1228
|
* @returns The corresponding DecodedType enum value
|
|
1229
1229
|
*/
|
|
1230
1230
|
function getDecodedType(contentType) {
|
|
1231
|
+
if (!contentType) return;
|
|
1231
1232
|
const contentTypeString = Array.isArray(contentType) && contentType.length > 0 ? contentType[0] : contentType;
|
|
1232
1233
|
if (!contentTypeString || typeof contentTypeString !== "string") {
|
|
1233
1234
|
logger.debug(`Invalid Content-Type header: ${contentType}`);
|
|
@@ -1236,22 +1237,7 @@ function getDecodedType(contentType) {
|
|
|
1236
1237
|
const mainType = contentTypeString.toLowerCase().split(";")[0].trim();
|
|
1237
1238
|
return CONTENT_TYPE_MAPPING[mainType];
|
|
1238
1239
|
}
|
|
1239
|
-
const
|
|
1240
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.HTML,
|
|
1241
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.CSS,
|
|
1242
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.JAVASCRIPT,
|
|
1243
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.JPEG,
|
|
1244
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.PNG,
|
|
1245
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.GIF,
|
|
1246
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.WEBP,
|
|
1247
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.SVG,
|
|
1248
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.PDF,
|
|
1249
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.AUDIO,
|
|
1250
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.VIDEO,
|
|
1251
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.BINARY,
|
|
1252
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.ZIP,
|
|
1253
|
-
__use_tusk_drift_schemas_core_json_schema.DecodedType.GZIP
|
|
1254
|
-
]);
|
|
1240
|
+
const ACCEPTABLE_CONTENT_TYPES = new Set([__use_tusk_drift_schemas_core_json_schema.DecodedType.JSON, __use_tusk_drift_schemas_core_json_schema.DecodedType.PLAIN_TEXT]);
|
|
1255
1241
|
|
|
1256
1242
|
//#endregion
|
|
1257
1243
|
//#region src/instrumentation/libraries/http/mocks/TdHttpMockSocket.ts
|
|
@@ -2831,9 +2817,9 @@ var HttpInstrumentation = class extends TdInstrumentationBase {
|
|
|
2831
2817
|
} : { code: __opentelemetry_api.SpanStatusCode.OK };
|
|
2832
2818
|
SpanUtils.setStatus(spanInfo.span, status);
|
|
2833
2819
|
const decodedType = getDecodedType(outputValue.headers?.["content-type"] || "");
|
|
2834
|
-
if (decodedType &&
|
|
2820
|
+
if (decodedType && !ACCEPTABLE_CONTENT_TYPES.has(decodedType)) {
|
|
2835
2821
|
TraceBlockingManager.getInstance().blockTrace(spanInfo.traceId);
|
|
2836
|
-
logger.debug(`[HttpInstrumentation] Blocking trace ${spanInfo.traceId} because it is an
|
|
2822
|
+
logger.debug(`[HttpInstrumentation] Blocking trace ${spanInfo.traceId} because it is not an acceptable decoded type: ${decodedType}`, { acceptableContentTypes: Array.from(ACCEPTABLE_CONTENT_TYPES) });
|
|
2837
2823
|
}
|
|
2838
2824
|
SpanUtils.endSpan(spanInfo.span);
|
|
2839
2825
|
} catch (error) {
|
|
@@ -9821,9 +9807,9 @@ var NextjsInstrumentation = class extends TdInstrumentationBase {
|
|
|
9821
9807
|
} : { code: __opentelemetry_api.SpanStatusCode.OK };
|
|
9822
9808
|
SpanUtils.setStatus(spanInfo.span, status);
|
|
9823
9809
|
const decodedType = getDecodedType(outputValue.headers?.["content-type"] || "");
|
|
9824
|
-
if (decodedType &&
|
|
9810
|
+
if (decodedType && !ACCEPTABLE_CONTENT_TYPES.has(decodedType)) {
|
|
9825
9811
|
TraceBlockingManager.getInstance().blockTrace(spanInfo.traceId);
|
|
9826
|
-
logger.debug(`[NextjsInstrumentation] Blocking trace ${spanInfo.traceId} because it is an
|
|
9812
|
+
logger.debug(`[NextjsInstrumentation] Blocking trace ${spanInfo.traceId} because it is not an acceptable decoded type: ${decodedType}`, { acceptableContentTypes: Array.from(ACCEPTABLE_CONTENT_TYPES) });
|
|
9827
9813
|
}
|
|
9828
9814
|
SpanUtils.endSpan(spanInfo.span);
|
|
9829
9815
|
if (self.mode === TuskDriftMode.REPLAY) try {
|