-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathscenario-invalid-root-span.js
More file actions
34 lines (27 loc) · 979 Bytes
/
scenario-invalid-root-span.js
File metadata and controls
34 lines (27 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const Sentry = require('@sentry/node');
const { loggingTransport } = require('@sentry-internal/node-integration-tests');
const client = Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
tracesSampleRate: 1.0,
integrations: [Sentry.graphqlIntegration({ useOperationNameForRootSpan: true })],
transport: loggingTransport,
});
const tracer = client.tracer;
// Stop the process from exiting before the transaction is sent
setInterval(() => {}, 1000);
async function run() {
const server = require('../apollo-server')();
await tracer.startActiveSpan('test span name', async span => {
// Ref: https://www.apollographql.com/docs/apollo-server/testing/testing/#testing-using-executeoperation
await server.executeOperation({
query: 'query GetHello {hello}',
});
setTimeout(() => {
span.end();
server.stop();
}, 500);
});
}
// eslint-disable-next-line @typescript-eslint/no-floating-promises
run();