-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(solidstart): Auto-wire orchestrion build-time instrumentation #22827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
56b61be
feat(solidstart): Auto-wire orchestrion build-time instrumentation
chargome ab1d207
test(solidstart): Cover orchestrion wiring in withSentry
chargome 16dd435
test(solidstart): Add DB e2e coverage for orchestrion
chargome b8d4339
ref(solidstart): Document orchestrion rollupConfig cast
chargome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
dev-packages/e2e-tests/test-applications/solidstart/docker-compose.yml
This file contains hidden or 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,31 @@ | ||
| services: | ||
| db: | ||
| image: mysql:8.0 | ||
| restart: always | ||
| container_name: e2e-tests-solidstart-mysql | ||
| # The `mysql` 2.x driver doesn't speak MySQL 8's default | ||
| # `caching_sha2_password` auth, so force the legacy plugin. | ||
| command: ['--default-authentication-plugin=mysql_native_password'] | ||
| ports: | ||
| - '3306:3306' | ||
| environment: | ||
| MYSQL_ROOT_PASSWORD: docker | ||
| healthcheck: | ||
| test: ['CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 -uroot -pdocker'] | ||
| interval: 2s | ||
| timeout: 3s | ||
| retries: 30 | ||
| start_period: 10s | ||
|
|
||
| redis: | ||
| image: redis:7 | ||
| restart: always | ||
| container_name: e2e-tests-solidstart-redis | ||
| ports: | ||
| - '6379:6379' | ||
| healthcheck: | ||
| test: ['CMD', 'redis-cli', 'ping'] | ||
| interval: 2s | ||
| timeout: 3s | ||
| retries: 30 | ||
| start_period: 5s |
14 changes: 14 additions & 0 deletions
14
dev-packages/e2e-tests/test-applications/solidstart/global-setup.mjs
This file contains hidden or 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,14 @@ | ||
| import { execSync } from 'child_process'; | ||
| import { dirname } from 'path'; | ||
| import { fileURLToPath } from 'url'; | ||
|
|
||
| const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
|
|
||
| export default async function globalSetup() { | ||
| // Start MySQL + Redis via Docker Compose. `--wait` blocks until the | ||
| // healthchecks in docker-compose.yml pass, so the app can connect immediately. | ||
| execSync('docker compose up -d --wait', { | ||
| cwd: __dirname, | ||
| stdio: 'inherit', | ||
| }); | ||
| } |
12 changes: 12 additions & 0 deletions
12
dev-packages/e2e-tests/test-applications/solidstart/global-teardown.mjs
This file contains hidden or 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,12 @@ | ||
| import { execSync } from 'child_process'; | ||
| import { dirname } from 'path'; | ||
| import { fileURLToPath } from 'url'; | ||
|
|
||
| const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
|
|
||
| export default async function globalTeardown() { | ||
| execSync('docker compose down --volumes', { | ||
| cwd: __dirname, | ||
| stdio: 'inherit', | ||
| }); | ||
| } |
This file contains hidden or 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 hidden or 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
18 changes: 18 additions & 0 deletions
18
dev-packages/e2e-tests/test-applications/solidstart/src/routes/api/db-ioredis.ts
This file contains hidden or 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 { json } from '@solidjs/router'; | ||
| import Redis from 'ioredis'; | ||
|
|
||
| export async function GET() { | ||
| const redis = new Redis({ | ||
| // Don't keep retrying forever if Redis goes away (e.g. on test teardown) | ||
| maxRetriesPerRequest: 1, | ||
| retryStrategy: () => null, | ||
| }); | ||
|
|
||
| try { | ||
| await redis.set('test-key', 'test-value'); | ||
| const value = await redis.get('test-key'); | ||
| return json({ value }); | ||
| } finally { | ||
| redis.disconnect(); | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
dev-packages/e2e-tests/test-applications/solidstart/src/routes/api/db-mysql.ts
This file contains hidden or 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,20 @@ | ||
| import { json } from '@solidjs/router'; | ||
| import mysql from 'mysql'; | ||
|
|
||
| export async function GET() { | ||
| const connection = mysql.createConnection({ user: 'root', password: 'docker' }); | ||
| try { | ||
| await new Promise<void>((resolve, reject) => { | ||
| connection.query('SELECT 1 + 1 AS solution', err1 => { | ||
| if (err1) return reject(err1); | ||
| connection.query('SELECT NOW()', ['1', '2'], err2 => { | ||
| if (err2) return reject(err2); | ||
| resolve(); | ||
| }); | ||
| }); | ||
| }); | ||
| return json({ status: 'ok' }); | ||
| } finally { | ||
| connection.end(() => {}); | ||
| } | ||
| } |
86 changes: 86 additions & 0 deletions
86
dev-packages/e2e-tests/test-applications/solidstart/tests/db.test.ts
This file contains hidden or 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,86 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
| import { waitForTransaction } from '@sentry-internal/test-utils'; | ||
|
|
||
| test('Instruments ioredis automatically via build-time orchestrion', async ({ baseURL }) => { | ||
| const transactionEventPromise = waitForTransaction('solidstart', transactionEvent => { | ||
| return ( | ||
| transactionEvent.contexts?.trace?.op === 'http.server' && !!transactionEvent.transaction?.includes('db-ioredis') | ||
| ); | ||
| }); | ||
|
|
||
| await fetch(`${baseURL}/api/db-ioredis`); | ||
|
|
||
| const transactionEvent = await transactionEventPromise; | ||
| const spans = transactionEvent.spans || []; | ||
|
|
||
| expect(spans).toContainEqual( | ||
| expect.objectContaining({ | ||
| op: 'db', | ||
| origin: 'auto.db.orchestrion.redis', | ||
| description: 'set test-key [1 other arguments]', | ||
| status: 'ok', | ||
| data: expect.objectContaining({ | ||
| 'db.system': 'redis', | ||
| 'db.statement': 'set test-key [1 other arguments]', | ||
| }), | ||
| }), | ||
| ); | ||
| expect(spans).toContainEqual( | ||
| expect.objectContaining({ | ||
| op: 'db', | ||
| origin: 'auto.db.orchestrion.redis', | ||
| description: 'get test-key', | ||
| status: 'ok', | ||
| data: expect.objectContaining({ | ||
| 'db.system': 'redis', | ||
| 'db.statement': 'get test-key', | ||
| }), | ||
| }), | ||
| ); | ||
| }); | ||
|
|
||
| test('Instruments mysql automatically via build-time orchestrion', async ({ baseURL }) => { | ||
| const transactionEventPromise = waitForTransaction('solidstart', transactionEvent => { | ||
| return ( | ||
| transactionEvent.contexts?.trace?.op === 'http.server' && !!transactionEvent.transaction?.includes('db-mysql') | ||
| ); | ||
| }); | ||
|
|
||
| await fetch(`${baseURL}/api/db-mysql`); | ||
|
|
||
| const transactionEvent = await transactionEventPromise; | ||
| const spans = transactionEvent.spans || []; | ||
|
|
||
| expect(spans).toContainEqual( | ||
| expect.objectContaining({ | ||
| op: 'db', | ||
| origin: 'auto.db.orchestrion.mysql', | ||
| description: 'SELECT 1 + 1 AS solution', | ||
| status: 'ok', | ||
| data: expect.objectContaining({ | ||
| 'db.system': 'mysql', | ||
| 'db.statement': 'SELECT 1 + 1 AS solution', | ||
| 'db.user': 'root', | ||
| 'db.connection_string': expect.any(String), | ||
| 'net.peer.name': expect.any(String), | ||
| 'net.peer.port': 3306, | ||
| }), | ||
| }), | ||
| ); | ||
| expect(spans).toContainEqual( | ||
| expect.objectContaining({ | ||
| op: 'db', | ||
| origin: 'auto.db.orchestrion.mysql', | ||
| description: 'SELECT NOW()', | ||
| status: 'ok', | ||
| data: expect.objectContaining({ | ||
| 'db.system': 'mysql', | ||
| 'db.statement': 'SELECT NOW()', | ||
| 'db.user': 'root', | ||
| 'db.connection_string': expect.any(String), | ||
| 'net.peer.name': expect.any(String), | ||
| 'net.peer.port': 3306, | ||
| }), | ||
| }), | ||
| ); | ||
| }); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.