newrelic / go-agent

New Relic Go Agent
Apache License 2.0
762 stars 297 forks source link

`.Ignore()` not ignoring transaction (go-agent + nrgin) #845

Closed gwkline closed 5 months ago

gwkline commented 6 months ago

Description

Hi there! I have a transaction I've been trying to ignore/not see in my NewRelic dashboard. It's a GraphQL subscription (websocket) and for some reason, calling the go-agent .Ignore() method does not seem to be properly ignoring this request.

I am using Gin, so nrgin is initialized in my API's main function. I am using all default options (to the best of my knowledge) CleanShot 2024-01-29 at 17 59 26

The .Ignore() call is happening in my GraphQL endpoint handler. I know the middleware is all working (as I can see transaction names and variables for my other requests), but Ignore() is... being ignored 😅 CleanShot 2024-01-29 at 18 01 04

Expected Behavior

Calling .Ignore() should not show the transaction at all in the NewRelic dash.

Your Environment

Running in a docker container based off of golang:alpine

go 1.21

require (
    github.com/99designs/gqlgen v0.17.43
    github.com/gin-gonic/gin v1.9.1
    github.com/newrelic/go-agent/v3 v3.29.1
    github.com/newrelic/go-agent/v3/integrations/nrgin v1.2.1
    github.com/newrelic/go-agent/v3/integrations/nrpgx5 v1.2.0
    github.com/rafaelhl/gorm-newrelic-telemetry-plugin v1.0.0
gwkline commented 6 months ago

~Ended up having to ignore the transaction in the websocket upgrader as well - seems to be working fine. Apologies!~

Edit: nevermind, still not being ignored it would seem

iamemilio commented 5 months ago

I'll try to verify the functionality of the ignore method on our end and get back to you.

iamemilio commented 5 months ago

Hi @gwkline, I think that if you enabled debug logs, there might be something in there that will help you or us get closer to a why this is happening. We actually log when transactions are marked ignored, and it would be helpful to just have that verification.

    if txn.Config.Logger.DebugEnabled() {
        txn.Config.Logger.Debug("transaction ended", map[string]interface{}{
            "name":          txn.FinalName,
            "duration_ms":   txn.Duration.Seconds() * 1000.0,
            "ignored":       txn.ignore,
            "app_connected": txn.Reply.RunID != "",
        })
    }
iamemilio commented 5 months ago

you may not want to post debug logs here, so I would recommend opening a support ticket with New Relic if you have access to that.

iamemilio commented 5 months ago

just wrote out this test case, I suspect that this behavior may be more on your end than ours, but please feel free to correct me: https://github.com/newrelic/go-agent/pull/865/files

iamemilio commented 5 months ago

@gwkline may I close this?