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: Update CHANGELOG for 7.93.0 #10131

Merged
merged 44 commits into from
Jan 10, 2024
Merged

meta: Update CHANGELOG for 7.93.0 #10131

merged 44 commits into from
Jan 10, 2024

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jan 10, 2024

blocked on #10133 (else CI will fail on the release branch)

Deprecations, v8 refactors and new cron instrumentation

github-actions bot and others added 30 commits January 4, 2024 18:38
[Gitflow] Merge master into develop
)

We allow the same formats as OpenTelemetry:

* `number` (we handle both seconds and milliseconds)
* `Date`
* `[seconds, nanoseconds]`
This finally deprecates `startTransaction()`. There are only few
remaining usages in our own code base, which we can refactor as we go.

I chose to leave usages in E2E/integration tests for now, we can then
refactor them when we get rid of these to ensure the behavior remains
the same.

---------

Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
Deprecates the unnecessary `Hub. shouldSendDefaultPii`
method which can be easily replaced by accessing client options
directly.
Add `parameterize` fuction to utils package that takes params from a format string and attaches them as extra properties to a string. These are picked up during event processing and a `LogEntry` item is added to the event.
…#10054)

Deprecates and adds top-level replacements for

* `hub.startSession` -> `Sentry.startSession`
* `hub.endSession` -> `Sentry.endSession`
* `hub.captureException` -> `Sentry.captureSession`

These APIs were mostly used in browser and node `startSessionTracking`
functions which were called on `Sentry.init`. I updated these usages
with the global replacements and it seems integration tests are happy
with it.
For now, we not only put the session onto the isolation scope but also
onto the current scope to avoid changing event processing and stuff like
the ANR worker, as well as avoid "soft-breaking" users who use
`hub.(get|set)Session`.
Adds a test to ensure that Replay canvas recording works.
This should enforce via TypeScript that users pass in a name, but we can
keep the runtime check just in case.
This PR removes the usage of `dynamicRequire` from
`packages/utils/src/time.ts` and cleans up our timestamp code to be
simpler and reduce bundle size. Removing `dynamicRequire` means that we
no longer rely on `perf_hooks` for the `performance` API, but instead
try to grab it from `globalThis.performance`. `performance` was added to
the global in Node 16, which means we'll fallback to using `Date.now()`
in Node 8, 10, 12, 14 (and in v8 just Node 14). I think that is an
acceptable tradeoff, we just reduce accuracy for those versions.

This does not refactor `browserPerformanceTimeOrigin` code at the bottom
of the file, I want to come back and touch that in a follow up PR to
reduce the amount of changes made here.

I would appreciate reviews/opinions on this, I'm not 100% confident in
the changes.
This is supposed to be an internal API and not necessarily to be used by
users.

Naming wise, it's a bit tricky... I went with `JSON` to make it very
clear what this is for, but 🤷
We still have quite a lot of these ourselves, but we can refactor them
over time during the v8 preparation.

But with this, I think we have the most important deprecations mostly
done!
Co-authored-by: Francesco Novy <francesco.novy@sentry.io>
Also allow to pass this to `withScope()`, which actually aligns with
OTEL as well, where you can also do that. If you pass a scope there, it
will use this instead of forking a new one.

This should be the last thing needed to refactor some
`span.startChild()` occurrences - you can now store the scope you want
to fork off, and pass this into `startSpan` as needed.
This will replace `spanId`, `traceId` and `sampled` lookups.
Because the bitwise format of OTEL is a bit weird IMHO to check if a
span is sampled, I also added a utility `spanIsSampled(span)` method to
abstract this away.
Instead, users should use `spanToJSON(span).description`.

In reality, users should mostly not actually need this - most usages are
internal things, or tests, right now.

While at this, I also updated the `TraceContext` type to not have a
`description`. This started failing in a bunch of tests, because while
in theory the trace context has a `description` field, in praxis we
always used to set `description` to `undefined` for transactions,
leading to this never being set. The work in this PR unifies the
name/description handling between span and transaction, which lead to
`description` not being undefined for transactions anymore, leading to
this actually showing up in the trace context.
This PR adds a test for the `LocalVariable` integration that causes 20k
caught exceptions and checks that the memory usage does not go over
100MB.
In v8, there will be a reduced API surface.
This PR adds auto instrumented check-ins for the `node-schedule`
library.

It's not shown in the readme, but `scheduleJob` can be passed a job name
as the first parameter:

https://github.com/node-schedule/node-schedule/blob/c5a4d9a0dbcd5bda4996e089817e5669b5acd95f/lib/schedule.js#L28

```ts
import * as Sentry from '@sentry/node';
import * as schedule from 'node-schedule';

const scheduleWithCheckIn = Sentry.cron.instrumentNodeSchedule(schedule);

const job = scheduleWithCheckIn.scheduleJob('my-cron-job', '* * * * *', () => {
  console.log('You will see this message every minute');
});
```

