Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
github.com/yvasiyarov/gorelic
New Relic agent for Go runtime. It collect a lot of metrics about scheduler, garbage collector and memory allocator and send them to NewRelic.
You have to install manually only first two dependencies. All other dependencies will be installed automatically by Go toolchain.
go get github.com/yvasiyarov/gorelic
and add to the initialization part of your application following code:
import (
"github.com/yvasiyarov/gorelic"
)
....
agent := gorelic.NewAgent()
agent.Verbose = true
agent.NewrelicLicense = "YOUR NEWRELIC LICENSE KEY THERE"
agent.Run()
If you using Beego, Martini, Revel, Kami or Gin framework you can hook up gorelic with your application by using the following middleware:
This agent use functions exposed by runtime or runtime/debug packages to collect most important information about Go runtime.
All this metrics are measured in nanoseconds. Last 4 of them can be inaccurate if GC called more often then once in GCPollInterval. If in your workload GC is called more often - you can consider decreasing value of GCPollInterval. But be careful, ReadGCStats() blocks mheap, so its not good idea to set GCPollInterval to very low values.
All this metrics collected once in MemoryAllocatorPollInterval. In order to collect this statistic agent use ReadMemStats() routine. This routine calls stoptheworld() internally and it block everything. So, please, consider this when you change MemoryAllocatorPollInterval value.
In order to collect HTTP metrics, handler functions must be wrapped using WrapHTTPHandlerFunc:
http.HandleFunc("/", agent.WrapHTTPHandlerFunc(handler))
You can collect metrics for blocks of code or methods.
func anyMethod() {
// Trace the whole method.
t := agent.Tracer.BeginTrace("My traced method")
defer t.EndTrace()
...Code here
// Trace a block of code
agent.Tracer.Trace("block trace", func() {
.. Code here
})
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.