Skip to content

meta(changelog): Update changelog for 9.16.1 #16223

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 4 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott

## 9.16.1

- fix(core): Make sure logs get flushed in server-runtime-client ([#16222](https://github.com/getsentry/sentry-javascript/pull/16222))
- ref(node): Remove vercel flushing code that does nothing ([#16217](https://github.com/getsentry/sentry-javascript/pull/16217))

## 9.16.0

### Important changes
Expand Down
13 changes: 0 additions & 13 deletions dev-packages/node-integration-tests/suites/vercel/instrument.mjs

This file was deleted.

13 changes: 0 additions & 13 deletions dev-packages/node-integration-tests/suites/vercel/scenario.mjs

This file was deleted.

53 changes: 0 additions & 53 deletions dev-packages/node-integration-tests/suites/vercel/test.ts

This file was deleted.

5 changes: 5 additions & 0 deletions packages/core/src/server-runtime-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class ServerRuntimeClient<
if (this._options._experiments?.enableLogs) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const client = this;

client.on('flushLogs', () => {
client._logWeight = 0;
clearTimeout(client._logFlushIdleTimeout);
Expand All @@ -72,6 +73,10 @@ export class ServerRuntimeClient<
}, DEFAULT_LOG_FLUSH_INTERVAL);
}
});

client.on('flush', () => {
_INTERNAL_flushLogsBuffer(client);
});
}
}

Expand Down
20 changes: 20 additions & 0 deletions packages/core/test/lib/server-runtime-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,25 @@ describe('ServerRuntimeClient', () => {
expect(sendEnvelopeSpy).not.toHaveBeenCalled();
expect(client['_logWeight']).toBe(0);
});

it('flushes logs when flush event is triggered', () => {
const options = getDefaultClientOptions({
dsn: PUBLIC_DSN,
_experiments: { enableLogs: true },
});
client = new ServerRuntimeClient(options);

const sendEnvelopeSpy = vi.spyOn(client, 'sendEnvelope');

// Add some logs
_INTERNAL_captureLog({ message: 'test1', level: 'info' }, client);
_INTERNAL_captureLog({ message: 'test2', level: 'info' }, client);

// Trigger flush event
client.emit('flush');

expect(sendEnvelopeSpy).toHaveBeenCalledTimes(1);
expect(client['_logWeight']).toBe(0); // Weight should be reset after flush
});
});
});

This file was deleted.

18 changes: 0 additions & 18 deletions packages/node/src/integrations/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { addOriginToSpan } from '../../utils/addOriginToSpan';
import { getRequestUrl } from '../../utils/getRequestUrl';
import type { SentryHttpInstrumentationOptions } from './SentryHttpInstrumentation';
import { SentryHttpInstrumentation } from './SentryHttpInstrumentation';
import { SentryHttpInstrumentationBeforeOtel } from './SentryHttpInstrumentationBeforeOtel';

const INTEGRATION_NAME = 'Http';

Expand Down Expand Up @@ -117,10 +116,6 @@ interface HttpOptions {
};
}

const instrumentSentryHttpBeforeOtel = generateInstrumentOnce(`${INTEGRATION_NAME}.sentry-before-otel`, () => {
return new SentryHttpInstrumentationBeforeOtel();
});

const instrumentSentryHttp = generateInstrumentOnce<SentryHttpInstrumentationOptions>(
`${INTEGRATION_NAME}.sentry`,
options => {
Expand Down Expand Up @@ -162,19 +157,6 @@ export const httpIntegration = defineIntegration((options: HttpOptions = {}) =>
return {
name: INTEGRATION_NAME,
setupOnce() {
// TODO: get rid of this too
// Below, we instrument the Node.js HTTP API three times. 2 times Sentry-specific, 1 time OTEL specific.
// Due to timing reasons, we sometimes need to apply Sentry instrumentation _before_ we apply the OTEL
// instrumentation (e.g. to flush on serverless platforms), and sometimes we need to apply Sentry instrumentation
// _after_ we apply OTEL instrumentation (e.g. for isolation scope handling and breadcrumbs).

// This is Sentry-specific instrumentation that is applied _before_ any OTEL instrumentation.
if (process.env.VERCEL) {
// Currently this instrumentation only does something when deployed on Vercel, so to save some overhead, we short circuit adding it here only for Vercel.
// If it's functionality is extended in the future, feel free to remove the if statement and this comment.
instrumentSentryHttpBeforeOtel();
}

const instrumentSpans = _shouldInstrumentSpans(options, getClient<NodeClient>()?.getOptions());

// This is Sentry-specific instrumentation for request isolation and breadcrumbs
Expand Down
Loading