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

Timestamps sent with year 2077 #211

Open
gourgouris opened this issue Sep 18, 2023 · 3 comments
Open

Timestamps sent with year 2077 #211

gourgouris opened this issue Sep 18, 2023 · 3 comments

Comments

@gourgouris
Copy link

The following repro will send timestamps with year 2077 in Self Hosted:
In Sentry.io the transaction is dropped (I assume because it is 53 years in the future!)

import { Toucan } from "toucan-js";
import { addTracingExtensions } from '@sentry/core';

export interface Env {
  SENTRY_DSN: string;
}

export default {
  async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
    addTracingExtensions();
    const sentry = new Toucan({
      dsn: env.SENTRY_DSN,
      release: '1.0.0',
      context: ctx,
      request,
      sampleRate: 1.0,
      tracesSampleRate: 1.0,
      enableTracing: true,
    });

    const transaction = sentry.startTransaction({ name: 'test', description: 'test', op: 'http.server', metadata: { source: 'route' } });
    try {
      await fetch('https://google.com'); // just to cause some IO
      return new Response('Hello world!');
    } catch (e) {
      sentry.captureException(e);

      return new Response('Something went wrong! Team has been notified.', {
        status: 500,
      });
    } finally {
      transaction.finish();
    }
  },
};

Passing startTimestamp and endTimestamp explicitly via performance.now()/1000 it works as expected.
I have raised this issue with sentry, but they asked me to follow up here.
I am sorry if this is not related to this repo, but it could be worth being aware.

@timfish
Copy link
Contributor

timfish commented Sep 18, 2023

My understanding was that tracing is not currently supported:
#66

@gourgouris
Copy link
Author

Thank you.
I did not realize that tracing was not supported, I dont know how I drew that conclusion - apologies.

The runtime seems to support the Performance API nowadays https://community.cloudflare.com/t/2023-5-12-workers-runtime-release-notes/508952 with the limitation that time advances only when I/O is performed - which is better than nothing.

@robertcepa
Copy link
Owner

I'll take a closer look at performance tracing, but to some extent, it will continue being limited due to how Workers runtime provides current time. However, I think measurements around IO boundaries can still be useful.

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

3 participants