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

Breadcrumb Invalid Value Timestamp #12318

Closed
3 tasks done
jd-carroll opened this issue May 31, 2024 · 2 comments
Closed
3 tasks done

Breadcrumb Invalid Value Timestamp #12318

jd-carroll opened this issue May 31, 2024 · 2 comments
Labels
Package: node Issues related to the Sentry Node SDK Type: Bug

Comments

@jd-carroll
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

8.7.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

In addition to the normal spans, we are publishing a number of breadcrumbs to Sentry.

The code reporting these breadcrumbs to Sentry looks like:

  public reportMessage(message: string | AndookLogMessage, options: { level: SeverityLevel; prefix?: string }) {
    if (typeof message === 'string') {
      this._sentry.captureMessage(
        options.prefix ? `[${options.prefix}] ${message}` : message,
        options.level === 'trace' ? 'debug' : options.level
      );
    } else {
      this._sentry.addBreadcrumb({
        level: options.level === 'trace' ? 'debug' : options.level,
        category: message.type,
        data,
        timestamp: Date.now()
      });
    }
  }

The problem is that every time we call addBreadcrumb from the Sentry SDK, we receive notices in the console like:
image

But any message captured with captureMessage works without issue.

According to the types, timestamp should be:

    /**
     * The format is a numeric (integer or float) value representing
     * the number of seconds that have elapsed since the Unixepoch.
     * Breadcrumbs are most useful when they include a timestamp, as it creates a timeline
     * leading up to an event expection/error.
     *
     * @note The API supports a string as defined in RFC 3339, but the SDKs only support a numeric value for now.
     *
     * @summary A timestamp representing when the breadcrumb occurred.
     * @link https://develop.sentry.dev/sdk/event-payloads/breadcrumbs/#:~:text=is%20info.-,timestamp,-(recommended)
     */
    timestamp?: number;

Is it really supposed to be a number and not a string?

As an example if we look at the invalid value breadcrumbs.values.2.timestamp

The "invalid" value is: 1717173577649
Which corresponds to: Friday, May 31, 2024 4:39:37.649 PM

So the value itself is valid.

Expected Result

Adding a breadcrumb with a timestamp, the timestamp should appear in the console.

Actual Result

The error as above.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 31, 2024
@github-actions github-actions bot added the Package: node Issues related to the Sentry Node SDK label May 31, 2024
@jd-carroll
Copy link
Author

I'll also note, if this is an issue it would be in @sentry/core not @sentry/node.

@jd-carroll
Copy link
Author

Solved, the issue is that the timestamp needs to be in SECONDS not milliseconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: node Issues related to the Sentry Node SDK Type: Bug
Projects
Archived in project
Development

No branches or pull requests

1 participant