Socket
Book a DemoInstallSign in
Socket

github.com/shjala/gostats

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/shjala/gostats

v0.0.0-20230215094906-69a32327600f
Source
Go
Version published
Created
Source

Intro

gostats is a simple, self contained package that collects runtime statistics from runtime.MemStats and sends them over UDP to statsd as a set of gauges.

Usage

You need graphite and statsd running in your preferred way, for example using Docker:

docker pull graphiteapp/graphite-statsd
docker run -p 8080:80 -p 8125:8125/udp --rm --name statsd graphiteapp/graphite-statsd

Then simply, collect the data:

package main

import (
	"fmt"
	"github.com/shjala/gostats"
)

func main() {
  // Endpoint is statsd endpoint address
  var Endpoint = "localhost:2125"

  // Tag is bucket tag
  var Tag = "your_tag"

  // collect stats every 5 seconds
  err := gostats.Collect(Endpoint, Tag, 5, true, true, true)
  if err != nil {
    fmt.Printf("Failed to start collecting runtime stats : %v\n", err)
    return
  }

  // Rest of the code
}

FAQs

Package last updated on 15 Feb 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.