Skip to content

Commit 10e2a04

Browse files
committed
test
1 parent 4e6097c commit 10e2a04

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
import { get } from 'http';
2+
import { getActiveSpan } from '@sentry/nextjs';
23
import { NextApiRequest, NextApiResponse } from 'next';
34

45
export default (_req: NextApiRequest, res: NextApiResponse) => {
56
// make an outgoing request in order to test that the `Http` integration creates a span
7+
console.log('REQ INSTRUMENTATION TEST', getActiveSpan());
68
get('http://example.com/', message => {
79
message.on('data', () => {
810
// Noop consuming some data so that request can close :)
911
});
1012

1113
message.on('close', () => {
12-
res.status(200).json({});
14+
setTimeout(() => {
15+
res.status(200).json({});
16+
}, 5000);
17+
});
18+
19+
message.on('error', () => {
20+
setTimeout(() => {
21+
res.status(200).json({});
22+
}, 5000);
1323
});
1424
});
1525
};

packages/opentelemetry/src/spanProcessor.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export class SentrySpanProcessor implements SpanProcessorInterface {
8080
* @inheritDoc
8181
*/
8282
public onStart(span: Span, parentContext: Context): void {
83+
console.log('onStart', span.name, span.attributes);
8384
onSpanStart(span, parentContext);
8485

8586
// TODO (v8): Trigger client `spanStart` & `spanEnd` in here,
@@ -90,6 +91,7 @@ export class SentrySpanProcessor implements SpanProcessorInterface {
9091

9192
/** @inheritDoc */
9293
public onEnd(span: ReadableSpan): void {
94+
console.log('onStart', span.name, span.attributes);
9395
if (span.spanContext().traceFlags !== TraceFlags.SAMPLED) {
9496
DEBUG_BUILD && logger.log(`[Tracing] Finishing unsampled span "${span.name}" (${span.spanContext().spanId})`);
9597
return;

0 commit comments

Comments
 (0)