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

chore: add spanId and parentSpanId #216

Closed
Angelf0ne01 opened this issue Dec 4, 2024 · 2 comments · Fixed by #223
Closed

chore: add spanId and parentSpanId #216

Angelf0ne01 opened this issue Dec 4, 2024 · 2 comments · Fixed by #223

Comments

@Angelf0ne01
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

implement spanId and parentSpanId

Here is the diff that solved my problem:

diff --git a/node_modules/sentry-testkit/dist/transformers.js b/node_modules/sentry-testkit/dist/transformers.js
index ee043f9..71f4504 100644
--- a/node_modules/sentry-testkit/dist/transformers.js
+++ b/node_modules/sentry-testkit/dist/transformers.js
@@ -27,6 +27,11 @@ function transformTransaction(item) {
     return {
         name: item.transaction,
         traceId: item.contexts.trace.trace_id,
+        spanId: item.contexts.trace.span_id,
+        status: item.contexts.trace.status,
+        data: item.contexts.trace?.data ?? {},
+        op: item.contexts.trace?.op ?? null,
+        parentSpanId: item.contexts.trace?.parent_span_id ?? null,
         release: item.release,
         tags: item.tags || {},
         extra: item.extra,
diff --git a/node_modules/sentry-testkit/dist/types.d.ts b/node_modules/sentry-testkit/dist/types.d.ts
index a3f3cd2..cb185d9 100644
--- a/node_modules/sentry-testkit/dist/types.d.ts
+++ b/node_modules/sentry-testkit/dist/types.d.ts
@@ -33,12 +33,17 @@ declare namespace sentryTestkit {
         parentSpanId: string;
     }
     interface Transaction {
-        name: string;
-        traceId: string;
-        release?: string;
-        extra?: Record<string, unknown>;
-        tags: Record<string, unknown>;
-        spans: Span[];
+        name: string
+        traceId: string
+        spanId: string
+        parentSpanId?: string | null
+        data?: Record<string, unknown>
+        status?: string | null
+        op?: string | null
+        release?: string
+        extra?: Record<string, unknown>
+        tags: Record<string, unknown>
+        spans: Span[]
     }
     interface Testkit {
         puppeteer: {

This issue body was partially generated by patch-package.

@zivl
Copy link
Owner

zivl commented Dec 12, 2024

Thank you @Angelf0ne01 for you warm words ❤️
Do you want to PR this?
We are actually working on upgrade this testkit to align with latest Sentry version. just struggling with capacity issues at the moment

Copy link
Contributor

github-actions bot commented Mar 1, 2025

Stale issue message

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 a pull request may close this issue.

2 participants