-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10330 from getsentry/prepare-release/7.96.0
meta(changelog): Update changelog for 7.96.0
- Loading branch information
Showing
49 changed files
with
861 additions
and
892 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+15.7 KB
...ration-tests/suites/tracing/metrics/handlers-lcp/assets/sentry-logo-600x179.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions
18
dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/subject.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { addLcpInstrumentationHandler } from '@sentry-internal/tracing'; | ||
|
||
addLcpInstrumentationHandler(({ metric }) => { | ||
const entry = metric.entries[metric.entries.length - 1]; | ||
window._LCP = entry.size; | ||
}); | ||
|
||
addLcpInstrumentationHandler(({ metric }) => { | ||
const entry = metric.entries[metric.entries.length - 1]; | ||
window._LCP2 = entry.size; | ||
}); | ||
|
||
window.ADD_HANDLER = () => { | ||
addLcpInstrumentationHandler(({ metric }) => { | ||
const entry = metric.entries[metric.entries.length - 1]; | ||
window._LCP3 = entry.size; | ||
}); | ||
}; |
11 changes: 11 additions & 0 deletions
11
dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/template.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
</head> | ||
<body> | ||
<div id="content"></div> | ||
<img src="https://example.com/path/to/image.png" /> | ||
<button type="button">Test button</button> | ||
</body> | ||
</html> |
51 changes: 51 additions & 0 deletions
51
dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { Route } from '@playwright/test'; | ||
import { expect } from '@playwright/test'; | ||
import type { Event } from '@sentry/types'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { getFirstSentryEnvelopeRequest, shouldSkipTracingTest } from '../../../../utils/helpers'; | ||
|
||
const bundle = process.env.PW_BUNDLE || ''; | ||
|
||
sentryTest( | ||
'should capture metrics for LCP instrumentation handlers', | ||
async ({ browserName, getLocalTestPath, page }) => { | ||
// This uses a utility that is not exported in CDN bundles | ||
if (shouldSkipTracingTest() || browserName !== 'chromium' || bundle.startsWith('bundle')) { | ||
sentryTest.skip(); | ||
} | ||
|
||
await page.route('**/path/to/image.png', (route: Route) => | ||
route.fulfill({ path: `${__dirname}/assets/sentry-logo-600x179.png` }), | ||
); | ||
|
||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
const [eventData] = await Promise.all([ | ||
getFirstSentryEnvelopeRequest<Event>(page), | ||
page.goto(url), | ||
page.click('button'), | ||
]); | ||
|
||
expect(eventData.measurements).toBeDefined(); | ||
expect(eventData.measurements?.lcp?.value).toBeDefined(); | ||
|
||
expect(eventData.tags?.['lcp.element']).toBe('body > img'); | ||
expect(eventData.tags?.['lcp.size']).toBe(107400); | ||
expect(eventData.tags?.['lcp.url']).toBe('https://example.com/path/to/image.png'); | ||
|
||
const lcp = await (await page.waitForFunction('window._LCP')).jsonValue(); | ||
const lcp2 = await (await page.waitForFunction('window._LCP2')).jsonValue(); | ||
const lcp3 = await page.evaluate('window._LCP3'); | ||
|
||
expect(lcp).toEqual(107400); | ||
expect(lcp2).toEqual(107400); | ||
// this has not been triggered yet | ||
expect(lcp3).toEqual(undefined); | ||
|
||
// Adding a handler after LCP is completed still triggers the handler | ||
await page.evaluate('window.ADD_HANDLER()'); | ||
const lcp3_2 = await (await page.waitForFunction('window._LCP3')).jsonValue(); | ||
|
||
expect(lcp3_2).toEqual(107400); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
dev-packages/node-integration-tests/suites/cron/node-cron/scenario.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as Sentry from '@sentry/node'; | ||
import { CronJob } from 'cron'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
const CronJobWithCheckIn = Sentry.cron.instrumentCron(CronJob, 'my-cron-job'); | ||
|
||
setTimeout(() => { | ||
process.exit(0); | ||
}, 1_000); |
9 changes: 9 additions & 0 deletions
9
dev-packages/node-integration-tests/suites/cron/node-cron/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { cleanupChildProcesses, createRunner } from '../../../utils/runner'; | ||
|
||
afterAll(() => { | ||
cleanupChildProcesses(); | ||
}); | ||
|
||
test('node-cron types should match', done => { | ||
createRunner(__dirname, 'scenario.ts').ensureNoErrorOutput().start(done); | ||
}); |
52 changes: 52 additions & 0 deletions
52
dev-packages/node-integration-tests/suites/tracing-experimental/apollo-graphql/scenario.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const Sentry = require('@sentry/node-experimental'); | ||
const { loggingTransport } = require('@sentry-internal/node-integration-tests'); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
tracesSampleRate: 1.0, | ||
transport: loggingTransport, | ||
}); | ||
|
||
// Stop the process from exiting before the transaction is sent | ||
setInterval(() => {}, 1000); | ||
|
||
async function run() { | ||
const { ApolloServer, gql } = require('apollo-server'); | ||
|
||
await Sentry.startSpan( | ||
{ | ||
name: 'Test Transaction', | ||
op: 'transaction', | ||
}, | ||
async span => { | ||
const typeDefs = gql`type Query { hello: String }`; | ||
|
||
const resolvers = { | ||
Query: { | ||
hello: () => { | ||
return 'Hello world!'; | ||
}, | ||
}, | ||
}; | ||
|
||
const server = new ApolloServer({ | ||
typeDefs, | ||
resolvers, | ||
}); | ||
|
||
// Ref: https://www.apollographql.com/docs/apollo-server/testing/testing/#testing-using-executeoperation | ||
await server.executeOperation({ | ||
query: '{hello}', | ||
}); | ||
|
||
setTimeout(() => { | ||
span.end(); | ||
server.stop(); | ||
}, 500); | ||
}, | ||
); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
run(); |
38 changes: 38 additions & 0 deletions
38
dev-packages/node-integration-tests/suites/tracing-experimental/apollo-graphql/test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { conditionalTest } from '../../../utils'; | ||
import { createRunner } from '../../../utils/runner'; | ||
|
||
conditionalTest({ min: 14 })('GraphQL/Apollo Tests', () => { | ||
const EXPECTED_TRANSACTION = { | ||
transaction: 'Test Transaction', | ||
spans: expect.arrayContaining([ | ||
expect.objectContaining({ | ||
data: { | ||
'graphql.operation.type': 'query', | ||
'graphql.source': '{hello}', | ||
'otel.kind': 'INTERNAL', | ||
'sentry.origin': 'auto.graphql.otel.graphql', | ||
}, | ||
description: 'query', | ||
status: 'ok', | ||
origin: 'auto.graphql.otel.graphql', | ||
}), | ||
expect.objectContaining({ | ||
data: { | ||
'graphql.field.name': 'hello', | ||
'graphql.field.path': 'hello', | ||
'graphql.field.type': 'String', | ||
'graphql.source': 'hello', | ||
'otel.kind': 'INTERNAL', | ||
'sentry.origin': 'manual', | ||
}, | ||
description: 'graphql.resolve', | ||
status: 'ok', | ||
origin: 'manual', | ||
}), | ||
]), | ||
}; | ||
|
||
test('CJS - should instrument GraphQL queries used from Apollo Server.', done => { | ||
createRunner(__dirname, 'scenario.js').expect({ transaction: EXPECTED_TRANSACTION }).start(done); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
dev-packages/node-integration-tests/suites/tracing-experimental/mongoose/scenario.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const { loggingTransport } = require('@sentry-internal/node-integration-tests'); | ||
const Sentry = require('@sentry/node-experimental'); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
debug: true, | ||
tracesSampleRate: 1.0, | ||
transport: loggingTransport, | ||
}); | ||
|
||
// Stop the process from exiting before the transaction is sent | ||
setInterval(() => {}, 1000); | ||
|
||
// Must be required after Sentry is initialized | ||
const mongoose = require('mongoose'); | ||
|
||
async function run() { | ||
await mongoose.connect(process.env.MONGO_URL || ''); | ||
|
||
const Schema = mongoose.Schema; | ||
|
||
const BlogPostSchema = new Schema({ | ||
title: String, | ||
body: String, | ||
date: Date, | ||
}); | ||
|
||
const BlogPost = mongoose.model('BlogPost', BlogPostSchema); | ||
|
||
await Sentry.startSpan( | ||
{ | ||
name: 'Test Transaction', | ||
op: 'transaction', | ||
}, | ||
async () => { | ||
const post = new BlogPost(); | ||
post.title = 'Test'; | ||
post.body = 'Test body'; | ||
post.date = new Date(); | ||
|
||
await post.save(); | ||
|
||
await BlogPost.findOne({}); | ||
}, | ||
); | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
run(); |
Oops, something went wrong.