mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
The tree was a debranded snapshot of upstream taken around 2026-02-20, and upstream has moved about five months since. This replaces it with upstream master, mechanically re-derived: bin/debrand does the rename, and the pipeline and squashed migrations are restored from the shipped tree. Not a merge. The previous import replaced the tree wholesale in a single commit, so there is no shared content history to merge against. Reproducing the rename on the new tree is what actually converges. What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md, and insights/migrations. The squashed initial migration is load-bearing — the live database records it by name, so upstream's ~918 individual migrations cannot come back. Nine products are dropped as unreferenced. Twenty-one more that we do not run are kept anyway because the core app still imports them; unpicking those is a refactor and does not belong in a rebase. This base does not build yet, and the reasons are not in the rename: upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against our 4.2, and the dependency manifests still name upstream packages that we republish under our own names. Those are decisions, not renames.
247 lines
10 KiB
TypeScript
247 lines
10 KiB
TypeScript
import { OnboardingComponentsContext, createInstallation } from 'scenes/onboarding/shared/OnboardingDocsContentWrapper'
|
|
|
|
import { getIOSSteps as getIOSStepsPA } from '../product-analytics/ios'
|
|
import { StepDefinition } from '../steps'
|
|
|
|
export const getIOSSteps = (ctx: OnboardingComponentsContext): StepDefinition[] => {
|
|
const { CodeBlock, Markdown, CalloutBox, dedent } = ctx
|
|
|
|
const installSteps = getIOSStepsPA(ctx, {
|
|
minVersionPod: '3.56',
|
|
minVersionSPM: '3.56.0',
|
|
})
|
|
|
|
const exceptionAutocaptureStep: StepDefinition = {
|
|
title: 'Set up exception autocapture',
|
|
badge: 'recommended',
|
|
content: (
|
|
<>
|
|
<CalloutBox type="fyi" title="Remote configuration">
|
|
<Markdown>
|
|
{dedent`
|
|
Exception autocapture can also be managed remotely via the
|
|
[error tracking settings](https://app.hanzo.ai/settings/project-error-tracking#exception-autocapture).
|
|
`}
|
|
</Markdown>
|
|
</CalloutBox>
|
|
<CalloutBox type="fyi" title="Platform support">
|
|
<Markdown>
|
|
{dedent`
|
|
Exception autocapture is available on **iOS, macOS, and tvOS** only.
|
|
It is not available on watchOS or visionOS due to platform limitations.
|
|
|
|
You can still capture events manually on all platforms, including visionOS.
|
|
`}
|
|
</Markdown>
|
|
</CalloutBox>
|
|
<Markdown>
|
|
{dedent`
|
|
You can autocapture exceptions by setting the \`errorTrackingConfig.autoCapture\`
|
|
argument to \`true\` when initializing the Insights SDK.
|
|
`}
|
|
</Markdown>
|
|
<CodeBlock
|
|
blocks={[
|
|
{
|
|
language: 'swift',
|
|
file: 'Swift',
|
|
code: dedent`
|
|
import Insights
|
|
|
|
let config = InsightsConfig(
|
|
projectToken: "<ph_project_token>",
|
|
host: "<ph_client_api_host>"
|
|
)
|
|
config.errorTrackingConfig.autoCapture = true
|
|
|
|
InsightsSDK.shared.setup(config)
|
|
`,
|
|
},
|
|
]}
|
|
/>
|
|
<Markdown>
|
|
{dedent`
|
|
When enabled, this automatically captures \`$exception\` events for:
|
|
|
|
- **Mach exceptions** (e.g., \`EXC_BAD_ACCESS\`, \`EXC_CRASH\`)
|
|
- **POSIX signals** (e.g., \`SIGSEGV\`, \`SIGABRT\`, \`SIGBUS\`)
|
|
- **Uncaught NSExceptions**
|
|
|
|
Crashes are persisted to disk and sent as \`$exception\` events with level "fatal" on the next app launch.
|
|
`}
|
|
</Markdown>
|
|
</>
|
|
),
|
|
}
|
|
|
|
const manualCaptureStep: StepDefinition = {
|
|
title: 'Manually capture exceptions',
|
|
badge: 'optional',
|
|
content: (
|
|
<>
|
|
<Markdown>
|
|
{dedent`
|
|
### Swift Error handling
|
|
|
|
You can manually capture exceptions using the \`captureException\` method:
|
|
`}
|
|
</Markdown>
|
|
<CodeBlock
|
|
blocks={[
|
|
{
|
|
language: 'swift',
|
|
file: 'Swift',
|
|
code: dedent`
|
|
import Insights
|
|
|
|
do {
|
|
try FileManager.default.removeItem(at: badFileUrl)
|
|
} catch {
|
|
InsightsSDK.shared.captureException(error)
|
|
}
|
|
`,
|
|
},
|
|
]}
|
|
/>
|
|
<Markdown>
|
|
{dedent`
|
|
### Objective-C NSException handling
|
|
|
|
For Objective-C code that uses NSException:
|
|
`}
|
|
</Markdown>
|
|
<CodeBlock
|
|
blocks={[
|
|
{
|
|
language: 'objc',
|
|
file: 'Objective-C',
|
|
code: dedent`
|
|
@import Insights;
|
|
|
|
@try {
|
|
[self riskyOperation];
|
|
} @catch (NSException *exception) {
|
|
[[InsightsSDK shared] captureExceptionWithNSException:exception properties:nil];
|
|
}
|
|
`,
|
|
},
|
|
]}
|
|
/>
|
|
<Markdown>
|
|
{dedent`
|
|
### Adding custom properties
|
|
|
|
You can add custom properties to help with debugging, grouping, and analysis:
|
|
`}
|
|
</Markdown>
|
|
<CodeBlock
|
|
blocks={[
|
|
{
|
|
language: 'swift',
|
|
file: 'Swift',
|
|
code: dedent`
|
|
do {
|
|
try performNetworkRequest()
|
|
} catch {
|
|
InsightsSDK.shared.captureException(error, properties: [
|
|
"endpoint": "/api/users",
|
|
"retry_count": 3
|
|
])
|
|
}
|
|
`,
|
|
},
|
|
]}
|
|
/>
|
|
<Markdown>
|
|
{dedent`
|
|
This is helpful if you've built your own error handling logic or want to capture exceptions that are handled by your application code.
|
|
`}
|
|
</Markdown>
|
|
</>
|
|
),
|
|
}
|
|
|
|
const inAppConfigStep: StepDefinition = {
|
|
title: 'Configure in-app frames',
|
|
badge: 'optional',
|
|
content: (
|
|
<>
|
|
<Markdown>
|
|
{dedent`
|
|
By default, Insights automatically marks your app's code as "in-app" in stack traces to help you focus on your code rather than system frameworks.
|
|
|
|
You can customize this behavior with \`errorTrackingConfig\`:
|
|
`}
|
|
</Markdown>
|
|
<CodeBlock
|
|
blocks={[
|
|
{
|
|
language: 'swift',
|
|
file: 'Swift',
|
|
code: dedent`
|
|
import Insights
|
|
|
|
let config = InsightsConfig(
|
|
projectToken: "<ph_project_token>",
|
|
host: "<ph_client_api_host>"
|
|
)
|
|
|
|
// Mark additional packages as in-app
|
|
config.errorTrackingConfig.inAppIncludes = [
|
|
"MySharedFramework",
|
|
"MyUtilityLib"
|
|
]
|
|
|
|
// Exclude specific packages from being marked as in-app
|
|
config.errorTrackingConfig.inAppExcludes = [
|
|
"Alamofire",
|
|
"SDWebImage"
|
|
]
|
|
|
|
// Control default behavior for unknown packages
|
|
config.errorTrackingConfig.inAppByDefault = true // default
|
|
|
|
InsightsSDK.shared.setup(config)
|
|
`,
|
|
},
|
|
]}
|
|
/>
|
|
<Markdown>
|
|
{dedent`
|
|
**Configuration options:**
|
|
|
|
| Option | Description |
|
|
| --- | --- |
|
|
| \`inAppIncludes\` | List of package/bundle identifiers to mark as in-app (takes precedence over excludes) |
|
|
| \`inAppExcludes\` | List of package/bundle identifiers to exclude from in-app |
|
|
| \`inAppByDefault\` | Whether frames are considered in-app by default when origin cannot be determined |
|
|
|
|
**Default behavior:**
|
|
- Your app's bundle identifier and executable name are automatically included
|
|
- System frameworks (Foundation, UIKit, etc.) are automatically excluded
|
|
`}
|
|
</Markdown>
|
|
</>
|
|
),
|
|
}
|
|
|
|
const verifyStep: StepDefinition = {
|
|
title: 'Verify error tracking',
|
|
badge: 'recommended',
|
|
checkpoint: true,
|
|
content: (
|
|
<Markdown>
|
|
{dedent`
|
|
Before proceeding, let's make sure exception events are being captured and sent to Insights. You should see events appear in the activity feed.
|
|
|
|
[Check for exceptions in Insights](https://app.hanzo.ai/activity/explore)
|
|
`}
|
|
</Markdown>
|
|
),
|
|
}
|
|
|
|
return [...installSteps, exceptionAutocaptureStep, manualCaptureStep, inAppConfigStep, verifyStep]
|
|
}
|
|
|
|
export const IOSInstallation = createInstallation(getIOSSteps)
|