Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zappem.net/pub/debug/vars

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zappem.net/pub/debug/vars

  • v0.6.1
  • Go
  • Socket score

Version published
Created
Source

vars - a package for atomically capturing counters and other state.

Overview

When running applications it helps, for debugging purposes, to support counting events in a standardized way. There are some elaborate packages out there for doing this, but this package is a bare bones version that I have found useful.

Samples

To set things up, you request some new metrics:

m := vars.New()

Then you can add to counters like this:

m.Add("my-counter", 2)

or simply set a metric:

m.Set("a-record", "green")

You can obtain the current value of a metric with:

value := m.Get("my-counter")

which simply returns nil if the requested metric does not exist.

License info

The vars package is distributed with the same BSD 3-clause license as that used by golang itself.

Reporting bugs and feature requests

The vars package was developed purely out of self-interest to help debug other programs and packages. Should you find a bug or want to suggest a feature addition, please use the bug tracker.

FAQs

Package last updated on 28 Nov 2024

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc