Skip to content

Conversation

unflxw
Copy link
Contributor

@unflxw unflxw commented Jul 16, 2025

Use return value from hooks

The return value from decorators and overrides is ignored. Instead
of the returned span, the initial span (which may have been modified
in-place by the decorators or override) is used.

Delete the compose function, which is now unused.

Add span getters

Add getter methods for the span's properties, so users can inspect
the state of the span in overrides and make decisions based on it,
without having to dig into the undocumented ._data property.

Ignore errors after overrides

Run the logic to ignore an error based on its message and the
ignoreErrors configuration option after overrides have ran. This
allows overrides to be used to tweak the message to trigger or skip
the behaviour of this configuration option.

Allow ignoring spans in overrides

Allow for a span to be ignored by an override returning false from
it. Along with the getters, this allows customers to implement their
own span ignoring logic.

@unflxw unflxw requested review from jvanbaarsen and tombruijn July 16, 2025 11:13
@unflxw unflxw added bug Confirmed and unconfirmed bugs reported by us and customers. enhancement An improvement to an existing feature. labels Jul 16, 2025
@unflxw unflxw self-assigned this Jul 16, 2025
@backlog-helper
Copy link

backlog-helper bot commented Jul 16, 2025

✔️ All good!

New issue guide | Backlog management | Rules | Feedback

@unflxw unflxw force-pushed the fix-decorators-overrides branch 2 times, most recently from 383758a to 5e83537 Compare July 16, 2025 11:44
Copy link
Member

@tombruijn tombruijn left a comment

Choose a reason for hiding this comment

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

Please have a look at the broken build on CI and don't forget to add a changeset.

I'm also okay with making a breaking change as long as the version bump matches.

return this
}

public getAction(): string | undefined {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add some unit tests for these new helpers?

@unflxw
Copy link
Contributor Author

unflxw commented Jul 17, 2025

@tombruijn I took a look at the mismatches between types, and got so frustrated at the structure of the packages that I folded the core and types packages into the main javascript package.

In my view, this change removes a significant source of typing, packaging and distribution headaches, and was worth doing at some point. Let me know if you disagree, and also let me know if you think it deserves a greater version bump, or if marking types and core as deprecated on npm does suffice.

@unflxw unflxw requested a review from tombruijn July 17, 2025 10:39
@tombruijn
Copy link
Member

@unflxw I'm all for simplifying this integration. If we have less packages, go for it. From what I understand other packages do rely on these core and types packages, but also needed the appsignal/javascript package to function anyway.

Let me know when the build is green and I can review it :)

@unflxw unflxw force-pushed the fix-decorators-overrides branch from 25362ac to 12c147a Compare July 17, 2025 12:59
@unflxw unflxw force-pushed the fix-decorators-overrides branch from 12c147a to cc4b6d8 Compare July 17, 2025 15:53
unflxw added 3 commits July 17, 2025 18:30
The return value from decorators and overrides is ignored. Instead
of the returned span, the initial span (which may have been modified
in-place by the decorators or override) is used.

Delete the `compose` function, which is now unused.
Add getter methods for the span's properties, so users can inspect
the state of the span in overrides and make decisions based on it,
without having to dig into the undocumented `._data` property.
Run the logic to ignore an error based on its message and the
`ignoreErrors` configuration option after overrides have ran. This
allows overrides to be used to tweak the message to trigger or skip
the behaviour of this configuration option.
@unflxw unflxw force-pushed the fix-decorators-overrides branch from cc4b6d8 to 727b482 Compare July 17, 2025 16:30
unflxw added 2 commits July 17, 2025 18:41
Allow for a span to be ignored by an override returning `false` from
it. Along with the getters, this allows customers to implement their
own span ignoring logic.
Remove the `core` and `types` packages, folding their contents into
the main `javascript` package. This causes a dependency on the
`javascript` package where there previously was one on `types`, but
this applies to packages that have no meaningful usage patterns
independently from the `javascript` package.
@unflxw unflxw force-pushed the fix-decorators-overrides branch from 727b482 to f9dd80c Compare July 17, 2025 16:41
@unflxw unflxw merged commit 9a75ad4 into main Jul 17, 2025
24 checks passed
@unflxw unflxw mentioned this pull request Sep 16, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Confirmed and unconfirmed bugs reported by us and customers. enhancement An improvement to an existing feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants