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

feat: Go profiling #7127

Merged
merged 4 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/docs/product/profiling/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ Profiling depends on Sentry's performance monitoring product being enabled befor
- Mobile
- [Android](/platforms/android/profiling/)
- [iOS](/platforms/apple/guides/ios/profiling/)
- Server
- [Node.js](/platforms/node/profiling)
- Standalone and server apps
- [Node.js](/platforms/node/profiling/)
- [Python](/platforms/python/profiling/)
- [PHP](/platforms/php/profiling/)
- [Go](/platforms/go/profiling/) [experimental]
- [Ruby](/platforms/ruby/profiling/) [experimental]
- [Rust](/platforms/rust/profiling) [experimental]
1 change: 1 addition & 0 deletions src/docs/product/profiling/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ description: "Profiling offers a deeper level of visibility on top of traditiona
- Node.js
- Python
- PHP (including Laravel and Symfony)
- Go [experimental]
- Ruby [experimental]
- Rust [experimental]

Expand Down
59 changes: 58 additions & 1 deletion src/platforms/common/profiling/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_order: 5000
supported:
- android
- apple
- go
- python
- rust
- ruby
Expand All @@ -19,7 +20,6 @@ notSupported:
- java
- java.spring-boot
- java.spring
- go
- javascript.cordova
- native.breakpad
- native.crashpad
Expand All @@ -29,6 +29,16 @@ notSupported:
description: "Learn how to enable profiling in your app if it is not already set up."
---

<PlatformSection supported={["go"]}>

<Note>

Go Profiling is currently in alpha. Alpha features are still in-progress and may have bugs. We recognize the irony.
vaind marked this conversation as resolved.
Show resolved Hide resolved

</Note>

</PlatformSection>

<PlatformSection supported={["ruby"]}>

<Note>
Expand Down Expand Up @@ -90,6 +100,19 @@ In `AndroidManifest.xml`:

</PlatformSection>

<PlatformSection supported={["go"]}>

```go
err := sentry.Init(sentry.ClientOptions{
Dsn: "___PUBLIC_DSN___",
EnableTracing: true,
// We recommend adjusting this value in production:
TracesSampleRate: 1.0,
})
```

</PlatformSection>

<PlatformSection supported={["python"]}>

```python
Expand Down Expand Up @@ -251,6 +274,29 @@ sentry_sdk.init(

</PlatformSection>

<PlatformSection supported={["go"]}>

<Note>

Go Profiling alpha is available since SDK version `0.22.0`.

</Note>

To enable profiling set the ProfilesSampleRate:
vaind marked this conversation as resolved.
Show resolved Hide resolved

```go
err := sentry.Init(sentry.ClientOptions{
Dsn: "___PUBLIC_DSN___",
EnableTracing: true,
// We recommend adjusting these values in production:
TracesSampleRate: 1.0,
// The sampling rate for profiling is relative to TracesSampleRate:
ProfilesSampleRate: 1.0,
})
```

</PlatformSection>

<PlatformSection supported={["ruby"]}>

<Note>
Expand Down Expand Up @@ -337,6 +383,17 @@ If you don't see any profiling data in [sentry.io](https://sentry.io), you can t
- If the automatic instrumentation is not sending performance data, try using <PlatformLink to="/performance/instrumentation/custom-instrumentation">custom instrumentation</PlatformLink>.
- Enable <PlatformLink to="/configuration/options/#debug">debug mode</PlatformLink> in the SDK and check the logs.

<PlatformSection supported={["go"]}>

### Limitations

Profile samples are collected periodically for each goroutine.
If your program uses a large number of concurrent goroutines, make sure to check whether the overhead is within the acceptable range for your use case.

As always, and especially with Profiling in Go being an alfa feature, the feedback is welcome on [Discord](https://discord.com/channels/621778831602221064/621786587939864586) or [GitHub](https://github.com/getsentry/sentry-go/issues/630).
vaind marked this conversation as resolved.
Show resolved Hide resolved

</PlatformSection>

<PlatformSection supported={["ruby"]}>

### Limitations
Expand Down
10 changes: 10 additions & 0 deletions src/wizard/go/profiling-onboarding/go/0.alert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Go
doc_link: https://docs.sentry.io/platforms/go/profiling/
support_level: alpha
type: language
---

<div class='alert warning'>
Profiling in Go is currently in alpha, and there may be some bugs. We recognize the irony.
</div>
10 changes: 10 additions & 0 deletions src/wizard/go/profiling-onboarding/go/1.install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Go
doc_link: https://docs.sentry.io/platforms/go/profiling/
support_level: alpha
type: language
---

#### Install

For the Profiling integration to work, you must have the Sentry Go SDK module (minimum version v0.22.0). Learn more about installation methods in our [full documentation](https://docs.sentry.io/platforms/go/#install).
19 changes: 19 additions & 0 deletions src/wizard/go/profiling-onboarding/go/2.configure-performance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Go
doc_link: https://docs.sentry.io/platforms/go/profiling/
support_level: alpha
type: language
---

#### Configure Performance

Sentry’s performance monitoring product has to be enabled in order for Profiling to work. To enable performance monitoring in the SDK:

```go
err := sentry.Init(sentry.ClientOptions{
Dsn: "___PUBLIC_DSN___",
EnableTracing: true,
// We recommend adjusting this value in production:
TracesSampleRate: 1.0,
})
```
21 changes: 21 additions & 0 deletions src/wizard/go/profiling-onboarding/go/3.configure-profiling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Go
doc_link: https://docs.sentry.io/platforms/go/profiling/
support_level: alpha
type: language
---

#### Configure Profiling

Add the `ProfilesSampleRate` option to your SDK config.

```go
err := sentry.Init(sentry.ClientOptions{
Dsn: "___PUBLIC_DSN___",
EnableTracing: true,
// We recommend adjusting these values in production:
TracesSampleRate: 1.0,
// The sampling rate for profiling is relative to TracesSampleRate:
ProfilesSampleRate: 1.0,
})
```