Title: Higher precision start timestamp for Spans · Issue #2394 · getsentry/sentry-java · GitHub
Open Graph Title: Higher precision start timestamp for Spans · Issue #2394 · getsentry/sentry-java
X Title: Higher precision start timestamp for Spans · Issue #2394 · getsentry/sentry-java
Description: Problem Statement Spans are currently only ms precision but appear to be more precise due to being converted to a double. In the UI it looks like start_timestamp of a span is μs. This is caused by a number of things. Relay strips ns from...
Open Graph Description: Problem Statement Spans are currently only ms precision but appear to be more precise due to being converted to a double. In the UI it looks like start_timestamp of a span is μs. This is caused by ...
X Description: Problem Statement Spans are currently only ms precision but appear to be more precise due to being converted to a double. In the UI it looks like start_timestamp of a span is μs. This is caused by ...
Opengraph URL: https://github.com/getsentry/sentry-java/issues/2394
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Higher precision start timestamp for Spans","articleBody":"### Problem Statement\n\nSpans are currently only `ms` precision but appear to be more precise due to being converted to a `double`. In the UI it looks like `start_timestamp` of a span is `μs`. This is caused by a number of things.\r\n\r\n- Relay strips `ns` from the timestamp and uses `μs` instead (see https://github.com/getsentry/relay/blob/adbf8ff387285935553354c48ef04798c9a1c1ae/relay-general/src/protocol/types.rs#L965-L983).\r\n- The Java SDK records the start timestamp as `Date`, then retrieves the millis via `getTime()` and then divides by `1000` (see https://github.com/getsentry/sentry-java/blob/b85d8aa769af9c5855093b400dc212b88d93eee8/sentry/src/main/java/io/sentry/protocol/SentrySpan.java#L60)\n\n### Solution Brainstorm\n\nWe could create a `DateProvider` interface which has a `now()` method that returns the current timestamp as `SentryDate`. Then there could by different implementations:\r\n- For older versions there could be one that keeps the current `Date` + `System.nanoTime`\r\n- For Java 9+ and Android API 26+ we could use `Instant`\r\n\r\nWe could then allow passing in `SentryDate` when starting a span or when calling `finish`. For users who want to supply their own timestamps with high precision we could offer something like a `SentryDoubleDate` that just holds a double.\r\n\r\nThe `SentryDate` should also have a `Double diff(SentryDate date)` method that can calculate the difference using internals like the separate `System.nanoTime` that was collected.","author":{"url":"https://github.com/adinauer","@type":"Person","name":"adinauer"},"datePublished":"2022-11-28T10:51:20Z","url":"https://github.com/getsentry/sentry-java/issues/2394"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:631deab4-e359-59f6-9cce-aceb4061f0ad |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F28:2843FB:CDEF8:11A180:6B0463AE |
| html-safe-nonce | 3fd2f20827fa651d67eac36d5af7679e1511c97fac043f101a3d6347a11588df |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjI4OjI4NDNGQjpDREVGODoxMUExODA6NkIwNDYzQUUiLCJ2aXNpdG9yX2lkIjoiNTg3MDU3NjA5NzU3NzY5MDAzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3894b9789917de15f9d5f9b44e2c9cf89691d50c5d98b6b100e41ce8c0d5797e |
| hovercard-subject-tag | issue:1466205004 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-java/2394/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d720cf4153ed80113b85aea161f4d9464daafd985fd5c177a078ab4b3b936f25/getsentry/sentry-java/issues/2394 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d720cf4153ed80113b85aea161f4d9464daafd985fd5c177a078ab4b3b936f25/getsentry/sentry-java/issues/2394 |
| og:image:alt | Problem Statement Spans are currently only ms precision but appear to be more precise due to being converted to a double. In the UI it looks like start_timestamp of a span is μs. This is caused by ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | adinauer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2d58451b4bcb73c33c67bfb6b28fb75fe6d5e279daf9b560fa4fd832f3d8c9a6 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3368190 |
| octolytics-dimension-repository_nwo | getsentry/sentry-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3368190 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 03e114520787ad27289207f153520ef97461127c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width