yvasiyarov / gorelic

GoRelic is deprecated in favour of https://github.com/newrelic/go-agent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Http Metrics Not Getting Logged In NewRelic with version 0.0.6

debraj-spotnana opened this issue · comments

Hi,

I am not able to see the Http Metrics in the NewRelic Metrics Page. I am using the WrapHTTPHandlerFunc as mentioned in the README.md

http.HandleFunc("/", agent.WrapHTTPHandlerFunc(handler))

On turning the verbose mode on. I am seeing the below metrics being send to the NewRelic Servers:-

"agent": {
        "host": "jadehol838",
        "version": "0.0.6",
        "pid": 15551
    },
    "components": [
        {
            "name": "Search-Suggest-Dev",
            "guid": "com.github.yvasiyarov.GoRelic",
            "duration": 60,
            "metrics": {
                "Component/Runtime/GC/GCTime/Max[nanoseconds]": 0,
                "Component/Runtime/GC/GCTime/Mean[nanoseconds]": 0,
                "Component/Runtime/GC/GCTime/Min[nanoseconds]": 0,
                "Component/Runtime/GC/GCTime/Percentile95[nanoseconds]": 0,
                "Component/Runtime/GC/NumberOfGCCalls[calls]": 0,
                "Component/Runtime/GC/PauseTotalTime[nanoseconds]": 0,
                "Component/Runtime/General/NOCgoCalls[calls]": 8,
                "Component/Runtime/General/NOGoroutines[goroutines]": 10,
                "Component/Runtime/Memory/InUse/Heap[bytes]": 212240,
                "Component/Runtime/Memory/InUse/MCacheInuse[bytes]": 1200,
                "Component/Runtime/Memory/InUse/MSpanInuse[bytes]": 4784,
                "Component/Runtime/Memory/InUse/Stack[bytes]": 245760,
                "Component/Runtime/Memory/InUse/Total[bytes]": 212240,
                "Component/Runtime/Memory/Operations/NoFrees[frees]": 604,
                "Component/Runtime/Memory/Operations/NoMallocs[mallocs]": 1673,
                "Component/Runtime/Memory/Operations/NoPointerLookups[lookups]": 28,
                "Component/Runtime/Memory/SysMem/BuckHash[bytes]": 1.440192e+06,
                "Component/Runtime/Memory/SysMem/Heap[bytes]": 802816,
                "Component/Runtime/Memory/SysMem/MCache[bytes]": 16384,
                "Component/Runtime/Memory/SysMem/MSpan[bytes]": 16384,
                "Component/Runtime/Memory/SysMem/Stack[bytes]": 245760,
                "Component/Runtime/Memory/SysMem/Total[bytes]": 2.88588e+06,
                "Component/Runtime/System/FDSize[fd]": 256,
                "Component/Runtime/System/Memory/RssCurrent[bytes]": 4.419584e+06,
                "Component/Runtime/System/Memory/RssPeak[bytes]": 4.419584e+06,
                "Component/Runtime/System/Memory/VmCurrent[bytes]": 1.77455104e+08,
                "Component/Runtime/System/Memory/VmPeakSize[bytes]": 2.34156032e+08,
                "Component/Runtime/System/Threads[Threads]": 4
            }
        }
    ]
} 

+1, I am also having this problem, specifically when using graceful.ListenAndServe with a ServeMux -- i.e. https://gist.github.com/jonpaul/cfa7abb06c8a2c979679

@jonpaul, @debraj-manna-jabong Have you set agent.CollectHTTPStat = true? I think it's off by default.

It looks like you're correct, it seems to be unset by default, although interestingly initTimer sets it to true?

Anyhoo, I'd say adding this to the readme under the HTTP logging section would be valuable.

Yes it is working now.