Skip to content

Commit 360967b

Browse files
committed
added test
1 parent 52f8b5d commit 360967b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

plugins/web/opentelemetry-instrumentation-document-load/test/documentLoad.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,27 @@ describe('DocumentLoad Instrumentation', () => {
834834
done();
835835
});
836836
});
837+
838+
it('should have http.response_content_length attribute even if ignoreNetworkEvents is true', done => {
839+
plugin = new DocumentLoadInstrumentation({
840+
enabled: false,
841+
ignoreNetworkEvents: true,
842+
});
843+
plugin.enable();
844+
845+
setTimeout(() => {
846+
const spans = exporter.getFinishedSpans();
847+
const resourceSpan = spans.find(
848+
s => s.name === 'resourceFetch'
849+
) as ReadableSpan;
850+
assert.isOk(resourceSpan, 'resourceFetch span should exist');
851+
assert.exists(
852+
resourceSpan.attributes[SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH],
853+
'http.response_content_length attribute should exist'
854+
);
855+
done();
856+
});
857+
});
837858
});
838859
});
839860

0 commit comments

Comments
 (0)