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

meta(changelog): Update changelog for 8.10.0 #12542

Merged
merged 30 commits into from
Jun 19, 2024
Merged

Conversation

mydea
Copy link
Member

@mydea mydea commented Jun 19, 2024

Includes a bunch of fixes!

github-actions bot and others added 29 commits June 12, 2024 08:50
[Gitflow] Merge master into develop
VSCode does not pick up the `tsconfig.test.json` files, and thus does
not apply the config properly to the test files. By adding a
tsconfig.json into the test/ directory, this is picked up correctly by
VSCode as well.
…12394)

Attach profile context to events while a profiler is active and assign
thread id and name to the trace context.

This will be required by the profiling API so that we can figure out the
links between spans and profiles. In the future (span streaming), tid
and thread name will be assigned to each span
I noticed that we were not correctly setting a status message based on
http status for errored http.server span.
The problem was in our logic, where we already had the status set to `{
code: 2, message: undefined }`, and whenever the code was not 0 (unset),
we'd never look at the attributes to infer the proper status message.

Now, if we have code: 2 but not message, we try to infer the message
from the attributes, if possible.
…LOG.md (#12428)

This adds a new GHA job that, if a PR is created by an external
contributor, it will open a PR against that branch that adds the
contributor to the changelog, so we do not forget about this.

It will open a PR like this:

#12435

which we have to manually merge/review, so nothing "bad" can happen.
Screenshots will no longer become larger to fit the screenshot area
after being cropped, instead it would remain the same size. The image
quality of the screenshot goes down if the image is cropped too much.
This could help make small crops a bit more readable.
Before:
<img width="1716" alt="Select a speeder"
src="https://github.com/getsentry/sentry-javascript/assets/55311782/c99af75e-4cfc-41e2-86bc-f0232962f91a">
After:
<img width="1716" alt="Pasted Graphic"
src="https://github.com/getsentry/sentry-javascript/assets/55311782/1bd2b1ef-ef8c-4b6d-90fa-ae444141ede0">
Relates to #12329
Updates the expected status message for 404 span reflecting the updates
in #12477
Ensure we run node-integration, remix, nextjs tests for changes in
opentelemetry package.

You can see how this PR:
#12477 did not
trigger node-integration tests 😬
Ref: #11040

Migrates Remix server-side SDK to
[opentelemetry-instrumentation-remix](https://www.npmjs.com/package/opentelemetry-instrumentation-remix).

This PR also keeps the original implementation not the break the
developer experience for non-Express Remix projects.
Remix projects using Express are supported as is using the new
`autoInstrumentRemix` option.

**Usage with Express:**

```javascript
// instrument.(cjs | mjs)
const Sentry = require('@sentry/remix');

Sentry.init({
  dsn: YOUR_DSN
  // ...
  // auto instrument Remix with OpenTelemetry
  autoInstrumentRemix: true,
  // Optionally capture action formData attributes with errors.
  // This requires `sendDefaultPii` set to true as well.
  captureActionFormDataKeys: {
    file: true,
    text: true,
  },
  // To capture action formData attributes.
  sendDefaultPii: true
});
``` 

```javascript
// server.(cjs | mjs)
// import the Sentry instrumentation file before anything else.
import './instrument.cjs';
// alternatively `require('./instrument.cjs')`

// ...

const app = express();

// ...
```

**Usage with built-in Remix server:**

You need to run the Remix server with `NODE_OPTIONS=`--require(...)`
set.

```json
// package.json

// ...
  "scripts": {
    "start": "NODE_OPTIONS='--require=./instrument.server.cjs' remix-serve build"
    // or
    "start": "NODE_OPTIONS='--import=./instrument.server.mjs' remix-serve build"
  }
// ...
```

This PR _**removes**_:
- Express server adapter.
There is no need to use `wrapExpressCreateRequestHandler` anymore even
if you don't opt-in to `autoInstrumentRemix`.
`wrapExpressCreateRequestHandler` is kept exported as a no-op function.

- Built in HTTP incoming request instrumentation for both `legacy` and
`otel` implementations. Instead we mark `requestHandler` spans as the
root `http.server` spans.

When `autoInstrumentRemix` is set to `true`, this update _**replaces**_:

- Performance tracing on `action` / `loader` / `documentRequest`
functions. Leaving them to be traced by
`opentelemetry-instrumentation-remix`
- Request handler instrumentation as they are also traced by
`opentelemetry-instrumentation-remix`
- Auto-instrumentation for http as default integration for Remix SDK.


- With the new instrumentation, `pageload` span is the child of the
`loader` span. (Example:
[Trace](https://sentry-sdks.sentry.io/performance/trace/e51c640933786fd491bb428fb1eff826/?fov=0%2C436.5&node=error-cd2dc8610c5e4affb7356147daa77393&statsPeriod=7d&timestamp=1718029546))

- Legacy instrumentation keeps recording `pageload` span as the child of
the `http.server` span. (Example:
[Trace](https://sentry-sdks.sentry.io/performance/trace/01107a555eeee9b44d1f8c25ea0c45f3/?fov=0%2C818.599853515625&node=txn-0695246d026b4da792cf8f5e0a372b50&statsPeriod=7d&timestamp=1718103519))


Also:

Migrates Remix integration tests from Jest to Vitest.
- Related issues: jestjs/jest#15033
elastic/require-in-the-middle#50

Fixes Backlogged Issues:
- Fixes: #12082 -
[Code](https://github.com/getsentry/sentry-javascript/pull/12110/files#diff-754e32c1c14ac3c3c93eedeb7680548b986bc02a8b0bc63d2efc189210322acdR416-R440)
- Fixes: #9737 -
[Test](https://github.com/getsentry/sentry-javascript/pull/12110/files#diff-1484a5311699a814a39921d440f831e9babe69f8225a0de667ebd8cc63ca5accR109)
- Fixes: #12285
This PR enables the `noUncheckedIndexedAccess` TS config, ensuring that
we always properly guard for array/object access.

Sometimes, this leads to a bit of boilerplate, but enabling this def.
found some places in the code where things could go wrong before.

Closes #12440

Afterwards, we can look into enabling
https://typescript-eslint.io/rules/no-unnecessary-condition/.
This updates some tests to avoid unnecessary conditions.

Extracted this out while looking at enabling eslint
no-uncessary-condition, as this can be done without much reviewing.
This adds a new config option for `@sentry/node`, `maxSpanWaitDuration`.

By configuring this, you can define how long the SDK waits for a
finished spans parent span to be finished before we discard this.

Today, this defaults to 5 min, so if a span is finished and its parent
span is not finished within 5 minutes, the child span will be discarded.
We do this to avoid memory leaks, as parent spans may be dropped/lost
and thus child spans would be kept in memory forever.

However, if you actually have very long running spans, they may be
incorrectly dropped due to this. So now, you can configure your SDK to
have a longer wait duration.

Fixes #12491
Refactors contextlines integration to use readline instead of reading
the entire file into memory (we were also doubling the memory as we were
splitting the file via `.split(\n)`.

Current implementation is not leveraging the cache to optimize file
reads, so I need to reintroduce that. Something to note is that the
caching behavior will become per frame location vs per file, which I
think makes more sense as we can only assume that this stack frame might
throw in the future (as opposed to anything from the file it is in).
Improves screenshot quality after cropping for retina displays. This
increases resolution after cropping by factoring in DPI.
Before:
<img width="974" alt="image"
src="https://github.com/getsentry/sentry-javascript/assets/55311782/e39397ae-8c6c-47a6-8d10-260c16eb8234">

After:
<img width="974" alt="image"
src="https://github.com/getsentry/sentry-javascript/assets/55311782/bd05b88b-3d2f-4193-b55b-75aae0bba8b9">

The size is the same when cropping but when viewing feedbacks,
screenshots from retina displays are twice as large due to higher DPI.

Closes #12329

---------

Co-authored-by: Billy Vong <billyvg@users.noreply.github.com>
We want to have some safeguards in place to avoid reading minified files
or large bundled files as we could incur a large processing time cost.
The output of such files is likely to be less useful anyways, so
contextlines would be low value
…2479)

Remix v2.9+ now supports `undici` native fetch.
`normalizeRemixRequest()` would throw an error when processing
`headers`. This PR uses the standard `Object.fromEntries()` to convert
`Headers` into an object.
…am (#12197)

We were missing the ability to set tags within feedback before, this
corrects it.

See getsentry/sentry-docs#10137 for the docs
update.

Now a developer can set `tags: {...}` anytime an options param is passed
into feedback. This includes:
- when we init the integration `feedbackIntegration({tags: {hello:
'world'}})`
- when attachTo is called: `feedback.attachTo(element, {tags: {hello:
'world'}})`
- when createWidget is called: `feedback.createWidget({tags: {hello:
'world'}})`
- when createForm is called: `feedback.createForm({tags: {hello:
'world'}})`

Users can also pass tags to `sendFeedback()` which is slightly nicer
than having to set them on scope first.
 - `Sentry.sendFeedback({tags: {hello: 'world'}})` 
- `captureFeedback()` is unaffected, keeping it closer in style to the
other `capture*()` methods.

I also took the chance to re-use related types in more places. Checkout
the first 2 commits on the branch to see those changes individually.

Fixes getsentry/sentry#71254
Reverts #12492

Instead we'll do
#12510, which
should work much better.
`sendFeedback` rejects if the response isn't a valid status code. Also
propagates message into form.
<img width="338" alt="image"
src="https://github.com/getsentry/sentry-javascript/assets/55311782/ebb6126d-92ea-4593-9cec-3f3634cc1708">

Fixes #12476
updates `@rollup/plugin-commonjs` to `v26.0.1`
Given React 19 has changes with error handling, we may want to treat it
differently in the product. (see
https://www.notion.so/sentry/React-JS-19-23a7a2c5f88d4ef59a4b9647c84333a3?d=98df57f2272d482fa12a3c0618b43fc4#9bb5d5f0a9604508bb290fd7405fcce0
as an example).

To make this easier, we now attach the react version as context on all
outgoing events.
Timestamps reported in the chunk format need to be in seconds
`sendSpanEnvelope` immediately sends
spans without checking for `this._sampled`, which means you can't use
`tracesSampler` to filter them. This changes that!

We also record client outcomes for `sample_rate` with spans.
fixes #12168

We should truncate extra error data keys using `maxValueLength` to make
sure event payload size stays reasonably small.
We used to have a different implementation, that worked slightly
different.

This had two problems:

1. We did not look up the root span in the OTEL implementation, but
relied on already passing in the root span (in core, we convert it to
root span)
2. We did not use frozen DSC properly

Now, the core implementation just works for both OTEL and core spans.

While at this, it also aligns the behavior of looking at the `source` of
a span for DSC. Now, only if the source is `url` we'll _not_ set the
transaction on the DSC - previously, if no source was set at all, we'd
also skip this. But conceptually "no source" is similar to "custom",
which we _do_ allow, so now this is a bit simpler.

Fixes #12508
@mydea mydea requested a review from lforst June 19, 2024 09:33
@mydea mydea requested review from s1gr1d and andreiborza June 19, 2024 09:33
@mydea mydea self-assigned this Jun 19, 2024
@mydea mydea changed the base branch from develop to master June 19, 2024 10:09
@mydea mydea requested review from a team as code owners June 19, 2024 10:09
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser 22.22 KB (added)
@sentry/browser (incl. Tracing) 33.27 KB (added)
@sentry/browser (incl. Tracing, Replay) 69.05 KB (added)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.37 KB (added)
@sentry/browser (incl. Tracing, Replay with Canvas) 73.11 KB (added)
@sentry/browser (incl. Tracing, Replay, Feedback) 85.27 KB (added)
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 87.09 KB (added)
@sentry/browser (incl. metrics) 26.42 KB (added)
@sentry/browser (incl. Feedback) 38.42 KB (added)
@sentry/browser (incl. sendFeedback) 26.85 KB (added)
@sentry/browser (incl. FeedbackAsync) 31.42 KB (added)
@sentry/react 24.96 KB (added)
@sentry/react (incl. Tracing) 36.32 KB (added)
@sentry/vue 26.23 KB (added)
@sentry/vue (incl. Tracing) 35.13 KB (added)
@sentry/svelte 22.35 KB (added)
CDN Bundle 23.41 KB (added)
CDN Bundle (incl. Tracing) 34.95 KB (added)
CDN Bundle (incl. Tracing, Replay) 69.08 KB (added)
CDN Bundle (incl. Tracing, Replay, Feedback) 74.25 KB (added)
CDN Bundle - uncompressed 68.76 KB (added)
CDN Bundle (incl. Tracing) - uncompressed 103.41 KB (added)
CDN Bundle (incl. Tracing, Replay) - uncompressed 213.88 KB (added)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 226.47 KB (added)
@sentry/nextjs (client) 36.2 KB (added)
@sentry/sveltekit (client) 33.9 KB (added)
@sentry/node 112.62 KB (added)
@sentry/node - without tracing 90.04 KB (added)
@sentry/aws-serverless 99.12 KB (added)

@mydea mydea merged commit f9f63e1 into master Jun 19, 2024
138 checks passed
@mydea mydea deleted the prepare-release/8.10.0 branch June 19, 2024 10:57
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

9 participants