Git Product home page Git Product logo

gmx's Introduction

Go management extensions

Installation

go get github.com/davecheney/gmx

Getting started

Instrumenting you application with gmx is a simple as importing the gmx package in your main package via the side effect operator.

package main

import _ "github.com/davecheney/gmx"

By default gmx opens a unix socket in /tmp, the name of the socket is

/tmp/.gmx.$PID.0

Protocol version 0

The current protocol version is 0, which is a simple JSON based protocol. You can communicate with the gmx socket using a tool like socat.

% socat UNIX-CONNECT:/tmp/.gmx.$(pgrep godoc).0 stdin
["runtime.version", "runtime.numcpu"]
{"runtime.numcpu":4,"runtime.version":"weekly.2012-01-27 11688+"}

The request is a json array of strings representing keys that you wish to query. The result is a json map, the keys of that map are keys that matched the keys in your request. The value of the entry will be the result of the published function, encoded in json. If there is no matching key registered, no entry will appear in the result map.

For convenience a client is included in the gmxc sub directory. Please consult the README in that directory for more details.

Registering gmx keys

New keys can be registered using the Publish function

gmx.Publish(key string, f func() interface{})

f can be any function that returns a json encodable result. f is executed whenever its key is invoked, responsibility for ensuring the function is thread safe rests with the author of f.

Runtime instrumentation

By default gmx instruments selected values from the runtime and os packages, refer to the runtime.go and os.go source for more details.

Changelog

6/Feb/2012

  • gmx now honors the value of os.TempDir() when opening the unix socket
  • gmxc now accepts regexps for key names

5/Feb/2012

  • Initial release

gmx's People

Contributors

davecheney avatar zeebo avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.