Skip to content
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

Transactions and spans not being propagated - bug or as intended? #224

Open
kaytwo opened this issue Feb 19, 2024 · 1 comment
Open

Transactions and spans not being propagated - bug or as intended? #224

kaytwo opened this issue Feb 19, 2024 · 1 comment

Comments

@kaytwo
Copy link

kaytwo commented Feb 19, 2024

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!

@mann1996
Copy link

mann1996 commented Aug 1, 2024

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants