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

feat(core): Allow to pass start/end timestamp for spans flexibly #10060

Merged
merged 4 commits into from
Jan 5, 2024

Conversation

mydea
Copy link
Member

@mydea mydea commented Jan 4, 2024

We allow the same formats as OpenTelemetry:

  • number (we handle both seconds and milliseconds)
  • Date
  • [seconds, nanoseconds]

@mydea mydea self-assigned this Jan 4, 2024
* HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
* This is represented in HrTime format as [1609504210, 150000000].
*/
return input[0] + input[1] / 1e9;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is vendored we need to add license

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is only inspired, not copied - only the comment I took verbatim 🤔 but we can also move this to it's own file, then we can still add the licence even if it is adapted from there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with these kind of things, better be safe than sorry - let's move to it's own file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link
Contributor

github-actions bot commented Jan 4, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 76.12 KB (+0.03% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 67.5 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 61.13 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 32.1 KB (+0.08% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 30.49 KB (0%)
@sentry/browser - Webpack (gzipped) 22.21 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 73.57 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 65.21 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 31.4 KB (+0.1% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 23.36 KB (+0.27% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 204.41 KB (+0.03% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 94.29 KB (+0.07% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 69.23 KB (+0.2% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 34.37 KB (+0.13% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 67.9 KB (-0.02% 🔽)
@sentry/react - Webpack (gzipped) 22.23 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 84.57 KB (+0.05% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 49.17 KB (+0.07% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 16.73 KB (0%)

We allow the same formats as OpenTelemetry:

* `number` (we handle both seconds and milliseconds)
* `Date`
* `[seconds, nanoseconds]`
@@ -238,12 +239,17 @@ function createChildSpanOrTransaction(
return parentSpan ? parentSpan.startChild(ctx) : hub.startTransaction(ctx);
}

function normalizeContext(context: TransactionContext): TransactionContext {
function normalizeContext(context: StartSpanOptions): TransactionContext {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a small comment explaining what is normalized and why things need normalization?

@mydea mydea merged commit 5def983 into develop Jan 5, 2024
95 checks passed
@mydea mydea deleted the fn/spanTimestamps branch January 5, 2024 10:16
c298lee pushed a commit that referenced this pull request Jan 9, 2024
)

We allow the same formats as OpenTelemetry:

* `number` (we handle both seconds and milliseconds)
* `Date`
* `[seconds, nanoseconds]`
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

Successfully merging this pull request may close these issues.

None yet

3 participants