sentry-go
sentry-go copied to clipboard
Unable to send performance data to Sentry (echo integration)
Summary
I'm following the documentation and I'm not able to send performance data to Sentry.io. This doesn't happen with other features like messages or events. In order to reproduce the error, I created a hello world app with a basic integration of Sentry.
Steps To Reproduce
Here you have the code https://go.dev/play/p/A9scQPjpE0r?v=goprev
package main
import (
"fmt"
"net/http"
"github.com/getsentry/sentry-go"
sentryecho "github.com/getsentry/sentry-go/echo"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
// To initialize Sentry's handler, you need to initialize Sentry itself beforehand
if err := sentry.Init(sentry.ClientOptions{
Dsn: "mysecretkey",
// Set TracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production,
TracesSampleRate: 1.0,
Debug: true,
Environment: "localhost",
Release: "v1.0",
EnableTracing: true,
}); err != nil {
fmt.Printf("Sentry initialization failed: %v\n", err)
}
// Then create your app
app := echo.New()
app.Use(middleware.Logger())
app.Use(middleware.Recover())
// Once it's done, you can attach the handler as one of your middleware
app.Use(sentryecho.New(sentryecho.Options{}))
app.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
app.Logger.Fatal(app.Start(":1323"))
}
Expected Behavior
I'm expecting to see metrics.
Screenshots
Sentry.io Event
Environment
SDK
sentry-goversion: 0.21.0- Go version: 1.19.5 linux/amd64
- Using Go Modules?
Sentry
- Using hosted Sentry in sentry.io? yes
- Using your own Sentry installation? Version:
- Anything particular to your environment that could be related to this issue?
Additional context
Can you add Debug: true to sentry.Init and share the output, please?
The Debug: true is already in the sentry.Init. The output is this:
$ go run main.go
[Sentry] 2023/05/24 10:30:03 Integration installed: ContextifyFrames
[Sentry] 2023/05/24 10:30:03 Integration installed: Environment
[Sentry] 2023/05/24 10:30:03 Integration installed: Modules
[Sentry] 2023/05/24 10:30:03 Integration installed: IgnoreErrors
____ __
/ __/___/ / ___
/ _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.10.2
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
O\
⇨ http server started on [::]:1323
{"time":"2023-05-24T10:30:06.926478793-03:00","id":"","remote_ip":"127.0.0.1","host":"localhost:1323","method":"GET","uri":"/","user_agent":"curl/7.81.0","status":200,"error":"","latency":22970,"latency_human":"22.97µs","bytes_in":0,"bytes_out":13}
The curl command that I'm using is curl -IL -XGET localhost:1323/ and that's the only log that I get no matter how many times I run it.
Sorry, I missed this. Our echo integration does not create performance data by default. You could implement a custom middleware that does this as we do for net/http https://github.com/getsentry/sentry-go/blob/master/http/sentryhttp.go#L81-L112.
same applies to gin-gonic it seems.. perhaps worth of documenting or making common function to all?
added gin https://github.com/getsentry/sentry-go/pull/644
at least for me it works, but not sure is everything like should
This issue has gone three weeks without activity. In another week, I will close it.
But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
Would be lovely if you could add some docs. Just spend like too much time trying to figure out why it's not working...
Which part of the docs made you believe we do create transactions for echo automatically?
No part. The fact that I came from JS/Python and it worked out of the box.
Sorry, I missed this. Our
echointegration does not create performance data by default. You could implement a custom middleware that does this as we do fornet/httphttps://github.com/getsentry/sentry-go/blob/master/http/sentryhttp.go#L81-L112.
can you add this information to your web site docs, please? I was searching for a long time for the solution. thanks.