From 640ed71b7056ba4f53e553cb6b7e118d8f7bc523 Mon Sep 17 00:00:00 2001 From: Priscila Oliveira Date: Mon, 3 Nov 2025 08:48:21 +0100 Subject: [PATCH] ref(onboarding): Delete go martini onboarding docs --- .../gettingStartedDocs/go/martini/index.tsx | 23 -- .../go/martini/onboarding.spec.tsx | 60 ----- .../go/martini/onboarding.tsx | 247 ------------------ 3 files changed, 330 deletions(-) delete mode 100644 static/app/gettingStartedDocs/go/martini/index.tsx delete mode 100644 static/app/gettingStartedDocs/go/martini/onboarding.spec.tsx delete mode 100644 static/app/gettingStartedDocs/go/martini/onboarding.tsx diff --git a/static/app/gettingStartedDocs/go/martini/index.tsx b/static/app/gettingStartedDocs/go/martini/index.tsx deleted file mode 100644 index ac793c20317881..00000000000000 --- a/static/app/gettingStartedDocs/go/martini/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import type {Docs} from 'sentry/components/onboarding/gettingStartedDoc/types'; -import {crashReport} from 'sentry/gettingStartedDocs/go/go/crashReport'; -import {logs} from 'sentry/gettingStartedDocs/go/go/logs'; -import {onboarding} from 'sentry/gettingStartedDocs/go/martini/onboarding'; -import { - feedbackOnboardingJsLoader, - replayOnboardingJsLoader, -} from 'sentry/gettingStartedDocs/javascript/jsLoader/jsLoader'; - -const docs: Docs = { - onboarding, - replayOnboardingJsLoader, - crashReportOnboarding: crashReport({ - docsLink: - 'https://docs.sentry.io/platforms/go/guides/martini/user-feedback/configuration/#crash-report-modal', - }), - feedbackOnboardingJsLoader, - logsOnboarding: logs({ - docsPlatform: 'martini', - }), -}; - -export default docs; diff --git a/static/app/gettingStartedDocs/go/martini/onboarding.spec.tsx b/static/app/gettingStartedDocs/go/martini/onboarding.spec.tsx deleted file mode 100644 index 9a0eb4982bc52c..00000000000000 --- a/static/app/gettingStartedDocs/go/martini/onboarding.spec.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import {renderWithOnboardingLayout} from 'sentry-test/onboarding/renderWithOnboardingLayout'; -import {screen} from 'sentry-test/reactTestingLibrary'; -import {textWithMarkupMatcher} from 'sentry-test/utils'; - -import {ProductSolution} from 'sentry/components/onboarding/gettingStartedDoc/types'; - -import docs from '.'; - -describe('martini onboarding docs', () => { - it('renders errors onboarding docs correctly', () => { - renderWithOnboardingLayout(docs); - - // Renders main headings - expect(screen.getByRole('heading', {name: 'Install'})).toBeInTheDocument(); - expect(screen.getByRole('heading', {name: 'Configure SDK'})).toBeInTheDocument(); - expect(screen.getByRole('heading', {name: 'Usage'})).toBeInTheDocument(); - }); - - it('renders performance onboarding docs correctly', async () => { - renderWithOnboardingLayout(docs, { - selectedProducts: [ProductSolution.PERFORMANCE_MONITORING], - }); - - const elements = await screen.findAllByText( - textWithMarkupMatcher(/TracesSampleRate/) - ); - for (const element of elements) { - expect(element).toBeInTheDocument(); - } - }); - - it('renders logs onboarding docs correctly', async () => { - renderWithOnboardingLayout(docs, { - selectedProducts: [ProductSolution.LOGS], - }); - - const elements = await screen.findAllByText(textWithMarkupMatcher(/EnableLogs/)); - for (const element of elements) { - expect(element).toBeInTheDocument(); - } - }); - - it('renders performance and logs onboarding docs correctly', async () => { - renderWithOnboardingLayout(docs, { - selectedProducts: [ProductSolution.PERFORMANCE_MONITORING, ProductSolution.LOGS], - }); - - const traceElements = await screen.findAllByText( - textWithMarkupMatcher(/TracesSampleRate/) - ); - for (const element of traceElements) { - expect(element).toBeInTheDocument(); - } - - const logElements = await screen.findAllByText(textWithMarkupMatcher(/EnableLogs/)); - for (const element of logElements) { - expect(element).toBeInTheDocument(); - } - }); -}); diff --git a/static/app/gettingStartedDocs/go/martini/onboarding.tsx b/static/app/gettingStartedDocs/go/martini/onboarding.tsx deleted file mode 100644 index 39940c7f8d2b4e..00000000000000 --- a/static/app/gettingStartedDocs/go/martini/onboarding.tsx +++ /dev/null @@ -1,247 +0,0 @@ -import {ExternalLink} from 'sentry/components/core/link'; -import type { - DocsParams, - OnboardingConfig, -} from 'sentry/components/onboarding/gettingStartedDoc/types'; -import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/types'; -import { - getCrashReportGenericInstallSteps, - getCrashReportModalConfigDescription, - getCrashReportModalIntroduction, -} from 'sentry/components/onboarding/gettingStartedDoc/utils/feedbackOnboarding'; -import {t, tct} from 'sentry/locale'; - -const getConfigureSnippet = (params: DocsParams) => ` -import ( - "fmt" - - "github.com/getsentry/sentry-go" - sentrymartini "github.com/getsentry/sentry-go/martini" - "github.com/go-martini/martini" -) - -// To initialize Sentry's handler, you need to initialize Sentry itself beforehand -if err := sentry.Init(sentry.ClientOptions{ - Dsn: "${params.dsn.public}",${ - params.isPerformanceSelected - ? ` - // Set TracesSampleRate to 1.0 to capture 100% - // of transactions for tracing. - // We recommend adjusting this value in production, - TracesSampleRate: 1.0,` - : '' - }${ - params.isLogsSelected - ? ` - // Enable structured logs to Sentry - EnableLogs: true,` - : '' - } -}); err != nil { - fmt.Printf("Sentry initialization failed: %v\\n", err) -} - -// Then create your app -app := martini.Classic() - -// Once it's done, you can attach the handler as one of your middleware -app.Use(sentrymartini.New(sentrymartini.Options{})) - -// Set up routes -app.Get("/", func() string { - return "Hello world!" -}) - -// And run it -app.Run()`; - -const getOptionsSnippet = () => ` -// Whether Sentry should repanic after recovery, in most cases it should be set to true, -// as martini.Classic includes its own Recovery middleware that handles http responses. -Repanic bool -// Whether you want to block the request before moving forward with the response. -// Because Martini's default "Recovery" handler doesn't restart the application, -// it's safe to either skip this option or set it to "false". -WaitForDelivery bool -// Timeout for the event delivery requests. -Timeout time.Duration`; - -const getUsageSnippet = () => ` -app := martini.Classic() - -app.Use(sentrymartini.New(sentrymartini.Options{ - Repanic: true, -})) - -app.Use(func(rw http.ResponseWriter, r *http.Request, c martini.Context, hub *sentry.Hub) { - hub.Scope().SetTag("someRandomTag", "maybeYouNeedIt") -}) - -app.Get("/", func(rw http.ResponseWriter, r *http.Request, hub *sentry.Hub) { - if someCondition { - hub.WithScope(func (scope *sentry.Scope) { - scope.SetExtra("unwantedQuery", rw.URL.RawQuery) - hub.CaptureMessage("User provided unwanted query string, but we recovered just fine") - }) - } - rw.WriteHeader(http.StatusOK) -}) - -app.Get("/foo", func() string { - // sentrymartini handler will catch it just fine. Also, because we attached "someRandomTag" - // in the middleware before, it will be sent through as well - panic("y tho") -}) - -app.Run()`; - -const getBeforeSendSnippet = (params: any) => ` -sentry.Init(sentry.ClientOptions{ - Dsn: "${params.dsn.public}", - BeforeSend: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event { - if hint.Context != nil { - if req, ok := hint.Context.Value(sentry.RequestContextKey).(*http.Request); ok { - // You have access to the original Request here - } - } - - return event - }, -})`; - -export const onboarding: OnboardingConfig = { - install: () => [ - { - type: StepType.INSTALL, - content: [ - { - type: 'text', - text: tct('Install our Go Martini SDK using [code:go get]:', { - code: , - }), - }, - { - type: 'code', - language: 'bash', - code: 'go get github.com/getsentry/sentry-go/martini', - }, - ], - }, - ], - configure: params => [ - { - type: StepType.CONFIGURE, - content: [ - { - type: 'text', - text: t( - "Import and initialize the Sentry SDK early in your application's setup:" - ), - }, - { - type: 'code', - language: 'go', - code: getConfigureSnippet(params), - }, - { - type: 'subheader', - text: t('Options'), - }, - { - type: 'text', - text: [ - tct( - '[code:sentrymartini] accepts a struct of [code:Options] that allows you to configure how the handler will behave.', - {code: } - ), - t('Currently it respects 3 options:'), - ], - }, - { - type: 'code', - language: 'go', - code: getOptionsSnippet(), - }, - ], - }, - { - title: t('Usage'), - content: [ - { - type: 'text', - text: tct( - "[code:sentrymartini] maps an instance of [sentryHubLink:*sentry.Hub] as one of the services available throughout the rest of the request's lifetime. You can access it by providing a hub [code:*sentry.Hub] parameter in any of your proceeding middleware and routes. And it should be used instead of the global [code:sentry.CaptureMessage], [code:sentry.CaptureException], or any other calls, as it keeps the separation of data between the requests.", - { - code: , - sentryHubLink: ( - - ), - } - ), - }, - { - type: 'alert', - alertType: 'info', - showIcon: false, - text: tct( - "Keep in mind that [code:*sentry.Hub] won't be available in middleware attached before [code:sentrymartini]!", - {code: } - ), - }, - { - type: 'code', - language: 'go', - code: getUsageSnippet(), - }, - { - type: 'subheader', - text: tct('Accessing Request in [beforeSendCode:BeforeSend] callback', { - beforeSendCode: , - }), - }, - { - type: 'code', - language: 'go', - code: getBeforeSendSnippet(params), - }, - ], - }, - ], - verify: () => [], - nextSteps: (params: DocsParams) => { - const steps = []; - - if (params.isLogsSelected) { - steps.push({ - id: 'logs', - name: t('Logging Integrations'), - description: t( - 'Add logging integrations to automatically capture logs from your application.' - ), - link: 'https://docs.sentry.io/platforms/go/logs/#integrations', - }); - } - - return steps; - }, -}; - -export const crashReport: OnboardingConfig = { - introduction: () => getCrashReportModalIntroduction(), - install: (params: DocsParams) => getCrashReportGenericInstallSteps(params), - configure: () => [ - { - type: StepType.CONFIGURE, - content: [ - { - type: 'text', - text: getCrashReportModalConfigDescription({ - link: 'https://docs.sentry.io/platforms/go/guides/martini/user-feedback/configuration/#crash-report-modal', - }), - }, - ], - }, - ], - verify: () => [], - nextSteps: () => [], -};