diff --git a/static/app/components/onboarding/productSelection.tsx b/static/app/components/onboarding/productSelection.tsx index db880858188804..3ddf5f9547d253 100644 --- a/static/app/components/onboarding/productSelection.tsx +++ b/static/app/components/onboarding/productSelection.tsx @@ -180,6 +180,7 @@ export const platformProductAvailability = { ProductSolution.LOGS, ProductSolution.METRICS, ], + native: [ProductSolution.PERFORMANCE_MONITORING], node: [ ProductSolution.PERFORMANCE_MONITORING, ProductSolution.PROFILING, @@ -395,6 +396,8 @@ export const platformProductAvailability = { ProductSolution.PROFILING, ProductSolution.LOGS, ], + unity: [ProductSolution.PERFORMANCE_MONITORING], + unreal: [ProductSolution.PERFORMANCE_MONITORING], } as Record; type ProductProps = { diff --git a/static/app/gettingStartedDocs/native/onboarding.tsx b/static/app/gettingStartedDocs/native/onboarding.tsx index fcbef9ee1f1d25..e46ee45c12427e 100644 --- a/static/app/gettingStartedDocs/native/onboarding.tsx +++ b/static/app/gettingStartedDocs/native/onboarding.tsx @@ -19,7 +19,14 @@ int main(void) { // https://docs.sentry.io/platforms/native/configuration/options/#database-path sentry_options_set_database_path(options, ".sentry-native"); sentry_options_set_release(options, "my-project-name@2.3.12"); - sentry_options_set_debug(options, 1); + sentry_options_set_debug(options, 1);${ + params.isPerformanceSelected + ? ` + // Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. + // We recommend adjusting this value in production. + sentry_options_set_traces_sample_rate(options, 1.0);` + : '' + } sentry_init(options); /* ... */ @@ -106,6 +113,46 @@ export const onboarding: OnboardingConfig = { }, ], }, + ...(params.isPerformanceSelected + ? ([ + { + title: t('Tracing'), + content: [ + { + type: 'text', + text: t( + 'You can measure the performance of your code by capturing transactions and spans.' + ), + }, + { + type: 'code', + language: 'c', + code: `sentry_transaction_context_t *tx_ctx = sentry_transaction_context_new( + "test-transaction", + "test-operation" +); +sentry_transaction_t *tx = sentry_transaction_start(tx_ctx, NULL); + +// Perform your operation +// ... + +sentry_transaction_finish(tx);`, + }, + { + type: 'text', + text: tct( + 'Check out [link:the documentation] to learn more about tracing and custom instrumentation.', + { + link: ( + + ), + } + ), + }, + ], + }, + ] satisfies OnboardingStep[]) + : []), ...([getConsoleExtensions(params)].filter(Boolean) as OnboardingStep[]), ], }; diff --git a/static/app/gettingStartedDocs/unity/onboarding.tsx b/static/app/gettingStartedDocs/unity/onboarding.tsx index ad557890dc7ce8..a38386462f81f4 100644 --- a/static/app/gettingStartedDocs/unity/onboarding.tsx +++ b/static/app/gettingStartedDocs/unity/onboarding.tsx @@ -1,6 +1,7 @@ import {ExternalLink} from 'sentry/components/core/link'; import {StoreCrashReportsConfig} from 'sentry/components/onboarding/gettingStartedDoc/storeCrashReportsConfig'; import type { + DocsParams, OnboardingConfig, OnboardingStep, } from 'sentry/components/onboarding/gettingStartedDoc/types'; @@ -57,6 +58,19 @@ export const onboarding: OnboardingConfig = { type: 'text', text: t("And that's it! Now Sentry can capture errors automatically."), }, + { + type: 'conditional', + condition: params.isPerformanceSelected, + content: [ + { + type: 'text', + text: tct( + 'To enable performance monitoring, set the [code:TracesSampleRate] option in the Sentry configuration window. For example, set it to [code:1.0] to capture 100% of transactions.', + {code: } + ), + }, + ], + }, { type: 'text', text: tct( @@ -71,7 +85,7 @@ export const onboarding: OnboardingConfig = { ], }, ], - verify: params => [ + verify: (params: DocsParams) => [ { type: StepType.VERIFY, content: [ @@ -88,6 +102,51 @@ export const onboarding: OnboardingConfig = { }, ], }, + ...(params.isPerformanceSelected + ? ([ + { + title: t('Tracing'), + content: [ + { + type: 'text', + text: t( + 'You can measure the performance of your code by capturing transactions and spans.' + ), + }, + { + type: 'code', + language: 'csharp', + code: `using Sentry; + +// Transaction can be started by providing, at minimum, the name and the operation +var transaction = SentrySdk.StartTransaction( + "test-transaction-name", + "test-transaction-operation" +); + +// Transactions can have child spans (and those spans can have child spans as well) +var span = transaction.StartChild("test-child-operation"); + +// ... Perform the operation + +span.Finish(); // Mark the span as finished +transaction.Finish(); // Mark the transaction as finished and send it to Sentry`, + }, + { + type: 'text', + text: tct( + 'Check out [link:the documentation] to learn more about the API and automatic instrumentations.', + { + link: ( + + ), + } + ), + }, + ], + }, + ] satisfies OnboardingStep[]) + : []), { title: t('Troubleshooting'), content: [ diff --git a/static/app/gettingStartedDocs/unreal/onboarding.tsx b/static/app/gettingStartedDocs/unreal/onboarding.tsx index cdfd3b21c1cf0f..514b877da242e3 100644 --- a/static/app/gettingStartedDocs/unreal/onboarding.tsx +++ b/static/app/gettingStartedDocs/unreal/onboarding.tsx @@ -39,7 +39,15 @@ void UMyGameInstance::ConfigureSentrySettings(USentrySettings* Settings) Settings->SendDefaultPii = true; // If your game/app doesn't have sensitive data, you can get screenshots on error events automatically - Settings->AttachScreenshot = true; + Settings->AttachScreenshot = true;${ + params.isPerformanceSelected + ? ` + + // Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. + // We recommend adjusting this value in production. + Settings->TracesSampleRate = 1.0f;` + : '' + } } ... @@ -110,6 +118,19 @@ export const onboarding: OnboardingConfig = { language: 'url', code: params.dsn.public, }, + { + type: 'conditional', + condition: params.isPerformanceSelected, + content: [ + { + type: 'text', + text: tct( + 'To enable performance monitoring, set the [strong:Traces Sample Rate] option in the Sentry configuration window. For example, set it to [strong:1.0] to capture 100% of transactions.', + {strong: } + ), + }, + ], + }, { type: 'text', text: tct( @@ -142,6 +163,51 @@ export const onboarding: OnboardingConfig = { }, ], }, + ...(params.isPerformanceSelected + ? ([ + { + title: t('Tracing'), + content: [ + { + type: 'text', + text: t( + 'You can measure the performance of your code by capturing transactions and spans.' + ), + }, + { + type: 'code', + language: 'cpp', + code: `USentrySubsystem* SentrySubsystem = GEngine->GetEngineSubsystem(); + +// Start a transaction +USentryTransaction* Transaction = SentrySubsystem->StartTransaction( + TEXT("test-transaction-name"), + TEXT("test-transaction-operation") +); + +// Start a child span +USentrySpan* Span = Transaction->StartChild(TEXT("test-child-operation")); + +// ... Perform your operation + +Span->Finish(); +Transaction->Finish();`, + }, + { + type: 'text', + text: tct( + 'Check out [link:the documentation] to learn more about the API and automatic instrumentations.', + { + link: ( + + ), + } + ), + }, + ], + }, + ] satisfies OnboardingStep[]) + : []), { title: t('Crash Reporter Client'), content: [