From 2416a71ae420551b892e8eed4dc7c61198612ff7 Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Thu, 25 Jul 2024 14:54:51 +0200 Subject: [PATCH] fix: update remaining 404s (#10853) * docs: add section for custom otel sampler (#10843) * fix: remaining 404s --- .../common/features/experimental-features.mdx | 6 +- .../tracing/instrumentation/opentelemetry.mdx | 69 +++++++++++++++++++ .../javascript/guides/aws-lambda/index.mdx | 2 +- .../tracing/instrumentation/caches-module.mdx | 2 +- docs/product/issues/issue-details/index.mdx | 2 +- .../performance/transaction-summary.mdx | 2 +- 6 files changed, 77 insertions(+), 6 deletions(-) diff --git a/docs/platforms/apple/common/features/experimental-features.mdx b/docs/platforms/apple/common/features/experimental-features.mdx index fe127102307f3..c66608064fe5d 100644 --- a/docs/platforms/apple/common/features/experimental-features.mdx +++ b/docs/platforms/apple/common/features/experimental-features.mdx @@ -7,12 +7,14 @@ description: "Learn about the experimental features available for Sentry's Apple Do you want to try some new experimental features? On the latest version of the Apple SDK, you can: - Enable Time to Full Display (TTFD) to gain insight into how long it takes your view controller to launch and load all of its content. + - Enable App Launch Profiling to get detailed profiles for your app launches. + - If you use Swift concurrency, stitch together stack traces of your async code with the `swiftAsyncStacktraces` option. Note that you can enable this in your Objective-C project, but only async code written in Swift will be stitched together. - -Experimental features are still a work-in-progress and may have bugs. We recognize the irony. + Experimental features are still a work-in-progress and may have bugs. We + recognize the irony. ```swift {tabTitle:Swift} diff --git a/docs/platforms/javascript/common/tracing/instrumentation/opentelemetry.mdx b/docs/platforms/javascript/common/tracing/instrumentation/opentelemetry.mdx index 7f568b7fc36c0..57fae8f9feff7 100644 --- a/docs/platforms/javascript/common/tracing/instrumentation/opentelemetry.mdx +++ b/docs/platforms/javascript/common/tracing/instrumentation/opentelemetry.mdx @@ -113,3 +113,72 @@ tracer.startActiveSpan("span name", () => { ``` You can also use any other tracer; all OpenTelemetry spans will be picked up by Sentry automatically. + +## Using a Custom Sampler + +We recommend using `SentrySampler` as this will ensure the correct subset of traces is sent to Sentry depending on your `tracesSampleRate`, as well as that all other Sentry features like trace propagation work as expected. +If you however need to use your own sampler then make sure to wrap your `SamplingResult` with our `wrapSamplingDecision` method: + +```js {filename: custom-sampler.js} +const { wrapSamplingDecision } = require("@sentry/opentelemetry"); + +// implements Sampler from "@opentelemetry/sdk-trace-node" +class CustomSampler { + shouldSample( + context, + _traceId, + _spanName, + _spanKind, + attributes, + _links + ) { + const decision = yourDecisionLogic(); + + // wrap the result + return wrapSamplingDecision({ + decision, + context, + spanAttributes: attributes, + }); + } + + toString() { + return CustomSampler.name; + } +} + +module.exports = CustomSampler; + +``` + +Now use your sampler in your `TraceProvider`: + +```js {filename: instrument.js} +const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node"); +const Sentry = require("@sentry/node"); +const { + SentrySpanProcessor, + SentryPropagator, + SentrySampler, +} = require("@sentry/opentelemetry"); +const CustomSampler = require("./custom-sampler"); + +const sentryClient = Sentry.init({ + dsn: "__DSN__", + skipOpenTelemetrySetup: true, + + // By defining any sample rate, + // tracing intergations will be added by default + tracesSampleRate: 0 +}); + + +const provider = new NodeTracerProvider({ + sampler: new CustomSampler(sentryClient), +}); + +// ...rest of your setup + +// Validate that the setup is correct +Sentry.validateOpenTelemetrySetup(); +``` \ No newline at end of file diff --git a/docs/platforms/javascript/guides/aws-lambda/index.mdx b/docs/platforms/javascript/guides/aws-lambda/index.mdx index be61b9b1595cf..4de8d75745ece 100644 --- a/docs/platforms/javascript/guides/aws-lambda/index.mdx +++ b/docs/platforms/javascript/guides/aws-lambda/index.mdx @@ -22,7 +22,7 @@ Depending on your setup, there are different ways to install and use Sentry in y - [Install the Sentry AWS Lambda Layer](./install/cjs-layer) if your Lambda functions are written in CommonJS (CJS) using `require` syntax. - [Install the Sentry AWS NPM package](./install/esm-npm) if your Lambda functions are running in EcmaScript Modules (ESM) using `import` syntax. -If you're not sure which installation method to use or want an overview of all available options to use Sentry in your Lambda functions, read the [installation methods overview](/guides/aws-lambda/install). +If you're not sure which installation method to use or want an overview of all available options to use Sentry in your Lambda functions, read the [installation methods overview](./install). ## Configuration diff --git a/docs/platforms/php/common/tracing/instrumentation/caches-module.mdx b/docs/platforms/php/common/tracing/instrumentation/caches-module.mdx index 0260b83c6455e..d473b8416f1e8 100644 --- a/docs/platforms/php/common/tracing/instrumentation/caches-module.mdx +++ b/docs/platforms/php/common/tracing/instrumentation/caches-module.mdx @@ -15,7 +15,7 @@ For detailed information about which data can be set, see the [Cache Module deve ## Custom Instrumentation -If you're using anything other than our Laravel SDK, you'll need to manually instrument the [Cache Module](https://sentry.io/orgredirect/organizations/:orgslug/performance/caches/) by following the steps below. +If you're using anything other than our [Laravel SDK](/platforms/php/guides/laravel/), you'll need to manually instrument the [Cache Module](https://sentry.io/orgredirect/organizations/:orgslug/performance/caches/) by following the steps below. ### Add Span When Putting Data Into the Cache diff --git a/docs/product/issues/issue-details/index.mdx b/docs/product/issues/issue-details/index.mdx index 83d06b3f9a5fe..522510542546f 100644 --- a/docs/product/issues/issue-details/index.mdx +++ b/docs/product/issues/issue-details/index.mdx @@ -105,7 +105,7 @@ It's the most important piece of information that the Sentry grouping algorithm You can set your own breadcrumbs to make them more useful for debugging. -If you’ve enabled [Session Replay](/product/explore/session-replay/), you’ll see a replay preview under Breadcrumbs if there’s one associated with the event you’re viewing. Replays can be associated with both frontend and [backend errors](/product/explore/session-replay/getting-started#replays-for-backend-errors) (as long as distrubted tracing is set up). Clicking on the replay preview will lead you to the [Replay Details](/product/explore/session-replay/replay-details/) page. +If you’ve enabled [Session Replay](/product/explore/session-replay/), you’ll see a replay preview under Breadcrumbs if there’s one associated with the event you’re viewing. Replays can be associated with both frontend and [backend errors](/product/explore/session-replay/getting-started#replays-for-backend-errors) (as long as distrubted tracing is set up). Clicking on the replay preview will lead you to the [Replay Details](/product/explore/session-replay/web/replay-details/) page. ## Tags diff --git a/docs/product/performance/transaction-summary.mdx b/docs/product/performance/transaction-summary.mdx index 22a303fb4488b..49a815a96021a 100644 --- a/docs/product/performance/transaction-summary.mdx +++ b/docs/product/performance/transaction-summary.mdx @@ -157,7 +157,7 @@ Spans with the same operation and description are grouped together into a single ### Replays -The Replays tab displays a list of replays where the transaction you’re viewing had occurred. Go directly to [Replay Details](/product/explore/session-replay/replay-details/) for any replay and see how a slow transaction impacted the user experience. Note: you must have [Session Replay](/product/explore/session-replay/) enabled to see this tab. +The Replays tab displays a list of replays where the transaction you’re viewing had occurred. Go directly to [Replay Details](/product/explore/session-replay/web/replay-details/) for any replay and see how a slow transaction impacted the user experience. Note: you must have [Session Replay](/product/explore/session-replay/) enabled to see this tab. ## Additional Actions