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

capture stack trace for tracing spans #2673

Merged
merged 17 commits into from
May 10, 2024
Merged

capture stack trace for tracing spans #2673

merged 17 commits into from
May 10, 2024

Conversation

tim-smart
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented May 1, 2024

🦋 Changeset detected

Latest commit: 22bdee8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
effect Minor
@effect/experimental Major
@effect/platform Major
@effect/rpc Major
@effect/sql Major
@effect/opentelemetry Major
@effect/cli Major
@effect/platform-browser Major
@effect/platform-bun Major
@effect/platform-node-shared Major
@effect/platform-node Major
@effect/printer-ansi Major
@effect/printer Major
@effect/rpc-http Major
@effect/schema Major
@effect/sql-mssql Major
@effect/sql-mysql2 Major
@effect/sql-pg Major
@effect/sql-sqlite-bun Major
@effect/sql-sqlite-node Major
@effect/sql-sqlite-react-native Major
@effect/sql-sqlite-wasm Major
@effect/typeclass Major
@effect/vitest Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot changed the base branch from main to next-minor May 1, 2024 02:27
@tim-smart tim-smart linked an issue May 1, 2024 that may be closed by this pull request
@tim-smart tim-smart force-pushed the span-location branch 2 times, most recently from 1b17dcc to 5d6d9b7 Compare May 1, 2024 04:31
@mikearnaldi
Copy link
Member

we should probably have a way of disabling capture

@tim-smart
Copy link
Member Author

You can set captureStackTrace to false to disable it.

@mikearnaldi
Copy link
Member

Error: ok
    at /Users/michaelarnaldi/repositories/effect/packages/effect/test/Effect/cause-rendering.test.ts:13:25
    at Generator.next (<anonymous>)
    at /Users/michaelarnaldi/repositories/effect/packages/effect/src/internal/core-effect.ts:789:28
    at spanA
        at /Users/michaelarnaldi/repositories/effect/packages/effect/test/Effect/cause-rendering.test.ts:12:18
    at spanB
        at /Users/michaelarnaldi/repositories/effect/packages/effect/test/Effect/cause-rendering.test.ts:11:16

This format while nice may break parsers, such as vitest, probably better to use:

Error: ok
    at /Users/michaelarnaldi/repositories/effect/packages/effect/test/Effect/cause-rendering.test.ts:13:25
    at Generator.next (<anonymous>)
    at /Users/michaelarnaldi/repositories/effect/packages/effect/src/internal/core-effect.ts:789:28
    at spanA (/Users/michaelarnaldi/repositories/effect/packages/effect/test/Effect/cause-rendering.test.ts:12:18)
    at spanB (/Users/michaelarnaldi/repositories/effect/packages/effect/test/Effect/cause-rendering.test.ts:11:16)

@mikearnaldi
Copy link
Member

You can set captureStackTrace to false to disable it.

true, I didn't see it in the functionWithSpan equivalent

@mikearnaldi
Copy link
Member

Something is odd in the filtering algo, trying to hide the internal call point with custom, leads to this:

Screenshot 2024-05-01 at 10 10 14

@mikearnaldi
Copy link
Member

I mean trying to remove that line with internal:

Screenshot 2024-05-01 at 10 11 30

@tim-smart tim-smart force-pushed the span-location branch 3 times, most recently from 0028680 to 9c72a49 Compare May 1, 2024 22:51
@mikearnaldi
Copy link
Member

Looks like there is an issue:

Screenshot 2024-05-02 at 09 56 29

@mikearnaldi
Copy link
Member

Fixed, the error rendering is still broken though:

Screenshot 2024-05-02 at 09 59 01

This contains a lot of internals and the last line format is incorrect:

at myError (<anonymous> (/Users/michaelarnaldi/repositories/effect/scratchpad/ok.ts:13:19))

Should be instead:

(FiberFailure) TooLarge
    at /Users/michaelarnaldi/repositories/effect/scratchpad/ok.ts:6:45
    at myError (/Users/michaelarnaldi/repositories/effect/scratchpad/ok.ts:13:19)

to be aligned with standard stack traces

@mikearnaldi
Copy link
Member

even more standard would be:

(FiberFailure) TooLarge
    at <anonymous> (/Users/michaelarnaldi/repositories/effect/scratchpad/ok.ts:6:45)
    at myError (/Users/michaelarnaldi/repositories/effect/scratchpad/ok.ts:13:19)

@tim-smart
Copy link
Member Author

Better now:
image

I added EffectPrimitive.commit as a cutpoint. Could also change YieldableError to only capture 1 frame, but then it wouldn't work with other types of Error instances.

@mikearnaldi
Copy link
Member

Better now: image

I added EffectPrimitive.commit as a cutpoint. Could also change YieldableError to only capture 1 frame, but then it wouldn't work with other types of Error instances.

Not sure about EffectPrimitive.commit as cutpoint given that EffectPrimitive could be minified (class names are not guaranteed to remain), that's why custom uses effect_instruction_i as a cutpoint

@tim-smart
Copy link
Member Author

Hmm ok, maybe we just capture 1 frame with YieldableError then? Then we will just have the line where the error was created.

@mikearnaldi
Copy link
Member

Why not using the custom trick? We could have commit call internally effect_instruction_i and it would cut

@mikearnaldi
Copy link
Member

If we allowed breaking we could just rename commit, this is kind of an in between till 4.0

@github-actions github-actions bot force-pushed the next-minor branch 4 times, most recently from 5dbe740 to 5f8f81a Compare May 5, 2024 06:00
github-actions bot pushed a commit that referenced this pull request May 13, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 13, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 14, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 14, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 14, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 15, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 15, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 15, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 15, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 15, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 15, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 15, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 16, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 16, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 16, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 16, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 16, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 16, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 16, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 17, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 17, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 17, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 18, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 19, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 19, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
github-actions bot pushed a commit that referenced this pull request May 19, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
tim-smart added a commit that referenced this pull request May 20, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
tim-smart added a commit that referenced this pull request May 20, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
tim-smart added a commit that referenced this pull request May 20, 2024
Co-authored-by: Michael Arnaldi <michael.arnaldi@effectful.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Carry stack location in span
3 participants