This PR also adds a check to the `cron` instrumentation that ensures
that you can't create multiple schedules with the same monitor slug.
…n()` (#10098)

A lot to refactor for us... but for now, let's deprecate this.
Upon testing the full range of Electron versions for release in CI, I
found that starting a worker thread via a data uri requires at least
node v16.17.0.

This wasn't picked up by the tests in this repository because we only
test the latest version of each major.
mydea and others added 11 commits January 9, 2024 09:58
…0097)

This deprecates any usage of `metadata` on transactions.

The main usages we have are to set `sampleRate` and `source` in there.
These I replaced with semantic attributes. For backwards compatibility,
when creating the transaction event we still check the metadata there as
well.

Other usage of metadata (mostly around `request`) remains intact for
now, we need to replace this in v8 - e.g. put this on the isolation
scope, probably.

This is the first usage of [Semantic
Attributes](https://github.com/getsentry/rfcs/blob/main/text/0116-sentry-semantic-conventions.md)
in the SDK!

This replaces #10041
So we do not mutate this if we update data there.

Noticed this here:
#10097
This can be replaced by an event processor. We only use this in a single
place right now.

Closes #5660
These APIs are not compatible with OTEL tracing, and thus will not be
public API anymore in v8.

In v8, we'll add new (?) methods to the scope that are "internal", as
for non-node based SDKs we'll still need to keep the active span on the
scope. But these should not be reflected publicly, and not in types'
Scope.

Note that we'll also need to make sure to use types' `Scope` for all
callbacks etc., which we currently don't do.
#10116)

Currently, if you do:

```js
const myIntegration = new InboundFilters();
const myIntegration2 = new InboundFilters();
const myIntegration3 = new InboundFilters();

client.addIntegration(myIntegration);
client.addIntegration(myIntegration2);
client.addIntegration(myIntegration3);
```

All of these will have their `setup` hooks called, and thus they will be
initialized multiple times. However, all but the last will be discarded
from the client and not be accessible anymore via e.g.
`getIntegration()` or similar.

This used to not matter because everything was guarded through
`setupOnce()` anyhow, but i would say this is more of a bug and not
really expected.

With this change, an integration can only be added to a client once, if
you try to add it again it will noop.
This removes usage of `require.main.filename` to bring better ESM
compatability.

An extra bonus in that now `createGetModuleFromFilename` is ESM
compatible, we can use it in the Anr worker when `appRootPath` is
supplied (ie. Electron only for now).

### ⚠️ Fingerprinting 
This may change `module` fingerprinting for ESM since previously when
`require.main.filename` was not available, `process.cwd()` was used.
This bump contains the following changes:

- fix(rrweb): Use unpatched requestAnimationFrame when possible
[#150](getsentry/rrweb#150)
- ref: Avoid async in canvas
[#143](getsentry/rrweb#143)
- feat: Bundle canvas worker manually
[#144](getsentry/rrweb#144)
- build: Build for ES2020
[#142](getsentry/rrweb#142)

Extracted out from
#9826

Closes #6946
Also deprecate direct access to `span.attributes` (instead use
`spanToJSON(span)`).

There are a few usages that we still need to figure out how we will
replace them...!
No more transaction class!

This should not really affect users, as they should only use
`startTransaction()` anyhow.
…ur of `getDynamicSamplingContextFromSpan` (#10094)

Deprecate `Transaction.getDynamicSamplingContext` and
introduce its direct replacement, a top-level utility function. Note
that this only is an intermediate step we should take to rework how
we generate and handle the DSC creation. More details in #10095
@Lms24 Lms24 marked this pull request as draft January 10, 2024 11:12
@Lms24 Lms24 changed the base branch from develop to master January 10, 2024 11:14
@Lms24 Lms24 marked this pull request as ready for review January 10, 2024 11:14
Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

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

big boi

Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 76.98 KB (+0.13% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 68.36 KB (+0.17% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 61.99 KB (+0.19% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 32.38 KB (+0.31% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 30.98 KB (+0.79% 🔺)
@sentry/browser - Webpack (gzipped) 22.31 KB (+0.96% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 74.61 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 66.26 KB (+0.09% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 32.07 KB (+0.11% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 23.9 KB (+0.66% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 208.7 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 96.75 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 71.35 KB (+0.57% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 35.04 KB (+0.13% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 68.72 KB (+0.14% 🔺)
@sentry/react - Webpack (gzipped) 22.35 KB (+1% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 85.37 KB (+0.02% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 49.5 KB (+0.05% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 17.01 KB (+1.53% 🔺)

@Lms24 Lms24 merged commit 226bbcc into master Jan 10, 2024
93 checks passed
@Lms24 Lms24 deleted the prepare-release/7.93.0 branch January 10, 2024 12:48
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

8 participants