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

Unable to send performance data to Sentry (echo integration) #642

Closed
alexistdk opened this issue May 24, 2023 · 10 comments · Fixed by #722
Closed

Unable to send performance data to Sentry (echo integration) #642

alexistdk opened this issue May 24, 2023 · 10 comments · Fixed by #722
Assignees

Comments

@alexistdk
Copy link

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

image

Sentry.io Event

Environment

SDK

  • sentry-go version: 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

@cleptric
Copy link
Member

cleptric commented May 24, 2023

Can you add Debug: true to sentry.Init and share the output, please?

@alexistdk
Copy link
Author

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.

@cleptric
Copy link
Member

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.

@zetaab
Copy link
Contributor

zetaab commented May 29, 2023

same applies to gin-gonic it seems.. perhaps worth of documenting or making common function to all?

@zetaab
Copy link
Contributor

zetaab commented May 29, 2023

added gin #644

at least for me it works, but not sure is everything like should

@github-actions
Copy link

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 🥀

@tonyo tonyo changed the title Unable to send performance data to Sentry Unable to send performance data to Sentry (sentryecho) Jun 20, 2023
@tonyo tonyo changed the title Unable to send performance data to Sentry (sentryecho) Unable to send performance data to Sentry (echo integration) Jun 20, 2023
@juliuslipp
Copy link

Would be lovely if you could add some docs. Just spend like too much time trying to figure out why it's not working...

@cleptric
Copy link
Member

Which part of the docs made you believe we do create transactions for echo automatically?

@juliuslipp
Copy link

No part. The fact that I came from JS/Python and it worked out of the box.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Feb 14, 2024
@ribice ribice self-assigned this Mar 14, 2024
@savepopulation
Copy link

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.

can you add this information to your web site docs, please? I was searching for a long time for the solution. thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

8 participants