Skip to content
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ Work in this release was contributed by @faizansaiyed123, @itisrmk, @kunal649, @

These integrations need the vite plugin. Without it, they record nothing, and with `debug: true` the SDK logs a warning.

- **ref(deno): Use the shared request handler wrapper for `Deno.serve`**

`Deno.serve` now uses a request handler wrapper that `Bun.serve` and Cloudflare will also use. Three small changes for Deno users:

- When the source of a streamed response fails, the SDK now captures the error and marks the span as failed.
- The SDK no longer reads a streamed response ahead of the client.
- Errors in `OPTIONS` and `HEAD` requests now carry the request data.

## 11.9.0

### Important Changes
Expand Down
42 changes: 30 additions & 12 deletions packages/deno/src/integrations/deno-serve.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Event, IntegrationFn, MaxRequestBodySize, Span } from '@sentry/core';
import type { Client, Event, Integration, IntegrationFn, MaxRequestBodySize, Span } from '@sentry/core';
import { debug, defineIntegration } from '@sentry/core';
import type { AssertTrue, CheckServerRequestOptions } from '@sentry/core/server';
import type { AssertTrue, CheckServerRequestOptions, ServerRequestOptions } from '@sentry/core/server';
import { DEFAULT_IGNORE_STATUS_CODES, processHttpServerTransactionEvent } from '@sentry/core/server';
import type { RequestHandlerWrapperOptions } from '../wrap-deno-request-handler';
import { wrapDenoRequestHandler } from '../wrap-deno-request-handler';
Expand Down Expand Up @@ -140,6 +140,7 @@ const applyHandlerWrap =
request,
info,
serveOptions,
getRequestOptions: getDenoServeRequestOptions,
} as RequestHandlerWrapperOptions<A>,
() => handler(request, info as Deno.ServeHandlerInfo<A>),
);
Expand All @@ -159,21 +160,38 @@ const instrumentedDenoServe = (serve: typeof Deno.serve): typeof Deno.serve =>
},
});

const _denoServeIntegration = ((options: DenoServeIntegrationOptions = {}) => {
// Every shared option is a required key, so a new one fails to compile below until the integration
// passes it on.
type DenoServeRequestOptions = {
[K in keyof Required<ServerRequestOptions<Request, Response>>]: ServerRequestOptions<Request, Response>[K];
};

interface DenoServeIntegration extends Integration {
requestOptions: DenoServeRequestOptions;
}

/** The incoming request options of the client's `denoServeIntegration`, if it has one. */
function getDenoServeRequestOptions(client: Client): ServerRequestOptions<Request, Response> | undefined {
return client.getIntegrationByName<DenoServeIntegration>(INTEGRATION_NAME)?.requestOptions;
}

const _denoServeIntegration = ((options: DenoServeIntegrationOptions = {}): DenoServeIntegration => {
// oxlint-disable-next-line typescript/no-deprecated
const ignoreStatusCodes = options.ignoreStatusCodes ?? DEFAULT_IGNORE_STATUS_CODES;

return {
name: INTEGRATION_NAME,
maxRequestBodySize: options.maxRequestBodySize,
ignoreRequestBody: options.ignoreRequestBody,
ignoreIncomingRequests: options.ignoreIncomingRequests,
ignoreStaticAssets: options.ignoreStaticAssets ?? true,
spans: options.spans,
onSpanCreated: options.onSpanCreated,
onSpanEnd: options.onSpanEnd,
sessions: options.sessions ?? true,
sessionFlushingDelayMS: options.sessionFlushingDelayMS,
requestOptions: {
maxRequestBodySize: options.maxRequestBodySize,
ignoreRequestBody: options.ignoreRequestBody,
ignoreIncomingRequests: options.ignoreIncomingRequests,
ignoreStaticAssets: options.ignoreStaticAssets ?? true,
spans: options.spans,
onSpanCreated: options.onSpanCreated,
onSpanEnd: options.onSpanEnd,
sessions: options.sessions ?? true,
sessionFlushingDelayMS: options.sessionFlushingDelayMS,
},
processEvent(event: Event): Event | null {
// Gated on this integration's own span origin so it does not filter `node:http`
// transactions, which `denoHttpIntegration` owns via its own `ignoreStatusCodes`.
Expand Down
72 changes: 0 additions & 72 deletions packages/deno/src/utils/streaming.ts

This file was deleted.

Loading
Loading