Hi,
I'm trying to write middleware that uses Sentry for distributed tracing through Toucan for an Astro site with Cloudflare Workers SSR.
As is, the only reporting I'm seeing is individual event propagation via e.g. captureException. With the code as-is, these errors are unconnected to any individual trace even though the Sentry-Trace header is being sent to the server side (and is on the same domain so doesn't have any CORS problems).
I'm able to use the relatively new propagationContextFromHeaders utility function like so:
import { propagationContextFromHeaders } from "@sentry/utils";
export const onRequest = defineMiddleware(async (context, next) => {
// ...
const propagationContext = propagationContextFromHeaders(
context.request.headers.get("sentry-trace") ?? undefined,
context.request.headers.get("baggage")
);
// @ts-expect-error because of minor mismatch in propagationContext type
sentry.getScope().setPropagationContext(propagationContext);
And then errors will end up logged and associated with the trace id initiated on the client side, but with no information beyond the fact the error happened. However, even when I add the Transaction integration via integrations: [new Transaction()], in the Toucan constructor, I don't see any sentry reporting about the spans and or transaction that the individual trace was a part of.
I understand that performance timing / Date.now() are inaccurate on the CF Worker platform, but I am wondering whether there is a way to get Toucan to still report the (inaccurate) timestamps and transactions/spans. I tried creating new transactions/child spans, running .finish(), and still don't see anything reported, either using a beforeSend hook in the Toucan constructor or on the Sentry dashboard.
Is there a way to get those reported? And would a PR adding the propagation context by default in Toucan be desirable? Thanks!
Hi, I'm trying to write middleware that uses Sentry for distributed tracing through Toucan for an Astro site with Cloudflare Workers SSR.
As is, the only reporting I'm seeing is individual event propagation via e.g.
captureException
. With the code as-is, these errors are unconnected to any individual trace even though theSentry-Trace
header is being sent to the server side (and is on the same domain so doesn't have any CORS problems).I'm able to use the relatively new
propagationContextFromHeaders
utility function like so:And then errors will end up logged and associated with the trace id initiated on the client side, but with no information beyond the fact the error happened. However, even when I add the Transaction integration via
integrations: [new Transaction()],
in the Toucan constructor, I don't see any sentry reporting about the spans and or transaction that the individual trace was a part of.I understand that performance timing / Date.now() are inaccurate on the CF Worker platform, but I am wondering whether there is a way to get Toucan to still report the (inaccurate) timestamps and transactions/spans. I tried creating new transactions/child spans, running
.finish()
, and still don't see anything reported, either using abeforeSend
hook in the Toucan constructor or on the Sentry dashboard.Is there a way to get those reported? And would a PR adding the propagation context by default in Toucan be desirable? Thanks!